MCP Resources
MCP resources provide read-only access to data. Unlike tools, resources don't perform actions — they fetch structured data by URI.
lnkify exposes two resources:
| URI | Description |
|---|---|
lnkify://list | All shortlinks owned by the authenticated user |
lnkify://{id} | Detailed view of a single shortlink |
Reading a Resource
Use the resources/read method:
{
"jsonrpc": "2.0",
"method": "resources/read",
"params": { "uri": "lnkify://list" },
"id": 3
}Response:
{
"jsonrpc": "2.0",
"result": {
"contents": [
{
"uri": "lnkify://list",
"mimeType": "application/json",
"text": "[{\"id\":\"lnk_001\",\"target\":\"https://example.com\",\"slug\":\"my-link\",\"hitCount\":42}]"
}
]
},
"id": 3
}Resource lnkify://
The {id} template parameter accepts a shortlink ID. This resource returns full detail: link metadata, hits array, and by-country aggregation.
curl -X POST https://mcp.lnkify.io/ \
-H "Content-Type: application/json" \
-H "x-api-key: lf_live_YOUR_KEY" \
-H "Mcp-Session-Id: SESSION_ID" \
-d '{"jsonrpc":"2.0","method":"resources/read","params":{"uri":"lnkify://lnk_001"},"id":4}'Listing Available Resources
Call resources/list to discover resources and their URI templates at runtime:
{
"jsonrpc": "2.0",
"method": "resources/list",
"id": 5
}The response includes each resource's URI, name, description, and MIME type. The {id} resource includes a URI template annotation so clients know to substitute a real ID.
Ownership Scoping
Resources only return data that belongs to the authenticated user. A request for lnkify://lnk_notmine where the link is owned by another user returns a JSON error body (not an MCP error):
{
"error": "Shortlink not found"
}Not Found Handling
When a resource URI resolves to a non-existent or unowned shortlink, the server returns the regular MCP response format with an error message in the content body. It does not return an MCP-level error because the resources/read call itself succeeded — the URI simply points to data that isn't there.
Next: Idempotency