Skip to content

Gateway API

MCP server

The Gateway as four tools inside whatever agent you already use. One endpoint for 17 models from 5 providers, and the receipt comes back with the answer.

@lobstack-ai/mcp speaks the Model Context Protocol over stdio, so any client that reads an MCP config can call the Gateway directly — Claude Desktop, Claude Code, Cursor, Zed. The point is not that it is another way to send a prompt. It is that the agent doing the sending can see what each call cost, and can ask what a call would cost before making it.

bash
npx -y @lobstack-ai/mcp

Published on npm as @lobstack-ai/mcp at 0.1.3. The scope is @lobstack-ai and not @lobstack; every configuration block below spells it out in full so there is nothing to guess.

It starts without a key. lobstack_route_preview scores a prompt and names the model the router would pick, and that needs no credential — so you can see what the router does before deciding whether to hand it one.

The four tools

ToolWhat it doesNeeds a key
lobstack_route_previewScores a prompt and reports which model the router would serve it with, and why.No
lobstack_modelsThe catalogue: tier, provider, context window and per-token price for each model.No
lobstack_chatSends a prompt through the Gateway and returns the reply with its receipt attached.Yes
lobstack_spendWhat this organization has spent over a range, broken down by model.Yes

Adding it to a client

Every client below reads the same shape: a command, its arguments, and an environment. Put your key in LOBSTACK_API_KEY; it never leaves the machine the server runs on.

Claude Desktop

claude_desktop_config.json — on macOS under ~/Library/Application Support/Claude/, on Windows under %APPDATA%\\Claude\\.

json
{
  "mcpServers": {
    "lobstack": {
      "command": "npx",
      "args": ["-y", "@lobstack-ai/mcp"],
      "env": { "LOBSTACK_API_KEY": "lsk_live_..." }
    }
  }
}

Claude Code

bash
claude mcp add lobstack --env LOBSTACK_API_KEY=lsk_live_... -- npx -y @lobstack-ai/mcp

Cursor and Zed

Cursor reads .cursor/mcp.json in a project or ~/.cursor/mcp.json globally; Zed takes the same object under context_servers in its settings. The block is identical to the Claude Desktop one above.


What comes back

lobstack_chat returns the reply and the receipt together, so the agent holding the result also holds what it cost. Two rules from Metering & cost survive into the MCP surface unchanged, because they are the two that are easy to get wrong:

  • cost_usd: null means the call could not be priced. It does not mean it was free, and it is never rendered as $0.00.
  • A saving is only reported as a saving when the caller named a model and got something cheaper. When the caller sent auto, the comparison is against the priciest model the plan allows — real, but not something anyone asked for, and labelled as such.

Base URL

The default is https://www.lobstack.ai/api/gateway/v1, with the www. Set LOBSTACK_BASE_URL to point elsewhere. If you set it to the apex without www, the server rewrites it — the apex redirects, and a redirect across hosts strips the Authorization header, so the call would arrive unauthenticated.


Source

MIT, at github.com/Lobstack-ai/lobstack-mcp. If you would rather not add a server at all, the CLI runs a local OpenAI-compatible proxy, and the SDK is a typed client for the same endpoint.

Lobstack

An AI team that asks before it acts, and an API with a receipt on every call.

© LobstackXLinkedInGitHub