Polybrain MCP Server
Enables AI agents to interact with OpenAI's language models through their API, supporting conversation history, model switching, and extended reasoning capabilities for compatible models.
Click on "Install 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., "@Polybrain MCP Serverask GPT-4o to explain quantum computing basics"
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.
Polybrain MCP Server
An MCP (Model Context Protocol) server for connecting AI agents to multiple LLM models. Supports conversation history, model switching, and seamless Claude Code integration.
Features
Multi-model support (OpenAI, OpenRouter, custom endpoints)
Conversation history management
Switch models mid-conversation
Extended thinking/reasoning support (configurable by provider)
Pure MCP protocol (silent by default)
Automatic server management
Related MCP server: LLM Bridge MCP
Installation
npm install -g polybrain
# or
pnpm add -g polybrainQuick Setup
1. Configure Models
Option A: YAML (recommended)
Create ~/.polybrain.yaml:
models:
- id: "gpt-4o"
modelName: "gpt-4o"
baseUrl: "https://api.openai.com/v1"
apiKey: "${OPENAI_API_KEY}"
provider: "openai"
- id: "gpt-5.1"
modelName: "openai/gpt-5.1"
baseUrl: "https://openrouter.io/api/v1"
apiKey: "${OPENROUTER_KEY}"
provider: "openrouter"Set env vars:
export OPENAI_API_KEY="sk-..."
export OPENROUTER_KEY="sk-or-..."Option B: Environment variables
export POLYBRAIN_BASE_URL="https://api.openai.com/v1"
export POLYBRAIN_API_KEY="sk-..."
export POLYBRAIN_MODEL_NAME="gpt-4o"2. Coding Agent Integration
Claude Code
Run the following command to add Polybrain to Claude Code:
claude mcp add -s user -t stdio polybrain -- polybrainOpenAI Codex
Open ~/.codex/config.toml and add:
[mcpServers.polybrain]
command = "polybrain"Usage
You can now ask your coding agent to consult specific models. For example:
"Ask deepseek what's the best way to install python on mac"
Or:
"What models are available from polybrain?"
Configuration Reference
Environment Variables
POLYBRAIN_BASE_URL- LLM API base URLPOLYBRAIN_API_KEY- API keyPOLYBRAIN_MODEL_NAME- Model namePOLYBRAIN_HTTP_PORT- Server port (default: 32701)POLYBRAIN_LOG_LEVEL- Log level (default: info)POLYBRAIN_DEBUG- Enable debug logging to stderrPOLYBRAIN_CONFIG_PATH- Custom config file path
YAML Config Fields
httpPort: 32701 # Optional
truncateLimit: 500 # Optional
logLevel: info # Optional
models: # Required
- id: "model-id" # Internal ID
modelName: "actual-model-name" # API model name
baseUrl: "https://api.url/v1" # API endpoint
apiKey: "key or ${ENV_VAR}" # API key
provider: "openai" # Optional: provider type for reasoning supportSupported Providers
The provider field enables provider-specific features like extended thinking/reasoning. If not specified, reasoning parameters will not be passed to the API (safe default).
Provider | Reasoning Support | Valid Values |
OpenAI | YES |
|
OpenRouter | VARIES |
|
Examples:
Use
provider: "openai"for OpenAI API models (GPT-4, o-series)Use
provider: "openrouter"for OpenRouter proxy service (supports 400+ models)Omit
providerfield if your endpoint doesn't support reasoning parameters
Example with reasoning:
models:
- id: "gpt-o1"
modelName: "o1"
baseUrl: "https://api.openai.com/v1"
apiKey: "${OPENAI_API_KEY}"
provider: "openai" # Enables reasoning support
- id: "gpt-5.1"
modelName: "openai/gpt-5.1"
baseUrl: "https://openrouter.io/api/v1"
apiKey: "${OPENROUTER_KEY}"
provider: "openrouter" # Enables reasoning supportTo use reasoning, set reasoning: true in the chat tool call. If the model and provider support it, you'll receive both the response and reasoning content.
Development
Setup
pnpm installBuild
pnpm buildLint & Format
pnpm lint
pnpm formatType Check
pnpm type-checkDevelopment Mode
pnpm devProject Structure
src/
├── bin/polybrain.ts # CLI entry point
├── launcher.ts # Server launcher & management
├── http-server.ts # HTTP server
├── index.ts # Main server logic
├── mcp-tools.ts # MCP tool definitions
├── conversation-manager.ts
├── openai-client.ts
├── config.ts
├── logger.ts
└── types.tsDebugging
Enable debug logs to stderr:
{
"mcpServers": {
"polybrain": {
"command": "polybrain",
"env": {
"POLYBRAIN_DEBUG": "true"
}
}
}
}Restart Server
After changing configuration in ~/.polybrain.yaml, restart the HTTP backend server:
polybrain --restartThis kills the background HTTP server. The next time you use polybrain, it will automatically start a fresh server with the updated configuration.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceFacilitates enhanced interaction with large language models (LLMs) by providing intelligent context management, tool integration, and multi-provider AI model coordination for efficient AI-driven workflows.MIT
- AlicenseBqualityCmaintenanceEnables AI agents to interact with multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek) through a standardized interface, making it easy to switch between models or use multiple models in the same application.16MIT
- AlicenseCqualityFmaintenanceAn AI router that connects applications to multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek, Ollama, etc.) with smart model orchestration capabilities, enabling dynamic switching between models for different reasoning tasks.31737MIT
- AlicenseAqualityAmaintenanceEnables MCP clients like Claude Code and Cursor to use multiple AI models (Gemini, GPT, Grok, DeepSeek, Kimi, Ollama) via a unified chat tool with conversation memory.3Apache 2.0
Related MCP Connectors
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Create and manage AI agents that collaborate and solve problems through natural language interacti…
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/danielwpz/polybrain-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server