akoskm
1
Hi everyone!
I’m using the Quickstart example from the modelcontextprotol typescript repo and trying to add this simple MCP into Cursor.
This example uses the StdioServerTransport, which is supported by Cursor.
The problem is that when I add the configuration either to .cursor/mcp.json
or the global cursor config file like this:
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["-y", "dist/index.js"]
}
}
}
I get the Client closed message on the UI.
When I try to run this using the inspector, either with:
npx @modelcontextprotocol/inspector bun src/index.ts
or
npx @modelcontextprotocol/inspector bun src/index.ts
I can list and use the tool without any issue:
I’m sure I’m missing something simple, but I don’t see what exactly.
Here’s the repository GitHub - akoskm/mcp-server-stdio
Thanks for your help.
Akos
Siage
2
Looks like you cloned the project and built it locally, so you shouldn’t be using npx
here. Instead, you should run the built file directly with node
.
Try updating your config like this:
{
"mcpServers": {
"docker": {
"command": "node",
"args": ["your/mcp/dist/index.js"]
}
}
}
npx
only works for packages that are published on npm. If your MCP server isn’t published yet, npx
won’t be able to find and run it.
akoskm
3
Thanks Siage,
This didn’t work.
I don’t recall if I have tried this but I definitelly did bun
instead of node
. I tried this with the full path to the node executable as well:
I restarted Cursor as well, but no change.
Siage
4
The dist/index.js
file needs to use the absolute path, which means you should specify the directory where you clone MCP project.
akoskm
5
I wasn’t aware that you need the absolute path to the executable, so I probably missed it in the docs.
The good news is, it even works with bun, so I don’t need the compilation step:
Thank you so much, Siage!
akoskm
6
FYI to everyone reading this in the future, you don’t need the absolute path.
I was missing the .
in front of src/index.ts
. It works with the relative paths as well (just make sure they are truly relative
):