-
Notifications
You must be signed in to change notification settings - Fork 2.4k
How do I connect to GitHub MCP Server from a Node.js client when running the server in Docker? #554
-
Hi!
I want to use the GitHub MCP Server together with a Node.js application that uses the MCP client from @modelcontextprotocol/sdk. My setup is as follows:
The MCP server is running in a Docker container, started like this:
docker run -it --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=... -e GITHUB_TOOLSETS=all -p 3002:3000 ghcr.io/github/github-mcp-server
I want to connect to this server from Node.js, as in the example below (from my server.js):
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
const MCP_SERVER_URL = 'http://localhost:3002/mcp';
let mcpClient;
let mcpTransport;
async function getMcpClient() {
if (mcpClient) return mcpClient;
mcpTransport = new StreamableHTTPClientTransport(new URL(MCP_SERVER_URL));
mcpClient = new Client({
name: 'mock-egde-ai-client',
version: '1.0.0'
});
await mcpClient.connect(mcpTransport);
return mcpClient;
}
Problem
When I start the Docker container, I only see the message GitHub MCP Server running on stdio in the logs, and none of the MCP tools are available from the client.
It seems like the MCP server is only listening on stdio, not HTTP, so the client cannot connect.
Questions
How do I start the GitHub MCP Server in Docker so that it listens on HTTP (e.g., on port 3000), so I can connect using StreamableHTTPClientTransport from Node.js?
Are there any specific flags or environment variables I need to use to enable HTTP mode in Docker?
Is there an example of the correct Docker command and client setup for this scenario?
Any help or examples would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Hello 👋 ,
currently only the remote version supports http.
The local version will not work.
Regards, Tony
Beta Was this translation helpful? Give feedback.