Skip to content

Modularize MCP server by implementing tool definitions, stateless req…#7598

Open
cstns wants to merge 2 commits into
7426_mcp-scaffoldingfrom
7429_mcp-endpoint-handler
Open

Modularize MCP server by implementing tool definitions, stateless req…#7598
cstns wants to merge 2 commits into
7426_mcp-scaffoldingfrom
7429_mcp-endpoint-handler

Conversation

@cstns

@cstns cstns commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Fills in the MCP server route shell from #7426 with the actual endpoint handler. External AI agents can now connect to POST /api/v1/mcp and get real MCP protocol responses.

  • Stateless Streamable HTTP: fresh McpServer and transport per request, no sessions, cleanup after each request
  • Auth token forwarded to existing routes via app.inject(), so all middleware, validation, and RBAC runs as-is
  • Tool registration framework that auto-discovers tool files from a tools/ directory
  • Stub scope check ready for scoped PATs (Add PAT (Personal Acces Tokens) scopes #7411)
  • Ships with two team tools (list-teams, get-team) to prove the plumbing end-to-end
  • formatResponse helper converts inject responses to MCP CallToolResult, including error propagation
  • Polyfill for socket.destroySoon to handle Fastify's mock sockets in test/inject path

Builds on #7426. Tool definitions for the remaining domains (applications, instances, snapshots, devices, catalog, navigation) are tracked in #7430.

Related Issue(s)

closes #7429

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@cstns cstns self-assigned this Jun 23, 2026
@cstns cstns linked an issue Jun 23, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.11321% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.03%. Comparing base (6b598c8) to head (12c443d).

Files with missing lines Patch % Lines
forge/ee/routes/mcp/toolLoader.js 96.29% 1 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           7426_mcp-scaffolding    #7598      +/-   ##
========================================================
+ Coverage                 76.97%   77.03%   +0.05%     
========================================================
  Files                       412      414       +2     
  Lines                     21101    21153      +52     
  Branches                   5141     5145       +4     
========================================================
+ Hits                      16243    16295      +52     
  Misses                     4858     4858              
Flag Coverage Δ
backend 77.03% <98.11%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

MCP Endpoint Handler

1 participant