Skip to content

Python FastMCP server (STDIO) exits immediately on Windows — Not connected #26128

Closed as not planned

Description

@cioffiAI

Bug Description

A Python FastMCP server (mcp.server.fastmcp.FastMCP) exits immediately (~1 second after startup) when launched by opencode as a local MCP server via STDIO transport, returning "Not connected" on every tool call. The same server works perfectly when tested manually via subprocess with JSON-RPC over stdin/stdout.

Steps to Reproduce

  1. Create a Python FastMCP server (mcp==1.27.0)
  2. Install as a CLI tool (uv tool install .) or run directly
  3. Configure in opencode.jsonc as local MCP server
  4. Start opencode — first tool call works, then all subsequent tool calls return "Not connected"
  5. Server logs show: startup messages followed by immediate exit with no errors

Manual Test (PASSES — server works correctly)

The same server, when tested manually via subprocess, passes all MCP protocol operations:

  • initialize → protocolVersion: 2024-11-05
  • tools/list → all tools returned
  • tools/call → all tool calls succeed
  • Process stays alive indefinitely when stdin/stdout are properly piped

Environment

  • OpenCode version: current dev
  • OS: Windows 11 (PowerShell 5.1)
  • Python: 3.13
  • MCP SDK: 1.27.0 (mcp.server.fastmcp)
  • Server transport: STDIO

Additional Context

Key Finding

The Python MCP server process is being killed by opencode shortly after startup, before it can properly initialize the STDIO transport. The server never gets a chance to respond to the initialize handshake.

Activity

  1. github-actions commented on May 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is the same, please consider adding any additional details as a comment on those existing issues rather than opening a new one.

  2. github-actions commented on Jul 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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