Skip to content

MCP Endpoint and Transport #7427

@cstns

Description

@cstns

Summary

Implement the MCP server route handler inside the shell created by #7426. This makes the endpoint functional and testable end-to-end with any MCP client, even before tools are registered.

Requirements

Route handler

  • Implement the POST /api/v1/mcp handler in forge/ee/routes/mcpServer/index.js
  • Per-request McpServer + StreamableHTTPServerTransport instantiation
  • Hijack the raw Node.js request/response from Fastify (JSON-RPC protocol requires direct control over the response)
  • Reject non-POST methods with 405

Authentication

  • verifySession is already applied globally to all EE routes, PAT Bearer token auth comes for free
  • Reject non-user tokens (project, device, team, broker tokens should not be able to use the MCP endpoint)

MCP protocol basics

  • Handle initialize handshake
  • Respond to tools/list with an empty tool list
  • Endpoint should be fully functional for MCP client connections, just with no tools registered yet

Tests

  • Unauthenticated requests rejected
  • Non-user tokens rejected (project/device tokens)
  • MCP initialize handshake completes successfully
  • tools/list returns empty array
  • GET/DELETE return 405

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions