styx-mcp-server — Claude Code MCP server: route AI requests via Styx
This MCP server wires your client to a self-hosted Styx gateway, which spreads requests across Anthropic, Anthropic, Google and Mistral.
claude mcp add --env STYX_API_KEY=<STYX_API_KEY> --env STYX_TOKEN=<STYX_TOKEN> --env STYX_API_URL=<STYX_API_URL> --env STYX_PROXY_URL=<STYX_PROXY_URL> --transport stdio styx-mcp-server -- npx -y styx-mcp-serverWhat styx-mcp-server does
Nine tools come with it. styx_send_request pushes a prompt through the gateway, styx_list_models returns the models with their pricing, and styx_switch_model pins a default. The rest cover account work: listing and creating projects, listing and creating API keys, checking usage and cost, and managing BYOK provider keys through styx_manage_providers.
You need Node.js 18+ and Python 3.10+ with mcp[cli], httpx and pydantic installed. Point the server at your backend with STYX_API_URL (default http://localhost:8000) and at the proxy with STYX_PROXY_URL (default http://localhost:8080). STYX_API_KEY is what styx_send_request authenticates with; STYX_TOKEN covers project and key management. Set both before you start, otherwise half the tools stay dark.
SSE is available too: npx styx-mcp-server --sse listens on port 8090. Apache-2.0.
What it helps with
- send a prompt through the Styx gateway without switching clients
- check which models are available and what they cost
- pin a default model for later requests
- create a project and issue an API key for it
- review usage and spending across requests
Example prompts for the agent
- List the models with pricing using styx_list_models
- Route this prompt through the gateway and give me the answer
- Create a project and issue an API key for it
How to install styx-mcp-server
Platform CLI
claude mcp add --env STYX_API_KEY=<STYX_API_KEY> --env STYX_TOKEN=<STYX_TOKEN> --env STYX_API_URL=<STYX_API_URL> --env STYX_PROXY_URL=<STYX_PROXY_URL> --transport stdio styx-mcp-server -- npx -y styx-mcp-serverReplace <…> with your own values
Platform CLI
codex mcp add styx-mcp-server --env STYX_API_KEY=<STYX_API_KEY> --env STYX_TOKEN=<STYX_TOKEN> --env STYX_API_URL=<STYX_API_URL> --env STYX_PROXY_URL=<STYX_PROXY_URL> -- npx -y styx-mcp-serverReplace <…> with your own values
Config file
{
"mcpServers": {
"styx-mcp-server": {
"command": "npx",
"args": [
"-y",
"styx-mcp-server"
],
"env": {
"STYX_API_KEY": "<STYX_API_KEY>",
"STYX_TOKEN": "<STYX_TOKEN>",
"STYX_API_URL": "<STYX_API_URL>",
"STYX_PROXY_URL": "<STYX_PROXY_URL>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"styx-mcp-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"styx-mcp-server"
],
"env": {
"STYX_API_KEY": "<STYX_API_KEY>",
"STYX_TOKEN": "<STYX_TOKEN>",
"STYX_API_URL": "<STYX_API_URL>",
"STYX_PROXY_URL": "<STYX_PROXY_URL>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e STYX_API_KEY=<STYX_API_KEY> -e STYX_TOKEN=<STYX_TOKEN> -e STYX_API_URL=<STYX_API_URL> -e STYX_PROXY_URL=<STYX_PROXY_URL> styx-mcp-server npx -y styx-mcp-serverReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about styx-mcp-server
How do I install styx-mcp-server in Claude Code?
Run claude mcp add styx-mcp-server -e STYX_API_KEY=<STYX_API_KEY> -e STYX_TOKEN=<STYX_TOKEN> -- npx -y styx-mcp-server. The other form also passes the URLs: `claude mcp add --env STYX_API_KEY=<STYX_API_KEY> --env STYX_TOKEN=<STYX_TOKEN> --env STYX_API_URL=<STYX_API_URL> --env STYX_PROXY_URL=<STYX_PROXY_URL> --transport stdio styx-mcp-server -- npx -y styx-mcp-server`.
What does styx-mcp-server do?
It links an MCP client to your Styx instance and exposes tools for routing requests, picking models, handling projects and keys, and reading usage stats.
Which environment variables does it need?
STYX_API_URL and STYX_PROXY_URL set the backend and proxy addresses, STYX_API_KEY authorises request sending, and STYX_TOKEN is used for project and key management.