pythongithub-copilotmodel-context-protocol

Can't connect local FastMCP to copilot


Hello I have developed a MCP server in python

mcp= FastMCP("mymcp", dependecies=["dotenv"],
             stateless_http=True, host="127.0.0.1", port=8000)

#tools

if __name__ == "__main__":
    mcp.run(transport="streamable-http")

Then I've setted the mcp.json for my github copilot

{
    "servers": {
        "mymcp": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "http://127.0.0.1:8000/mcp"
            ]
        }
    }
}

I run my server with: uv run mymcp.py And I can connect trough inspector (mcp dev mymcp.py) (I will deploy my server into a docker on a private cluster, so I want to connect trough http)

Do you know what is the issue? last week it worked :(

PS i get this error in copilotlogs:

2025-06-05 10:22:43,691 [ 7186] WARN - #copilot - [CopilotMCP] Error initializing MCP server mymcp: TypeError: The "path" argument must be of type string. Received undefined at Object.normalize (node:path:338:5) at parseNonShell (C:\snapshot\copilot-client\node_modules\cross-spawn\lib\parse.js:49:31) at parse (C:\snapshot\copilot-client\node_modules\cross-spawn\lib\parse.js:88:37) at spawn (C:\snapshot\copilot-client\node_modules\cross-spawn\index.js:9:20) at C:\snapshot\copilot-client\node_modules@modelcontextprotocol\sdk\src\client\stdio.ts:120:23 at new Promise () at Hz.start (C:\snapshot\copilot-client\node_modules@modelcontextprotocol\sdk\src\client\stdio.ts:119:12) at qz.connect (C:\snapshot\copilot-client\node_modules@modelcontextprotocol\sdk\src\shared\protocol.ts:302:27) at qz.connect (C:\snapshot\copilot-client\node_modules@modelcontextprotocol\sdk\src\client\index.ts:128:17) at jz.connect (C:\snapshot\copilot-client\lib\src\mcp\mcpStdioServer.ts:33:28) {
code: 'ERR_INVALID_ARG_TYPE' }


Solution

  • No need for using mcp-remote. You can specify directly the URL like this:

    {
        "servers": {
            "mymcp": {
                "url": "http://127.0.0.1:8000/mcp"
            }
        }
    }
    

    If you're using Github Copilot with Visual Studio Code, the documentation offers more details.