Skip to content

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

bash
lnkify mcp serve

Authentication 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

ToolDescription
create_linkCreate a shortlink for a target URL
list_linksList your links with optional search/pagination
get_linkGet details for a single link by id
delete_linkDelete a link by id
resolve_linkResolve a slug to its destination
analyticsAggregate 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):

bash
lnkify mcp install

It carries your resolved server URL and — if you authenticate with an API key — an LNKIFY_API_KEY entry, producing config like:

json
{
  "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:

bash
lnkify mcp install --write

Restart your agent afterward to pick up the new server.

Next: Examples

Released under the MIT License.