What Could Be Causing a 500 Error on the Tools/List Endpoint in the MCP Server During Notion Integration Testing?

This topic was automatically generated from Slack. You can find the original thread here.

hi!

Inquiry Regarding 500 Error on tools/list Endpoint in MCP Server
Hello,
I am currently testing the Notion integration feature with the remote MCP server using Python.
The project creation, connection, and Notion linking have all been completed successfully.
However, I am consistently receiving a 500 error when calling the tools/list endpoint as shown below.

Reproduction Code (Summary)

# python

def list_notion_tools(external_user_id: str):
    token = get_access_token()
    url   = f"
https://remote.mcp.pipedream.net/{external_user_id}/notion"
    headers   = {
        "Authorization":         f"Bearer {token}",
        "x-pd-project-id":       PROJECT_ID,
        "x-pd-environment":      ENVIRONMENT,
        "x-pd-external-user-id": external_user_id,
        "x-pd-app-slug":         "notion",
        "Accept": "text/event-stream"
    }
    # Get endpoint and session_id via SSE connection
    with requests.get(url, headers=headers, stream=True) as r:
        for ev in sseclient.SSEClient(r).events():
            if ev.event == "endpoint":
                endpoint = "https://remote.mcp.pipedream.net" + ev.data
                session_id = ev.data.split("?sessionId=")[-1]
                break
    # Call tools/list
    rpc_hdr = {****headers, "Mcp-Session-Id": session_id, "Content-Type": "application/json"}
    rpc_hdr.pop("Accept")
    rpc_body = {"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}
    res = [requests.post](http://requests.post)(endpoint, headers=rpc_hdr, json=rpc_body, timeout=30)
    res.raise_for_status()
    return res.json()["result"]["tools"]

Error

requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://remote.mcp.pipedream.net/v1/*************************/notion/messages?sessionId=f8b13124-653d-49d8-b049-311eb6aba42c

Questions

  1. Could you please check the possible cause(s) for the 500 error occurring on the tools/list endpoint call?
  2. Is there anything wrong with the header values or the way the call is made?
  3. The Notion integration itself has been completed successfully.

First, try without /{external_user_id}/notion since you are passing that in through the header.

Then, if this doesn’t work, test it with the path (/{external_user_id}/notion), but without all the headers. (This won’t use your Pipedream Connect account, but I’d like to see if thats the issue)