MCP & IDE Integration¶
The liter-llm MCP server exposes 22 tools for unified access to 143 runtime LLM providers, embeddings, files, batches, and more. Integrate it with VS Code, GitHub Copilot, Claude Desktop, Cursor, and other MCP-compatible IDEs and applications.
What is MCP?¶
The Model Context Protocol (MCP) is an open standard for connecting AI applications to context sources. The liter-llm MCP server provides tools that allow AI assistants to call LLM APIs, generate embeddings, search documents, and manage files — all through a unified, provider-agnostic interface.
Instead of hard-coding integrations for each provider (OpenAI, Anthropic, Google, Groq, etc.), MCP lets your IDE or application call any of the 143 runtime providers via a single interface.
Available MCP Tools¶
The liter-llm MCP server exposes 22 tools for core LLM operations:
Virtual keys can use the model-routed tools. File, batch, and response-management tools require a master key because they manage provider-side resources outside a single model route.
| Tool | Description |
|---|---|
chat |
Send a chat completion request to any LLM provider |
embed |
Generate text embeddings from configured embedding models |
list_models |
List available models from all configured providers |
generate_image |
Generate images from a text prompt (DALL-E, Flux, etc.) |
speech |
Generate speech audio from text (text-to-speech) |
transcribe |
Transcribe audio to text (speech-to-text) |
moderate |
Check content against moderation policies |
rerank |
Rerank documents by relevance to a query |
search |
Perform web or document search |
ocr |
Extract text from an image or document via OCR |
create_file |
Upload a file to the LLM provider |
list_files |
List uploaded files from the provider |
retrieve_file |
Retrieve metadata for an uploaded file |
delete_file |
Delete an uploaded file |
file_content |
Retrieve the raw content of an uploaded file |
create_batch |
Create a new batch processing job |
list_batches |
List batch processing jobs |
retrieve_batch |
Retrieve a batch processing job by ID |
cancel_batch |
Cancel an in-progress batch job |
create_response |
Create a new response (Responses API) |
retrieve_response |
Retrieve a response by ID (Responses API) |
cancel_response |
Cancel an in-progress response |
Prerequisites¶
- liter-llm CLI installed (see Installation)
- API keys set up for the providers you want to use (e.g.,
OPENAI_API_KEY,ANTHROPIC_API_KEY) - Optional: Custom
liter-llm-proxy.tomlconfig file
Starting the MCP Server¶
Stdio Transport (IDE Integration)¶
For IDE integration (VS Code, GitHub Copilot, Claude Desktop, Cursor), use the stdio transport:
This is the standard way to integrate MCP servers into IDEs. The server communicates via stdin/stdout and is configured in the IDE's MCP settings. The proxy config must include [mcp] stdio_key_id = "..." or [mcp] stdio_trust_local = true.
HTTP Transport (Remote/Custom)¶
For remote connections or custom integrations:
The HTTP server will be available at http://127.0.0.1:3001/mcp. Every request must include Authorization: Bearer <master-or-virtual-key>.
Custom Configuration¶
Use a custom proxy config file to define models, virtual keys, MCP stdio auth context, and provider credentials:
Configuration is identical to the proxy server — see Proxy Configuration for full details.
IDE Setup¶
VS Code supports MCP servers natively. See the VS Code MCP documentation for setup details.
Manual Installation (without extension):
Edit your VS Code settings (.vscode/settings.json or global settings) to register the liter-llm MCP server:
{
"mcpServers": [
{
"name": "liter-llm",
"command": "liter-llm",
"args": ["mcp", "--transport", "stdio", "--config", "/absolute/path/to/liter-llm-proxy.toml"],
"env": {
"OPENAI_API_KEY": "sk-...",
"ANTHROPIC_API_KEY": "sk-ant-...",
"GROQ_API_KEY": "gsk_..."
}
}
]
}
Then use the tools in GitHub Copilot's chat by typing @llm-tools or explicitly referencing tools like @chat or @embed.
Claude Desktop and Claude Code use the MCP client to load external tools. Configure liter-llm in ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"liter-llm": {
"command": "liter-llm",
"args": ["mcp", "--transport", "stdio", "--config", "/absolute/path/to/liter-llm-proxy.toml"],
"env": {
"OPENAI_API_KEY": "sk-...",
"ANTHROPIC_API_KEY": "sk-ant-...",
"GROQ_API_KEY": "gsk_..."
}
}
}
}
After saving, restart Claude Desktop. The liter-llm tools will be available in the Tools panel and can be invoked directly in Claude conversations.
Cursor supports MCP servers through its .cursor/settings.json or global Cursor settings.
Manual Configuration:
Edit your Cursor settings (⌘, → "Cursor Settings" → "MCP Servers") or directly edit the config file:
{
"mcpServers": [
{
"name": "liter-llm",
"command": "liter-llm",
"args": ["mcp", "--transport", "stdio", "--config", "/absolute/path/to/liter-llm-proxy.toml"],
"env": {
"OPENAI_API_KEY": "sk-...",
"ANTHROPIC_API_KEY": "sk-ant-...",
"GROQ_API_KEY": "gsk_..."
}
}
]
}
Use tools via Cursor's AI chat or code generation features.
For custom applications or tools that support HTTP-based MCP, use the HTTP transport:
Then register the server in your application:
{
"mcpServers": [
{
"name": "liter-llm",
"url": "http://127.0.0.1:3001/mcp",
"headers": {
"Authorization": "Bearer ${LITER_LLM_MASTER_KEY}"
}
}
]
}
Refer to your application's MCP client documentation for configuration details.
Configuration¶
Environment Variables¶
The MCP server reads API keys and provider configuration from environment variables, identical to the main liter-llm client:
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GOOGLE_API_KEY="..."
export GROQ_API_KEY="gsk_..."
export MISTRAL_API_KEY="..."
export REPLICATE_API_KEY="..."
Provider-specific keys
You only need to set keys for providers you plan to use. If you only use OpenAI, set OPENAI_API_KEY and liter-llm will automatically route requests to OpenAI based on the model prefix (e.g., openai/gpt-4o).
Custom Config File¶
To override defaults, base URLs, or provider configuration, use a custom proxy TOML file:
Example liter-llm-proxy.toml:
[general]
master_key = "${LITER_LLM_MASTER_KEY}"
[mcp]
stdio_trust_local = true
[[models]]
name = "gpt-4o"
provider_model = "openai/gpt-4o"
api_key = "${OPENAI_API_KEY}"
[[models]]
name = "ollama-qwen"
provider_model = "ollama/qwen2.5"
base_url = "http://localhost:11434/v1"
Use stdio_key_id instead of stdio_trust_local when you want stdio tools to run with a virtual key's model allowlist, RPM/TPM limits, and budget.
See Proxy Configuration for all available options.
Master Key (Optional)¶
For remote HTTP transport, set a master key or configure virtual keys to authenticate requests:
export LITER_LLM_MASTER_KEY="your-secure-key"
liter-llm mcp --transport http --host 0.0.0.0 --port 3001
Clients must include the key in the Authorization header:
curl http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secure-key" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Tool Examples¶
Using the chat Tool¶
In Claude, ask a question and it will use the chat tool:
curl -X POST http://127.0.0.1:3001/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LITER_LLM_MASTER_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "chat",
"arguments": {
"model": "gpt-4o",
"messages": [{"role": "user", "content": "What is 2+2?"}]
}
}
}'
Using the embed Tool¶
Generate embeddings for semantic search:
{
"model": "openai/text-embedding-3-small",
"input": "The quick brown fox jumps over the lazy dog"
}
Using the list_models Tool¶
List all available models from configured providers:
Returns a list of models with metadata (e.g., openai/gpt-4o, anthropic/claude-opus, groq/llama3-70b).
Troubleshooting¶
MCP Server Not Starting¶
Error: command not found: liter-llm
Ensure the CLI is installed and in your PATH:
If not found, reinstall:
IDE Not Seeing Tools¶
VS Code / GitHub Copilot:
- Restart VS Code completely (close and reopen)
- Check the "Extension" → "MCP" debug output for errors
- Verify the command path in
settings.jsonis correct
Claude Desktop:
- Restart Claude Desktop
- Check
~/Library/Logs/Claude/for error logs - Verify the config file is valid JSON
Cursor:
- Use ⌘+K → "MCP Servers" to reload
- Check the Cursor settings panel for errors
API Key Not Found¶
Error: authentication failed: api key not set
Ensure API keys are set as environment variables before starting the MCP server:
Or hardcode them in the IDE config (less secure):
Never commit API keys
Use environment variables or a .env file (not committed to git). See Secrets and API Key Handling for best practices.
Timeout Errors¶
Error: request timeout after 30s
Increase the timeout in a config file:
Then start with the config:
Port Already in Use (HTTP)¶
Error: bind failed: address already in use
Use a different port:
Or kill the existing process:
Remote Connection Refused¶
Error: connection refused: 127.0.0.1:3001
Ensure the MCP server is running and listening on the correct host/port:
# Start the server
liter-llm mcp --transport http --host 0.0.0.0 --port 3001 &
# Test the connection
curl http://127.0.0.1:3001/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LITER_LLM_MASTER_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Note
Use 0.0.0.0 to allow remote connections. For local development, 127.0.0.1 is safer.
Next Steps¶
- Chat & Streaming — Learn the chat API and streaming patterns
- Provider Registry — Browse all 143 runtime providers
- Configuration — Timeouts, retries, and custom endpoints