This server implements the Model Context Protocol (MCP), enabling connections to different ML services through a unified interface. It provides simple API access to various models including those from Anthropic, OpenAI, Cohere, Google, Mistral, and others while abstracting away their specific implementation details.
uv
package manageruv venv
source .venv/bin/activate
uv pip install mcp-server
pip install mcp-server
Create a .env
file in your project directory with the necessary API keys:
# OpenAI
OPENAI_API_KEY=your_openai_key_here
# Anthropic
ANTHROPIC_API_KEY=your_anthropic_key_here
# Google
GOOGLE_API_KEY=your_google_key_here
# Mistral
MISTRAL_API_KEY=your_mistral_key_here
Start the server with the default configuration:
mcp-server
Specify a custom port:
mcp-server --port 8001
You can also configure the server using environment variables:
MCP_SERVER_PORT=8001 mcp-server
Send requests to the server using standard HTTP methods:
curl -X POST http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-3-opus",
"messages": [
{"role": "user", "content": "Hello, how are you?"}
]
}'
The server supports multiple model providers:
anthropic/claude-3-opus
, anthropic/claude-3-sonnet
, anthropic/claude-3-haiku
openai/gpt-4
, openai/gpt-4-turbo
, openai/gpt-3.5-turbo
google/gemini-pro
, google/gemini-1.5-pro
mistral/mistral-small
, mistral/mistral-medium
, mistral/mistral-large
Requests should follow this general structure:
{
"model": "provider/model-name",
"messages": [
{"role": "system", "content": "Optional system message"},
{"role": "user", "content": "User message here"}
],
"temperature": 0.7,
"max_tokens": 1000
}
Create a config.json
file to set model-specific defaults:
{
"models": {
"anthropic/claude-3-opus": {
"temperature": 0.5,
"max_tokens": 2000
}
}
}
Then start the server with:
mcp-server --config config.json
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.