MCP server endpoint configuration

I have an endpoint implemented in Rust at http://mcpserver.com/01423badbeef which can respond to JSON over HTTP. Basically 01423badbeef is the address of a module that can respond to requests. I have the following MCP configuration via Cursor:

{
  "mcpServers": {
    "my-contract": {
      "url": "http://mcpserver.com/01423badbeef",
      "toolsEndpoint": "/tools",
      "executeEndpoint": "/execute",
      "env": {
        "API_KEY": "your-api-key-if-needed"
      }
    }
  }
}

I get an error stating Failure to connect to client. However curl works. How do I go about debugging this?

Thanks in advance.

Hi, your mcp configuration does not match the actual SSE MCP config. have a look here:

Following can not be part of the config

"toolsEndpoint": "/tools",
"executeEndpoint": "/execute",

if you remove that and have the MCP server programmed correctly it should work.

Use Anthropics MCP Inspector to see if your own MCP works.

Thanks for the response. I ran it with the MCP Inspector and I get the following response:

SSE transport: url=http://192.168.64.3:8000/000000020b62ec840081b99d0a1a54803cbb5c7712802675ef18d02eb8640959c330d7f5/sse, headers=Accept
Error in browser-inspector connection: SseError: SSE error: undefined
at _eventSource.onerror (file:///Users/avinash/.npm/_npx/7e8ad8cccb174862/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:69:31)
at EventSource.scheduleReconnect_fn (file:///Users/avinash/.npm/_npx/7e8ad8cccb174862/node_modules/eventsource/dist/index.js:248:53)
at file:///Users/avinash/.npm/_npx/7e8ad8cccb174862/node_modules/eventsource/dist/index.js:95:219
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
code: undefined,
event: {
type: ‘error’,
message: undefined,
code: undefined,
defaultPrevented: false,
cancelable: false,
timeStamp: 26263.268708
}
}

If I issue a curl request to the same URL I get the following:

HTTP/1.1 200 OK
content-type: text/event-stream
cache-control: no-cache
connection: keep-alive
vary: origin, access-control-request-method, access-control-request-headers
access-control-allow-origin: *
content-length: 522
date: Sat, 05 Apr 2025 23:18:11 GMT

data: [{“function”:{“description”:“Generated function for foo”,“name”:“foo”,“parameters”:{“properties”:{“x”:{“description”:“Parameter x of type i32”,“type”:“i32”},“y”:{“description”:“Parameter y of type i32”,“type”:“i32”}},“required”:[“x”,“y”],“type”:“object”}},“type”:“function”},{“function”:{“description”:“Generated function for update”,“name”:“update”,“parameters”:{“properties”:{“x”:{“description”:“Parameter x of type String”,“type”:“String”}},“required”:[“x”],“type”:“object”}},“type”:“function”}]

Is the format of the response JSON incorrect? How do I go about debugging this? Thanks in advance.

Hi, curl is good to see what happens on a server call, but as its not visible which parameters you used with curl to call the request, its hard to do a 1:1 comparison.

However since you are making the MCP server, dump the request details (headers and body) of of MCP Inspector because that tells you what a valid MCP request is.

Next you can compare with any MCP demo server made by anthropic and visible on the modelcontextprotocol website/github account. they show exactly the schema and you will be able to see what input and output is sent, even if it is not in the same language you are using.

There is a specific order of requests that MCP relies on for discovery and communication of actual agent requests.

Have a look in the MCP github for issues and other parts. plus you can ask AI any time with the specific error and ask it to search online, its not the first time this happens to someone. You dont even have to let it change your code but analyze code and issue cause.