Skip to content

Implement remote upstream MCP transport and session lifecycle #213

Description

@davidruzicka

Summary

Implement a remote upstream MCP client for streamable HTTP and bind it to downstream MCP sessions managed by mcp4openapi.

Why

Proxy mode needs a real upstream client/session layer. Local request handling alone is not enough once tool discovery and tool execution come from a remote MCP server.

Deliverables

  • Create a per-session upstream connection manager for remote MCP providers.
  • Initialize the upstream session during downstream initialize handling.
  • Reuse or adapt the current HTTP transport/session lifecycle so upstream sessions are cleaned up deterministically when downstream sessions end.
  • Proxy downstream requests such as tools/list and tools/call to the upstream provider where appropriate.
  • Add bounded timeouts and degraded failure handling for unavailable upstream servers.

Acceptance criteria

  • A configured remote upstream MCP server can be initialized through mcp4openapi.
  • Session creation and cleanup are deterministic and covered by tests.
  • Tool requests are forwarded upstream with structured error mapping for timeout/auth/unavailable cases.
  • The first iteration works without stdio support.

Suggested files

  • src/mcp/mcp-server.ts
  • src/transport/http-transport.ts
  • src/core/errors.ts
  • new provider/client modules under src/

Agent-authored issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureSeparation-of-concerns, dependency, or boundary design improvementenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions