core profile exposes 29 generated endpoint tools plus two composite discovery tools. The full profile exposes 78 generated endpoint tools plus the same two composite tools.
This page is for adding TokenLab as a tool server inside Claude Code, Cursor, VS Code, Codex, Claude Desktop, Cline, Windsurf, or another MCP client. To call TokenLab directly from application code, start with the API quickstart.
Public catalog and pricing tools do not require a TokenLab API key. Set
TOKENLAB_API_KEY for credentialed inference, media, audio, file, task, embedding, rerank, and translation operations. Never place an API key in tool arguments.What It Provides
- Live model discovery from
https://api.tokenlab.sh/v1/models. - Model detail lookup from
/v1/models/{model}. - Pricing lookup from
/v1/models/{model}/pricing. - Agent-readable API overview from
https://api.tokenlab.sh/llms.txt. - OpenAI-compatible Chat Completions and Responses, Anthropic Messages, and Gemini generateContent without flattening their native request shapes.
- Image generation and editing through JSON URLs, TokenLab file IDs, or local multipart files.
- Video, music, 3D, speech, transcription, audio translation, embeddings, multimodal embeddings, rerank, and text translation.
- Normalized async task summaries for image, video, music, 3D, and world-generation operations.
- A daily contract sync that fetches the public OpenAPI document, regenerates tool schemas, runs endpoint and file tests, and updates
mainonly when every check passes.
Quickstart
The fastest safe setup starts with the six public catalog tools. It does not require a TokenLab API key, and you can enable credentialed tools later.Install in Cursor
Add the public
catalog profile to Cursor in one clickInstall in VS Code
Add the public
catalog profile to your VS Code user configuration1
Check the requirements
Install Node.js 18.17 or newer and confirm that You do not need to install the MCP package globally or clone its repository.
npx is available:2
Choose an access level
Create a key in Dashboard → API Keys only if you want the server to make credentialed API calls. Keep the key in the client’s secret environment; never paste it into a prompt or MCP tool argument.
3
Configure your client
Choose your client below. The public examples explicitly select the
catalog profile so every exposed tool works without a key.- Claude Code
- Cursor
- VS Code
- Codex
- Claude Desktop
- Other clients
Add TokenLab for your user account so it is available across projects:To enable the default Use
core profile, add the server with your API key instead:--scope local for only the current project, or --scope project to create a team-shared .mcp.json. Do not commit a real key to a project configuration.4
Restart and verify
Restart or reload the MCP client, approve the local server when prompted, and confirm that Then ask the agent to call
tokenlab-model-catalog is connected.list_models. A non-empty model list proves that the client started the server, completed MCP discovery, and reached TokenLab’s public catalog. No API key is needed for this check.Configuration Reference
Use these values in any client that supports local stdio MCP servers. Add each argument as a separate item.
For credentialed tools, add the key and select the tool profile in the server’s environment:
mcpServers wrapper, copy only the inner object containing command, args, and env. VS Code is the main exception: its configuration uses a top-level servers object.
Install From Source
Use a source checkout only when you want to audit or develop the MCP server. Normal client setup should use the published npm package shown above.core and full profiles publish bounded portable tool schemas by default while the server validates every call against the complete OpenAPI contract. Set TOKENLAB_MCP_SCHEMA_MODE=exact for complete nested schemas, or TOKENLAB_MCP_SCHEMA_MODE=strict for providers that require closed objects and every property in required; strict mode represents complex top-level values as JSON-encoded strings.
Generated Tool Profiles
Tool names, descriptions, input schemas, HTTP methods, paths, content types, auth requirements, and task behavior are generated from the checked-in OpenAPI snapshot. An MCP-only overlay supplies stable tool aliases, profile membership, async task semantics, multipart variants, secret omission, and non-streaming constraints.
Version 0.6.0 also returns JSON through MCP
structuredContent, publishes three contract resources, and provides two prompt templates for model selection and native request construction. Generated and composite tools include standard risk annotations so compatible clients can apply safer approval policies.
Common core tools include:
MCP tool calls return one final result. Streaming-only and realtime operations are excluded, and the server fixes supported
stream arguments to false internally without exposing a boolean constant to provider adapters. Small image and audio responses return native MCP content; larger binary responses are written to TOKENLAB_ARTIFACT_DIR and returned with their local path, MIME type, and byte count.
Async Media Results
Video, music, and 3D creation return async task summaries. Image generation and editing can return either a completed result or an async task, depending on the selected model and request. Whendelivery.mode is async, call get_task_status with { "id": delivery.task_id } until delivery.terminal is true. Determine completion from status; progress is optional and must not be used as the terminal condition.
Recommended Agent Workflow
- Call
list_modelswhen the user has not named a model. - Use
recommended_forfor non-chat tasks, such as image, video, music, 3D, TTS, STT, embeddings, rerank, or translation. - Call
get_modelbefore building a non-chat request, retrying a failed request, or switching endpoint families. - Call
get_model_pricingwhen model cost affects the user’s choice. - Use
compare_modelswhen the choice depends on several candidates. - Call the generated tool that matches the required API contract, or use
get_api_overviewfor a compact map of TokenLab API families.
Native Endpoint Guidance
TokenLab supports OpenAI-compatible routes and native endpoint families. The MCP server helps an agent choose the right route before it writes code:Hosted Model Explorer
Clients that support Streamable HTTP can connect to:open_tokenlab_model_explorer, compare_tokenlab_models, and generate_tokenlab_endpoint_example. Use the local npm server above when you need the generated core/full profiles, local file uploads, or credentialed API operations.
Use It With TokenLab Skills
The MCP server is useful at runtime, while the TokenLab skills repository teaches coding agents how to generate and repair integration code. Use both when available:- MCP server: discover current models, pricing, and endpoint details.
tokenlab-api-integrationskill: generate runnable API examples and handle structured TokenLab errors.tokenlab-model-pickerskill: choose strong models for the user’s task.tokenlab-native-endpointsskill: decide when to use Responses, Anthropic Messages, Gemini, media, audio, embedding, rerank, or translation routes.
Troubleshooting
The client cannot start the server
The client cannot start the server
Confirm Node.js is at least 18.17 and that the client can find
npx. Then run npx -y @tokenlabai/mcp-server once in a terminal to surface npm or network errors. A successful stdio launch waits silently for MCP messages; press Ctrl+C after confirming that it starts.The server is configured but no tools appear
The server is configured but no tools appear
Restart the client and approve or trust the local server when prompted. In Claude Code, run
claude mcp list or open /mcp. In VS Code, run MCP: List Servers, select TokenLab, and choose Show Output. In Cursor, open Settings → Tools & MCP and confirm that the server and its tools are enabled.Claude Code shows Pending approval
Claude Code shows Pending approval
Project-scoped
.mcp.json servers require workspace trust and explicit approval. Start Claude Code interactively in the project, accept the workspace trust prompt, open /mcp, and approve tokenlab-model-catalog. Use --scope user instead when the server should be private to your account and available across projects.The model list is empty
The model list is empty
Verify that the machine can reach
https://api.tokenlab.sh/v1/models. If you override TOKENLAB_API_BASE, make sure it does not include a trailing slash.The agent still chooses stale model IDs
The agent still chooses stale model IDs
Ask the agent to call
list_models or get_model before hardcoding a model name. Pairing the MCP server with tokenlab-model-picker gives better results.Can this server call paid TokenLab inference APIs?
Can this server call paid TokenLab inference APIs?
Yes. Set
TOKENLAB_API_KEY, then use the generated LLM, media, audio, task, file, embedding, rerank, or translation tools. Catalog and pricing tools remain available without a key.A credentialed tool returns an authentication error
A credentialed tool returns an authentication error
Confirm that
TOKENLAB_API_KEY is set in the MCP server’s environment, not pasted into the tool arguments or prompt. Restart the client after changing the configuration. If the key was exposed in a shared file, screenshot, log, or shell history, rotate it before retrying.The client rejects tool schemas or loads too many tools
The client rejects tool schemas or loads too many tools
Start with
TOKENLAB_MCP_TOOL_PROFILE=catalog for six discovery tools or keep the default core profile for 31 tools. The default portable schema mode works with the widest range of clients. Use exact only when complete nested schemas are required, or strict when the model provider requires closed objects and every property in required.How do I pin or update the package version?
How do I pin or update the package version?
Replace the package argument with
@tokenlabai/mcp-server@0.6.17 for a repeatable setup using the currently verified release. To change versions, update that argument in the client configuration and restart the server. Review the public repository before adopting a newer release.Resources
TokenLab MCP
Product overview and connection options for the Core 31 and Full 80 toolsets
GitHub Repository
Source code and local setup instructions
TokenLab Skills
Maintained agent skills for TokenLab integrations
Model Catalog API
Public model discovery endpoint
llms.txt
Agent-readable TokenLab API overview
Glama MCP Server
View the verified TokenLab MCP Server listing
Glama Model Explorer
Explore models, pricing, and native endpoint examples
MCP.so Listing
Discover TokenLab in the AI & Agents directory
Hosted Model Explorer
Open the public model explorer and remote MCP endpoint
Claude Code MCP Guide
Review Claude Code scopes, approvals, status checks, and MCP configuration
Cursor MCP Guide
Review Cursor configuration locations, tool controls, and security guidance
VS Code MCP Guide
Review VS Code user and workspace configuration, trust, logs, and server management