TokenLab MCP Server
TokenLab MCP Server lets agents discover and compare models/pricing, then call TokenLab APIs for text, generation, embeddings, decisions, files, translation, and async tasks.
Discover, inspect, and compare TokenLab models, capabilities, and pricing; fetch an API overview.
Run text inference through OpenAI-compatible Chat Completions, Responses, Anthropic Messages, and Gemini generateContent shapes.
Generate or edit images, generate video/music/3D/speech, transcribe audio, and translate audio/text.
Create text and multimodal embeddings, rerank documents, and evaluate typed decision questions.
Manage async generation tasks: check status and cancel supported queued tasks.
Upload, list, retrieve, download, and delete files.
Use public catalog/pricing tools without an API key; credentialed tools require
TOKENLAB_API_KEY.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TokenLab MCP Server show me the latest pricing for models suitable for text generation"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TokenLab MCP Server
OpenAPI-generated Model Context Protocol server for TokenLab public model discovery, pricing, native LLM endpoints, typed decisions, multimodal generation, async tasks, files, embeddings, rerank, translation, resources, prompts, and the broader developer API.
It exposes public catalog tools for agents that need to choose models, inspect supported request formats, or compare pricing before calling TokenLab APIs. Credentialed tools cover text inference, image generation and editing, video, music, 3D, async task polling, embeddings, rerank, typed decisions, and text translation.
Generated Tool Profiles
The checked-in generated/tools.json manifest is generated from TokenLab's public OpenAPI document plus the small MCP-only overlay in contract/mcp-overlay.json. Version 0.6.45 generates 87 endpoint tools; with the two MCP-only composite discovery tools, the full profile returns 89 tools from tools/list.
Profile | Endpoint tools | Total registered tools | Model-facing schema | Coverage |
| 4 | 6 | Exact | Public model discovery and pricing only; no API key required |
| 30 | 32 | Portable | Catalog and pricing; Chat Completions, Responses, Anthropic Messages, Gemini generateContent; System One typed decisions; images, video, music, 3D, speech and transcription; async tasks; files; embeddings, rerank, and translation |
| 87 | 89 | Portable | Every allowlisted developer API operation in the checked-in OpenAPI snapshot, including core plus response lifecycle, batches, worlds, and native model discovery |
The total registered count is the number returned by tools/list. All profiles include compare_models and get_api_overview, producing totals of 6, 32, and 89 tools. Realtime and streaming-only operations are excluded because stdio MCP tool calls return one final result. API operations that accept stream fix it internally to false without exposing a boolean const to provider adapters, and the Gemini query-string API key is intentionally hidden from tool arguments. create_gemini_content exposes the camelCase Gemini fields (systemInstruction, generationConfig, safetySettings, toolConfig, cachedContent) and hides their snake_case proto spellings, which the API accepts as aliases.
The portable projection keeps every top-level argument but bounds deeply nested model-facing shapes. The server still validates calls against the complete generated OpenAPI schema before issuing an API request. Compatibility budgets keep core at no more than 60 KB and depth 8, and full at no more than 115 KB and depth 8 for the complete tools/list response. Tests also run the full profile through the Google AI SDK version used by the observed OpenCode/Gemini failure and keep its function declarations within 90 KB.
Set TOKENLAB_MCP_TOOL_PROFILE=catalog for the smallest public-only tool list or TOKENLAB_MCP_TOOL_PROFILE=full for the broad developer API. Set TOKENLAB_MCP_SCHEMA_MODE=exact only when a client needs the complete nested JSON Schema and can accept its larger/deeper tool payload. Use strict for providers that require every property to be listed in required and every object to set additionalProperties: false; complex top-level arguments are represented as JSON-encoded strings and decoded before canonical validation. Canonical tool names, descriptions, input JSON Schemas, HTTP bindings, content types, auth requirements, and task behavior can be inspected in generated/tools.json.
The smaller generated/public-contract.json is the machine-readable projection used by TokenLab's website and other public consumers. It contains package identity, profile counts, core tool layers, resources, prompts, and source hashes without copying all endpoint schemas.
Related MCP server: gliana-mcp-remote
Native MCP Features
JSON tool responses include
structuredContentwhile retaining serialized text for older clients.HTTP errors retain the original response text (up to 4,000 characters), including public correction hints, alongside structured status, request ID and retry timing. Only the request ID and retry headers are exposed; failed generation requests are never submitted again automatically.
Generated tools expose human-readable titles, standard read-only/destructive/idempotent/open-world annotations, and response request IDs when available.
Tool schemas are published and validated directly as JSON Schema. The runtime does not round-trip generated tool schemas through Zod;
exactmode is byte-shape equivalent to the generated canonical schema.Three resources expose the live API overview, the package's OpenAPI snapshot, and the compact MCP public contract.
choose_tokenlab_modelandbuild_tokenlab_requestprompts guide agents to use live model truth and preserve native endpoint shapes.Server instructions tell clients to confirm billable or destructive operations and treat external model/API output as untrusted content.
Run
npm install
npm startInstall from npm:
npx -y @tokenlabai/mcp-serverAgent-assisted installers can follow llms-install.md for a credential-safe setup and verification flow.
Run in Docker:
docker build -t tokenlab-mcp-server .
docker run --rm -i tokenlab-mcp-serverAdd -e TOKENLAB_API_KEY when using credentialed API tools. Public catalog tools do not require a key.
Claude Desktop style config:
{
"mcpServers": {
"tokenlab-model-catalog": {
"command": "npx",
"args": ["-y", "@tokenlabai/mcp-server"],
"env": {
"TOKENLAB_API_BASE": "https://api.tokenlab.sh"
}
}
}
}No TokenLab API key is required for public catalog and pricing operations. Set TOKENLAB_API_KEY when credentialed tools should call TokenLab APIs. Generated tools preserve the OpenAPI request shape for OpenAI-compatible and native endpoints instead of flattening them into a shared prompt format.
Multipart operations accept local file paths. Small image and audio responses are returned as native MCP content; larger or other binary responses are written to TOKENLAB_ARTIFACT_DIR and returned as a path with MIME type and byte count.
Sync and Async Media Results
Video, music, and 3D creation tools always return an async task. Image generation and editing may return a completed result or an async task depending on the selected model and request.
Media tools preserve the complete TokenLab API response under response and add a normalized delivery summary:
{
"delivery": {
"mode": "async",
"task_id": "ldtask_...",
"status": "pending",
"poll_url": "/v1/tasks/ldtask_...",
"terminal": false,
"next_tool": "get_task_status"
},
"response": {}
}Use delivery.mode instead of assuming all image requests are synchronous. For async tasks, call get_task_status with { "id": delivery.task_id } until delivery.terminal is true. Completion is determined from status, not from an optional progress field.
Environment
TOKENLAB_API_BASE: optional, defaults tohttps://api.tokenlab.shTOKENLAB_API_KEY: optional; required for text inference, multimodal generation, async task, embedding, rerank, decision, and translation toolsTOKENLAB_MCP_TOOL_PROFILE: optional,catalog,core(default), orfullTOKENLAB_MCP_SCHEMA_MODE: optional,portable,exact, orstrict; defaults to the selected profile's tested modeTOKENLAB_REQUEST_TIMEOUT_MS: optional request timeout in milliseconds, defaults to120000TOKENLAB_MCP_MAX_FILE_BYTES: optional maximum local upload size per file, defaults to104857600(100 MiB)TOKENLAB_MCP_INLINE_BYTES: optional maximum binary/JSON response size returned inline, defaults to2097152(2 MiB)TOKENLAB_ARTIFACT_DIR: optional output directory for non-inline response artifacts, defaults to the OS temp directory undertokenlab-mcp
For Chat Completions image inputs, prefer byte-accurate data URLs such as data:image/png;base64,.... If an MCP caller labels a recognized PNG, JPEG, WebP, or GIF payload as application/octet-stream, the server corrects that generic MIME before forwarding. An unrecognized generic binary payload is rejected locally with a precise input error.
Contract Sync
The public OpenAPI document is the API contract source. The overlay contains only MCP-specific choices: profile exposure, stable tool aliases, secret omission, non-streaming constraints, content-type variants, async task semantics, and the compact public projection consumed by the website and docs gates.
npm run contract:source-check # compare the snapshot with the live canonical OpenAPI (read-only)
npm run contract:check # check generated output against the checked-in snapshot (offline)
npm run contract:sync # fetch OpenAPI and regenerate; refuses dirty outputs or a stale branch
npm test # compile profiles and test exact/portable/strict schemas, provider conversion, routing, tasks, files, and binary outputAlways run git pull --ff-only before a manual contract sync. contract:check proves internal consistency only; contract:source-check proves freshness against the canonical source. The scheduled Sync TokenLab OpenAPI contract workflow runs the full write sequence and commits only the verified OpenAPI snapshot and generated manifest to main. A failed fetch, stale local branch, dirty generated output, generation error, schema compilation error, or test leaves the tracked contract unchanged.
MCP Registry Metadata
This repository includes server.json for the official MCP Registry.
Release metadata:
npm package:
@tokenlabai/mcp-server@0.6.45MCP registry name:
io.github.hedging8563/tokenlabpackage.json.mcpName:io.github.hedging8563/tokenlab
For a new release:
Bump the matching versions in
package.json,package-lock.json, andserver.json.Push a matching tag such as
v0.6.0.The publish workflow tests and publishes npm through trusted publishing, then publishes the MCP Registry entry through GitHub Actions OIDC.
The same workflow can be run manually from main to republish only the current MCP Registry metadata. No npm or MCP Registry token is stored in GitHub.
Security
Use the catalog profile when no credentialed tools are needed. Keep TOKENLAB_API_KEY in the local MCP client's secret environment, enable human confirmation for billable and destructive calls, and review tool annotations before granting persistent approval. Do not send a TokenLab API key to an untrusted hosted MCP server.
Each API request sends X-TokenLab-Client-Source: mcp-<tool name> (for example mcp-create_image) so TokenLab can count which tools are used. Reading the tokenlab://api/overview resource sends mcp-resource-api_overview. The header holds only the lowercased tool name, cut to 64 characters, and no tool arguments.
Links
Website: https://tokenlab.sh/mcp
Docs: https://tokenlab.sh/docs
Model catalog: https://api.tokenlab.sh/v1/models
Webhook management
Use the full profile to configure workspace webhooks with list_webhooks, create_webhook, get_webhook, update_webhook, delete_webhook, rotate_webhook_secret, test_webhook and list_webhook_deliveries.
Set TOKENLAB_MANAGEMENT_TOKEN=mt-... separately from TOKENLAB_API_KEY=sk-.... Create the management token at Dashboard → API → Management Tokens. It authorizes management operations only within its workspace and is not limited to webhooks. The inference key cannot substitute for it; the whsec_... returned by creation/rotation is for receiver signature verification only. Keep all credentials out of tool arguments and prompts.
Webhook notifications avoid continuous task polling. On a polling fallback, stop on terminal status, 401/403/404 or retryable: false; back off on transient failures. See the complete webhook guide for payloads, signing, deduplication and delivery history.
Available Tools
32 toolscancel_taskCancel async taskADestructiveIdempotent
Cancels a queued asynchronous task when cancellation is supported for the selected task. Cancellation currently supports queued Seedance video tasks (seedance-1.5-pro, seedance-2.0, and seedance-2.0-fast) while they are still waiting to run. Tasks that are already processing, completed, failed, expired, or unsupported are not cancelled.
Inputs: id (required).
compare_modelsCompare TokenLab ModelsARead-onlyIdempotent
Compare public TokenLab model details and pricing for several model IDs.
Inputs: models (required), include_raw.
create_3d_modelCreate 3D model generation taskB
Creates a 3D model generation task using Tripo3D. Returns a task ID for polling.
Inputs: prompt (required), seed, user, image, +6 more.
create_anthropic_messageCreate message (Anthropic-compatible)A
Creates a model response using Anthropic's native request format. Supports Claude models with vision and streaming. Authentication: Use x-api-key header or Authorization: Bearer header.
Inputs: model (required), messages (required), max_tokens (required), tools, +11 more.
create_chat_completionCreate chat completionA
Create an OpenAI-compatible chat completion. For inline image_url data URLs, declare the byte-accurate image MIME type. The MCP boundary corrects recognized PNG, JPEG, WebP, and GIF payloads declared as application/octet-stream and rejects unrecognized generic binary image payloads before sending a billable request.
Inputs: model (required), messages (required), n, seed, +25 more.
create_embeddingCreate embeddingsC
Creates an embedding vector representing the input text.
Inputs: input (required), model (required), user, dimensions, +2 more.
create_gemini_contentGenerate content (Gemini-compatible)A
Generates content using the Gemini GenerateContent request shape. The model details must advertise Gemini requests and the model must be available. ProtoJSON lowerCamelCase and original proto snake_case field names are preserved. Unknown fields are accepted on a best-effort basis; model-specific support is not guaranteed. Authentication: Use ?key= query parameter, x-goog-api-key header, or Authorization: Bearer header.
Inputs: model (required), contents (required), tools, toolConfig, +10 more.
create_imageCreate imageC
Creates an image given a prompt.
Inputs: model (required), prompt (required), n, seed, +22 more.
create_image_fileCreate imageD
Creates an image given a prompt.
Inputs: model (required), prompt (required), n, seed, +22 more.
create_multimodal_embeddingCreate multimodal embeddingsB
Creates embeddings for multimodal input items. Text input is generally available; image input may require feature enablement.
Inputs: input (required), model (required), dimensions, X-TokenLab-Delivery-Policy.
create_musicCreate music generation taskC
Creates a music generation task using Suno. Returns a task ID for polling.
Inputs: mv, tags, model, title, +9 more.
create_responseCreate response (OpenAI Responses API)A
Creates a response using the OpenAI Responses API request shape. The model details must advertise the Responses request format and the model must be available. Unknown fields are accepted on a best-effort basis; model-specific support is not guaranteed.
Inputs: model (required), text, input, store, +17 more.
create_speechCreate speechC
Generates audio from the input text (Text-to-Speech).
Inputs: input (required), model, speed, voice, +8 more.
create_videoCreate video generation taskA
Creates an asynchronous video generation task. The response returns a canonical task ID and usually a preferred poll_url; clients should poll poll_url first, or use /v1/tasks/{id} as the fixed status endpoint.
Inputs: bgm, fps, seed, size, +48 more.
delete_fileDelete fileBDestructiveIdempotent
Deletes a batch file or a bound image/reference file. When the request includes anthropic-beta: files-api-2025-04-14, the route uses Anthropic Files API mode for the bound workspace.
Inputs: file_id (required), anthropic-beta.
edit_imageEdit imageB
Edits an image using multipart image uploads, JSON image URLs, or the official JSON images array for supported GPT Image models.
Inputs: model (required), prompt (required), n, mask, +16 more.
edit_image_fileEdit imageC
Edits an image using multipart image uploads, JSON image URLs, or the official JSON images array for supported GPT Image models.
Inputs: model (required), prompt (required), n, mask, +15 more.
evaluate_decisionsEvaluate decision questionsA
Evaluate typed Noul probability, Choice, and Score questions against shared state using the native System One endpoint. Discover a decision model with list_models/get_model first. Returns synchronous structured decisions, not chat text. A decision does not authorize an external action.
Inputs: model (required), state (required), questions (required), X-TokenLab-Delivery-Policy.
get_api_overviewGet TokenLab API OverviewARead-onlyIdempotent
Fetch TokenLab's agent-readable API overview.
Inputs: no named parameters.
get_modelGet modelARead-onlyIdempotent
Retrieves current model details, including supported operations, request parameters, request endpoints, selector limits, and pricing when available. Non-chat integrations should read these current model-specific request details before creating a request.
Inputs: model (required).
get_model_pricingGet model pricingARead-onlyIdempotent
Retrieves pricing-only detail for one model. Use this endpoint for price explanation, not for non-chat request construction.
Inputs: model (required).
get_pricingList model pricingBRead-onlyIdempotent
Returns the public pricing surface for active models, with optional provider and tag filters.
Inputs: tag, provider.
get_task_statusGet async task statusARead-onlyIdempotent
Retrieves the status and result of an asynchronous generation task. Prefer the poll_url returned by the create response; /v1/tasks/{id} is the canonical fixed status endpoint for video, music, and 3D jobs.
Inputs: id (required).
list_filesList filesDRead-onlyIdempotent
List files
Inputs: after, limit, purpose, after_id, +3 more.
list_modelsList modelsARead-onlyIdempotent
Lists the currently available models. Use view=compact for model selection and view=full for the existing OpenAI-compatible discovery shape. Native API calls default to full; integrations may choose compact as their default. Non-chat recommendations are available through recommended_for.
Inputs: tag, view, category, provider, +1 more.
rerank_documentsRerank documentsC
Reranks documents by relevance to a query using semantic similarity.
Inputs: model (required), query (required), documents (required), top_n, +2 more.
retrieve_fileRetrieve fileDRead-onlyIdempotent
Retrieve file
Inputs: file_id (required), anthropic-beta.
retrieve_file_contentRetrieve file contentDRead-onlyIdempotent
Retrieve file content
Inputs: file_id (required).
transcribe_audioCreate transcriptionC
Transcribes audio into text (Speech-to-Text).
Inputs: file (required), model (required), prompt, language, +4 more.
translate_audioTranslate audioC
Transcribes audio and translates the result to English.
Inputs: file (required), model, prompt, temperature, +2 more.
translate_textTranslate textC
Translates text into a target language using the current translation request format.
Inputs: text (required), model (required), target_language (required), user, +3 more.
upload_fileUpload fileA
Uploads a TokenLab/OpenAI-compatible batch or image file. With anthropic-beta: files-api-2025-04-14, uploads an Anthropic Files resource without a purpose field and returns Anthropic file metadata.
Inputs: file (required), model, purpose, anthropic-beta.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 32 tools
Several tools are near-duplicates or have overlapping purposes: create_image and create_image_file both say 'Creates an image given a prompt,' and edit_image and edit_image_file share identical descriptions. Provider-specific response tools (create_chat_completion, create_anthropic_message, create_gemini_content, create_response) and model/pricing discovery tools (get_pricing, get_model_pricing, compare_models, list_models, get_model) force agents to guess which one fits a given request.
Every tool uses lowercase snake_case, and the names consistently follow a verb_noun pattern (create_, get_, list_, retrieve_, delete_, cancel_, edit_, compare_, etc.). There are no mixed conventions such as camelCase or vague standalone verbs.
32 tools is above the typical well-scoped range and crosses the 'too many' threshold. The broad TokenLab platform explains some breadth, but redundant image/file aliases and multiple provider-specific generation tools inflate the surface beyond what an agent can easily navigate.
The surface covers a wide AI platform: chat completions, embeddings, image generation/editing, speech, transcription, translation, video, music, 3D, files, models, pricing, async task status, and decision evaluation. Minor gaps exist, notably cancel_task only supports queued Seedance video tasks and there are no update operations for file/model resources, but core workflows are broadly covered.
Maintenance
Related MCP Connectors
Public, read-only MCP server for FarmNeural company facts, packages, and capabilities.
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Public read-only discovery of agent, model, training, task, and verification opportunities.
Related MCP Servers
- AlicenseAqualityBmaintenanceRead-only MCP server for the RareCloud API, enabling AI agents to list servers, browse the catalog, check billing, and plan deployments.100376 npmMIT

gliana-mcp-remoteofficial
AlicenseNot gradedqualityCmaintenanceHosted MCP server for browsing the GlianaAI model catalog with zero setup, providing model listings, pricing, and schema information via Streamable HTTP.MIT- AlicenseNot gradedqualityBmaintenanceRead-only MCP server that answers questions about turva.dev from its published data. Five tools return JSON: the service catalog with prices, contact and operator details, engagement principles and dated agent-readiness and security evidence with verification links. Connect over Streamable HTTP. You need no API key. The server does not scan other websites or run audits.MIT
- AlicenseNot gradedqualityDmaintenanceMCP server exposing TaskMarket's public, read-only discovery tools so agents can browse and inspect funded onchain tasks on Base without a wallet.MIT