Home / MCP / any-chat-completions-mcp MCP Server
Provides an MCP server that relays chat queries to multiple AI providers via a unified chat completions API.
Configuration
View docs{
"mcpServers": {
"chat_openai": {
"command": "npx",
"args": [
"-y",
"@pyroprompts/any-chat-completions-mcp"
],
"env": {
"AI_CHAT_KEY": "OPENAI_KEY",
"AI_CHAT_NAME": "OpenAI",
"AI_CHAT_MODEL": "gpt-4o",
"AI_CHAT_BASE_URL": "https://api.openai.com/v1"
}
}
}
}You set up this MCP server to route chat prompts from any OpenAI‑SDK compatible API to multiple AI providers (OpenAI, PyroPrompts, Perplexity, and others) using a single, unified chat completion interface. This enables you to swap providers or run multiple providers in parallel without changing your client integrations.
Start by configuring MCP entries for each provider you want to use. Each entry runs as a local, stdio MCP server that you connect to from your client. You can have a single provider or multiple providers, and you can switch between them by selecting the corresponding MCP server in your client configuration. All providers appear as separate tools within your chat environment, so you can address each one by name and route questions accordingly.
Prerequisites: you need Node.js and npm installed on your system.
Install dependencies and build the server if you are using a local clone. Run the following in your terminal where the project resides.
npm installnpm run buildTo develop with auto-rebuild, you can use the watch script during development.
npm run watchConfigure your client to load the MCP entries that point to the local stdio servers described below.
You can run multiple providers by creating separate MCP server entries. Each entry uses stdio and points to the built index of the MCP server, with environment variables identifying the provider.
{
"mcpServers": {
"chat-openai": {
"command": "npx",
"args": [
"-y",
"@pyroprompts/any-chat-completions-mcp"
],
"env": {
"AI_CHAT_KEY": "OPENAI_KEY",
"AI_CHAT_NAME": "OpenAI",
"AI_CHAT_MODEL": "gpt-4o",
"AI_CHAT_BASE_URL": "https://api.openai.com/v1"
}
},
"chat-pyroprompts": {
"command": "node",
"args": [
"/path/to/any-chat-completions-mcp/build/index.js"
],
"env": {
"AI_CHAT_KEY": "PYROPROMPTS_KEY",
"AI_CHAT_NAME": "PyroPrompts",
"AI_CHAT_MODEL": "ash",
"AI_CHAT_BASE_URL": "https://api.pyroprompts.com/openaiv1"
}
},
"chat-perplexity": {
"command": "node",
"args": [
"/path/to/any-chat-completions-mcp/build/index.js"
],
"env": {
"AI_CHAT_KEY": "PERPLEXITY_KEY",
"AI_CHAT_NAME": "Perplexity",
"AI_CHAT_MODEL": "sonar",
"AI_CHAT_BASE_URL": "https://api.perplexity.ai"
}
}
}
}Keep API keys and base URLs secure. Do not expose keys in client configurations or public repositories. Use environment isolation where possible and rotate keys periodically.
Each provider’s configuration is isolated by its own MCP entry. If you need to disable a provider, remove or comment out the corresponding MCP server entry and restart the client.
MCP servers communicate over stdio, which can be tricky to debug. If you need debugging tools, run the inspector to access debugging utilities in your browser or terminal.
npm run inspectorRelays a user question to a configured AI chat provider and returns the provider’s response, enabling multi-provider chat through a single interface.