Skip to content

[Bug] cforge run not working #23

@gabe-l-hart

Description

@gabe-l-hart

Describe the bug

With the latest version of the upstream project, the cforge run command is no longer working.

Sample Code

# Terminal 1 (run the server)
rm tmp/*; CONTEXTFORGE_HOME=$PWD/tmp cforge serve --port 5555 --no-auth

# Terminal 2 (run and register mcp-server)
PORT=5555 CFORGE_HOME=$PWD/tmp cforge run --stdio "docker run -it --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PUBLIC_READ_ONLY_TOKEN ghcr.io/github/github-mcp-server" --temporary --port 9005

Expected behavior

The MCP server should boot and auto-register itself with ContextForge, then unregister when quit.

Observed behavior

Registration fails with a 500 that I believe is coming from CF trying to invoke the MCP server:

error in cforge serve

2026-02-12T12:05:59 - mcp.client.sse - ERROR - Error in post_writer
Traceback (most recent call last):
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/mcp/client/sse.py", line 147, in post_writer
    response.raise_for_status()
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/httpx/_models.py", line 829, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'http://localhost:9005/message?session_id=9b94d60e421a4129855a767fc0b0fde4'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500

error in cforge run

logs
INFO:     127.0.0.1:49295 - "POST /message?session_id=9b94d60e421a4129855a767fc0b0fde4 HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 416, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/fastapi/applications.py", line 1135, in __call__
    await super().__call__(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/applications.py", line 107, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/routing.py", line 716, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/routing.py", line 736, in app
    await route.handle(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/routing.py", line 290, in handle
    await self.app(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/fastapi/routing.py", line 115, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/fastapi/routing.py", line 101, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/fastapi/routing.py", line 355, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/fastapi/routing.py", line 243, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/mcpgateway/translate.py", line 1960, in post_message
    await stdio.send(payload.decode().rstrip() + "\n")
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/site-packages/mcpgateway/translate.py", line 521, in send
    await self._stdin.drain()
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/asyncio/streams.py", line 392, in drain
    await self._protocol._drain_helper()
  File "/Users/ghart/miniforge3/envs/contextforge-cli/lib/python3.11/asyncio/streams.py", line 166, in _drain_helper
    raise ConnectionResetError('Connection lost')
ConnectionResetError: Connection lost

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions