This MCP Server provides a standardized interface for AI models to interact with development environments through the Model Context Protocol. It enables simplified model deployment and consistent I/O through a FastAPI-based implementation supporting JSON-RPC 2.0 and Server-Sent Events for real-time communication.
To set up the MCP server on your system:
git clone https://github.com/freedanfan/mcp_server.git
cd mcp_server
pip install -r requirements.txt
Start the MCP server with the default configuration:
python mcp_server.py
The server will run on 127.0.0.1:12000
by default.
You can customize the host and port using environment variables:
export MCP_SERVER_HOST=0.0.0.0
export MCP_SERVER_PORT=8000
python mcp_server.py
The package includes a test client to verify server functionality:
python mcp_client.py
If your server is running on a non-default address, specify it with:
export MCP_SERVER_URL="http://your-server-address:port"
python mcp_client.py
The MCP server exposes the following endpoints:
To interact with an AI model, send a sample request:
{
"jsonrpc": "2.0",
"id": "request-id",
"method": "sample",
"params": {
"prompt": "Hello, please introduce yourself."
}
}
The server will respond with:
{
"jsonrpc": "2.0",
"id": "request-id",
"result": {
"content": "This is a response to the prompt...",
"usage": {
"prompt_tokens": 10,
"completion_tokens": 50,
"total_tokens": 60
}
}
}
To gracefully close your session:
{
"jsonrpc": "2.0",
"id": "request-id",
"method": "shutdown",
"params": {}
}
The server will acknowledge:
{
"jsonrpc": "2.0",
"id": "request-id",
"result": {
"status": "shutting_down"
}
}
For more detailed logging:
export PYTHONPATH=.
python -m logging -v DEBUG -m mcp_server
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.