Skip to content

fix: default Docker image to stdio transport (closes #33, #35)#47

Open
MatthewJamisonJS wants to merge 2 commits intoref-tools:mainfrom
MatthewJamisonJS:fix/docker-mcp-gateway-stdio-default
Open

fix: default Docker image to stdio transport (closes #33, #35)#47
MatthewJamisonJS wants to merge 2 commits intoref-tools:mainfrom
MatthewJamisonJS:fix/docker-mcp-gateway-stdio-default

Conversation

@MatthewJamisonJS
Copy link
Copy Markdown

@MatthewJamisonJS MatthewJamisonJS commented May 6, 2026

Problem

Dockerfile:28 hardcodes ENV TRANSPORT=http, forcing every container to start an HTTP server on port 8080. This breaks:

Fix

Remove the line. index.ts:40 already defaults to stdio when TRANSPORT is unset:

const TRANSPORT_TYPE = (process.env.TRANSPORT || 'stdio') as 'stdio' | 'http'
 RUN chmod +x dist/index.cjs

-# Set HTTP transport mode by default
-ENV TRANSPORT=http
-
 EXPOSE 8080
 ENTRYPOINT ["node", "dist/index.cjs"]

HTTP mode still available via -e TRANSPORT=http.

Validation

$ env -u TRANSPORT REF_API_KEY=test node dist/index.cjs
Ref MCP Server running on stdio

$ TRANSPORT=http PORT=8081 REF_API_KEY=test node dist/index.cjs
Ref MCP Server running on HTTP at http://localhost:8081/mcp

npm run check passes.

Smithery

smithery.yaml declares startCommand.type: http. Smithery's own migrate_stdio_to_http cookbook ships a Dockerfile that does not set TRANSPORT and still deploys successfully — so Smithery injects it (or routes HTTP) at the platform level, and the Dockerfile ENV is redundant for that path.

Happy to do a Smithery test deploy of this branch before merging if you'd prefer empirical confirmation over the cookbook precedent.

Backwards compatibility

  • docker run -e TRANSPORT=http -p 8080:8080 … unchanged.
  • Smithery deployment unchanged (platform sets the env).
  • New default unblocks stdio clients (Docker MCP Gateway, Gemini CLI, Cursor stdio).

Closes #33
Closes #35

The Dockerfile hardcoded TRANSPORT=http, which broke Docker MCP
Gateway and Gemini CLI clients that spawn containers over stdio.
The TypeScript already defaults TRANSPORT to stdio when unset
(index.ts:40), so removing the ENV line restores the correct
default for stdio clients.

HTTP mode is still available via -e TRANSPORT=http for Smithery
and any user who explicitly wants HTTP.

Closes ref-tools#33
Closes ref-tools#35
Companion to the Dockerfile change in the previous commit. Removing
the hardcoded ENV TRANSPORT=http from the Dockerfile would have
caused Smithery deployments to fall back to stdio (matching index.ts
defaults), breaking the existing https://smithery.ai/server/@ref-tools
deploy.

Smithery's project-config supports a top-level `env:` map that the
platform applies at container runtime (see blockscout/mcp-server
smithery.yaml for an existing precedent). Declaring TRANSPORT=http
here keeps Smithery in HTTP mode while letting the image default to
stdio for every other Docker consumer.

Refs ref-tools#33, ref-tools#35
@MatthewJamisonJS
Copy link
Copy Markdown
Author

MatthewJamisonJS commented May 6, 2026

Quick update — pushed a87623d adding an env: block to smithery.yaml.

Was poking around how other runtime: container projects handle this and ran into blockscout/mcp-server's smithery.yaml:

env:
  BLOCKSCOUT_MCP_TRANSPORT: "http"

Their inline note — "Use environment variables to configure the container at runtime" — plus the project-config schema showing env: as a top-level field, suggested the cleanest path was declaring TRANSPORT: "http" there instead of in the Dockerfile. That way Smithery still gets HTTP, and the image defaults to stdio for everyone else.

If a different shape would fit your setup better, totally happy to revise — just wanted to surface what I found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker image doesn't work with Docker MCP Gateway (TRANSPORT=http hardcoded) Issue with gemini

1 participant