CLI + MCP
The CLI can run as a local Model Context Protocol server over stdio, exposing your links as tools that AI agents can call. It uses your configured CLI credentials, so an agent acts as you against whichever server your active profile points at.
CLI MCP vs. hosted MCP server
This is different from the hosted MCP Server at mcp.lnkify.io, which speaks Streamable HTTP. The CLI's mcp serve runs locally over stdio — ideal for desktop agents like Claude Desktop that launch a local command. Both ultimately drive the same GraphQL API.
Run the server
lnkify mcp serveAuthentication comes from the same resolution chain as every other command — flags, env, the active profile, or the default. Make sure you've authenticated first (see Authentication).
Available tools
| Tool | Description |
|---|---|
create_link | Create a shortlink for a target URL |
list_links | List your links with optional search/pagination |
get_link | Get details for a single link by id |
delete_link | Delete a link by id |
resolve_link | Resolve a slug to its destination |
analytics | Aggregate analytics across all your links |
Install into a client
mcp install prints a ready-to-paste config block for your MCP client (Claude Desktop by default):
lnkify mcp installIt carries your resolved server URL and — if you authenticate with an API key — an LNKIFY_API_KEY entry, producing config like:
{
"mcpServers": {
"lnkify": {
"command": "lnkify",
"args": ["mcp", "serve"],
"env": {
"LNKIFY_API_URL": "https://lnkify.example.com",
"LNKIFY_API_KEY": "lf_live_YOUR_KEY"
}
}
}
}Pass --write to merge it directly into the Claude Desktop config file:
lnkify mcp install --writeRestart your agent afterward to pick up the new server.
Next: Examples