This repository hosts a server implementation of the Model Context Protocol (MCP), a communication protocol designed for efficiently managing and interacting with AI language models. The MCP server provides an interface for requesting model-based completions and managing contexts across different applications.
To install the MCP server, follow these steps:
Clone the repository:
git clone https://github.com/rusiaaman/wcgw.git
cd wcgw
Install the package using pip:
pip install -e .
Create a configuration file named config.json
with your preferred settings:
{
"port": 8080,
"host": "127.0.0.1",
"model_providers": [
{
"type": "openai",
"api_key": "your-openai-api-key"
}
]
}
Start the MCP server using the following command:
mcp-server --config config.json
By default, the server will listen on port 8080. You can override this in the command:
mcp-server --port 9000 --config config.json
You can interact with the MCP server using HTTP requests:
curl -X POST http://localhost:8080/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you?"}
]
}'
Create a new context:
curl -X POST http://localhost:8080/v1/contexts \
-H "Content-Type: application/json" \
-d '{
"name": "my-context",
"model": "gpt-3.5-turbo"
}'
Add messages to a context:
curl -X POST http://localhost:8080/v1/contexts/my-context/messages \
-H "Content-Type: application/json" \
-d '{
"role": "user",
"content": "What is the capital of France?"
}'
Get a completion from a context:
curl -X POST http://localhost:8080/v1/contexts/my-context/completions \
-H "Content-Type: application/json" \
-d '{}'
For more detailed error diagnostics, check the server logs which are printed to the console by default.
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.