This server implements the Model Context Protocol (MCP), a standardized API for interacting with large language models. It provides a unified abstraction layer that supports multiple model providers under a consistent interface, making it easier to switch between models without changing your application code.
Clone the repository and build the server:
git clone https://github.com/model-protocol/mcp-server.git
cd mcp-server
go build -o mcp-server
You can also run the server using Docker:
docker run -p 8080:8080 -v /path/to/config.yaml:/config.yaml ghcr.io/model-protocol/mcp-server:latest
Create a configuration file config.yaml
with your model provider credentials:
listen_addr: ":8080"
providers:
openai:
api_key: "sk-..."
models:
- name: "gpt-4"
provider_model_id: "gpt-4"
- name: "gpt-3.5-turbo"
provider_model_id: "gpt-3.5-turbo"
anthropic:
api_key: "sk-ant-..."
models:
- name: "claude-3-opus"
provider_model_id: "claude-3-opus-20240229"
- name: "claude-3-sonnet"
provider_model_id: "claude-3-sonnet-20240229"
listen_addr
: The address and port the server will listen onproviders
: Configuration for each model provider
name
(how clients will refer to it) and a provider_model_id
(the ID used by the provider)Start the server by specifying your configuration file:
./mcp-server -config config.yaml
With Docker:
docker run -p 8080:8080 -v /path/to/config.yaml:/config.yaml ghcr.io/model-protocol/mcp-server:latest
To get a list of available models:
curl http://localhost:8080/models
The response will include all configured models:
{
"models": [
{
"id": "gpt-4",
"provider": "openai"
},
{
"id": "claude-3-opus",
"provider": "anthropic"
}
]
}
To generate a chat completion:
curl -X POST http://localhost:8080/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you?"}
],
"temperature": 0.7
}'
To stream the response in real-time:
curl -X POST http://localhost:8080/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a short poem."}
],
"stream": true
}'
To use a different model, simply change the model
parameter in your request:
curl -X POST http://localhost:8080/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "claude-3-opus",
"messages": [
{"role": "user", "content": "Explain quantum computing in simple terms."}
]
}'
listen_addr
is correctly configuredTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-server" '{"command":"npx","args":["-y","mcp-server"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-server": {
"command": "npx",
"args": [
"-y",
"mcp-server"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-server": {
"command": "npx",
"args": [
"-y",
"mcp-server"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect