What is MCP?
The Model Context Protocol (MCP) is an open standard developed by Anthropic for connecting AI assistants with external tools and services. It provides a standardized way for AI applications like Claude Desktop, Cursor, and other MCP-compatible clients to communicate with external servers that provide additional capabilities.
With MCP, you can extend Claude's capabilities by connecting it to databases, APIs, file systems, and specialized tools. The Plexor Labs MCP server exposes prompt optimization and multi-provider routing tools that help you save tokens and reduce costs while maintaining response quality.
How Plexor Labs MCP Server Works
The Plexor Labs MCP server runs as a subprocess spawned by Claude Desktop. It communicates via JSON-RPC over stdin/stdout, following the MCP specification. When you invoke a Plexor Labs tool in Claude Desktop, the request is sent to the local MCP server which processes it and returns the result.
The server provides five primary tools:
- Prompt Optimization - Compress prompts for reduced token usage while preserving meaning
- Prompt Analysis - Analyze prompts to understand optimization potential
- Statistics Tracking - Monitor your token savings across sessions
- Provider Routing - Route prompts to optimal CLI providers (Claude Code, Codex)
- Provider Listing - View available providers and their health metrics
Prerequisites
Before setting up the Plexor Labs MCP server, ensure you have:
- Python 3.11+ installed on your system
- uv package manager (recommended) or pip
- Claude Desktop application installed
- A Plexor Labs API key from your API Keys page
Installing uv (Recommended)
We recommend using uv for faster package installation. Install it with:
curl -LsSf https://astral.sh/uv/install.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Installation
Install the Plexor Labs package which includes the MCP server:
uv pip install plexor
pip install plexor
After installation, verify the MCP server is available:
which plexor-mcp # Should output the path to plexor-mcp
Claude Desktop Configuration
To connect Plexor Labs to Claude Desktop, you need to add it to your MCP server configuration file.
Locate Your Configuration File
The Claude Desktop configuration file is located at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/claude-desktop/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the Plexor Labs MCP Server
Open the configuration file and add the Plexor Labs server to the mcpServers section:
Restart Claude Desktop
Completely quit and restart Claude Desktop for the new configuration to take effect. The Plexor Labs tools will now be available in your conversations.
Configuration Using uv (Recommended)
Using uv ensures the correct Python environment is used:
{
"mcpServers": {
"plexor": {
"command": "uv",
"args": [
"run",
"--with",
"plexor",
"plexor-mcp"
],
"env": {
"PLEXOR_API_KEY": "YOUR_API_KEY",
"PLEXOR_BASE_URL": "https://api.plexor.dev"
}
}
}
}
Configuration Using Direct Path
Alternatively, use the direct path to the plexor-mcp executable:
{
"mcpServers": {
"plexor": {
"command": "/path/to/plexor-mcp",
"args": [],
"env": {
"PLEXOR_API_KEY": "YOUR_API_KEY",
"PLEXOR_BASE_URL": "https://api.plexor.dev"
}
}
}
}
YOUR_API_KEY with your actual Plexor Labs API key from the
API Keys page. Never commit API keys to version control.
Environment Variables
The Plexor Labs MCP server supports the following environment variables for configuration:
| Variable | Required | Default | Description |
|---|---|---|---|
PLEXOR_API_KEY |
Required | - | Your Plexor Labs API key for authentication |
PLEXOR_BASE_URL |
Optional | https://api.plexor.dev |
Base URL for the Plexor Labs API. Change for self-hosted deployments. |
PLEXOR_MODE |
Optional | balanced |
Default routing mode: eco, balanced, quality, passthrough |
PLEXOR_PROVIDER |
Optional | auto |
Force specific provider: auto, anthropic, openai, deepseek |
PLEXOR_LOG_LEVEL |
Optional | INFO |
Logging level: DEBUG, INFO, WARNING, ERROR |
Available MCP Tools
Once configured, the Plexor Labs MCP server exposes five tools to Claude Desktop:
auto, code_generation, code_review, analysis, general
conservative, moderate, aggressive
session or all_time (default: session)
auto, code_generation, code_review, analysis, research, summarization, email_draft, general
none, claude-code, codex
Verification
After configuration, verify that the Plexor Labs MCP server is working correctly:
Check Claude Desktop Logs
Open Claude Desktop's developer console or check the logs for MCP server initialization messages.
Look for: plexor_mcp_starting and stdio_streams_connected
Verify Tool Availability
In Claude Desktop, ask: "What MCP tools do you have available from Plexor Labs?" Claude should list the five Plexor Labs tools: optimize_prompt, analyze_prompt, get_optimization_stats, route_prompt, and list_providers.
Test Tool Execution
Ask Claude to analyze a sample prompt using the Plexor Labs tools: "Use the Plexor Labs analyze_prompt tool to check this prompt: 'Please help me write a function'"
Example Usage in Claude Desktop
# You can ask Claude to use Plexor Labs tools: User: Use the Plexor Labs optimize_prompt tool to optimize this prompt: "I would really appreciate it if you could please help me to write a Python function that calculates the factorial of a number" Claude: I'll optimize that prompt using Plexor Labs. [Calls optimize_prompt tool] The optimized prompt is: "Write Python factorial function" Results: - Original tokens: 32 - Optimized tokens: 5 - Reduction: 84.4% - Tokens saved: 27
Troubleshooting
MCP Server Not Starting
plexor-mcp
is correct. Run which plexor-mcp in your terminal and use the full path in the config.
Authentication Errors
PLEXOR_API_KEY is correct. Check the API Keys page
to confirm the key is active. Ensure there are no extra spaces or quotes around the key value.
Tools Not Appearing
- Completely quit Claude Desktop (not just close the window)
- Verify JSON syntax in
claude_desktop_config.jsonis valid - Check that the file is saved in the correct location
- Restart Claude Desktop and check the developer console for errors
Common Fixes
- JSON Syntax Errors: Use a JSON validator to check your config file
- Path Issues on Windows: Use forward slashes or escaped backslashes in paths
- Python Version: Ensure Python 3.11+ is installed and in PATH
- Package Not Installed: Run
pip install --upgrade plexor
Debug Logging
Enable debug logging by setting the environment variable in your config:
{
"mcpServers": {
"plexor": {
"command": "uv",
"args": ["run", "--with", "plexor", "plexor-mcp"],
"env": {
"PLEXOR_API_KEY": "YOUR_API_KEY",
"PLEXOR_LOG_LEVEL": "DEBUG"
}
}
}
}
Advanced Configuration
Multiple MCP Servers
You can configure multiple MCP servers alongside Plexor Labs:
{
"mcpServers": {
"plexor": {
"command": "uv",
"args": ["run", "--with", "plexor", "plexor-mcp"],
"env": {
"PLEXOR_API_KEY": "YOUR_API_KEY"
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/files"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
}
}
}
}
Self-Hosted Plexor Labs
If you're running a self-hosted Plexor Labs instance, update the base URL:
{
"mcpServers": {
"plexor": {
"command": "plexor-mcp",
"args": [],
"env": {
"PLEXOR_API_KEY": "YOUR_API_KEY",
"PLEXOR_BASE_URL": "https://plexor.your-company.com"
}
}
}
}
Default Routing Mode
Set the default routing mode for all optimization and routing operations:
| Mode | Description | Best For |
|---|---|---|
eco |
Maximum cost savings, aggressive optimization | Simple queries, drafts, brainstorming |
balanced |
Balance between cost and quality (default) | General use, most applications |
quality |
Prioritize response quality, minimal optimization | Complex reasoning, production code |
passthrough |
No optimization, direct pass-through | Testing, benchmarks, comparison |
Alternative: HTTP API Integration
If MCP doesn't fit your use case, you can integrate Plexor Labs directly via the HTTP API. This is useful for:
- Server-side applications
- Custom integrations not using Claude Desktop
- Direct API access without MCP overhead
See the HTTP API documentation for complete details.