Running Non-Docker MCP Servers in Cursor: A Simple Workaround
Are you struggling to add MCP servers to Cursor that can only be run with npx
? I recently faced this exact challenge and found a simple yet effective solution using mcp-proxy
.
The Problem
While Cursor’s MCP (Model Control Protocol) works great with Docker-based servers, I encountered difficulties integrating servers that can only be run with npx
. Despite being able to run these servers perfectly from the terminal, they wouldn’t connect properly through Cursor’s interface.
The Solution: MCP Proxy
The workaround is surprisingly simple - use mcp-proxy
to bridge the gap between Cursor and your npx-based MCP servers.
GitHub Repository: https://github.com/sparfenyuk/mcp-proxy
Step-by-Step Guide
1. Install uv (Fast Python Package Installer)
If you don’t already have uv
installed, start by installing it:
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Install mcp-proxy with uv
Use uv
to install the MCP proxy package:
uv tool install mcp-proxy
3. Run the proxy in your terminal
Launch the proxy with the following command, replacing “mcp-server-kubernetes” with whatever server you need to run:
mcp-proxy --sse-port 7070 --pass-environment npx -- mcp-server-kubernetes
This command:
- Sets up an SSE (Server-Sent Events) endpoint on port 7070
- Passes your environment variables to the server
- Runs your npx-based MCP server through the proxy
4. Configure Cursor to use the proxy
- Open Cursor Settings
- Navigate to the MCP section
- Add a new SSE MCP server with the URL:
http://localhost:7070/sse
5. Enjoy your newly connected MCP server!
You should now be able to use all the features of your npx-based MCP server directly within Cursor.
Why This Works
The mcp-proxy
acts as a translation layer between Cursor’s expected communication format and your npx-based server. By routing the communication through the proxy’s SSE endpoint, Cursor can seamlessly interact with servers that would otherwise be incompatible.
This approach works for any MCP server that you can run from the command line but can’t directly integrate with Cursor.