Skip to content

feat(framework): add first-class mcpServers field to AgentInvocation#409

Merged
jafreck merged 1 commit intomainfrom
forward-mcp-extensions
Mar 22, 2026
Merged

feat(framework): add first-class mcpServers field to AgentInvocation#409
jafreck merged 1 commit intomainfrom
forward-mcp-extensions

Conversation

@jafreck
Copy link
Copy Markdown
Owner

@jafreck jafreck commented Mar 22, 2026

Summary

Replace the untyped extensions bag with a typed mcpServers field on AgentInvocation. Both CopilotBackend and ClaudeBackend now iterate mcpServers and emit the appropriate CLI flags (--additional-mcp-config / --mcp-config).

Changes

packages/framework/src/runtime/context/types.ts

  • AgentInvocation: replaced extensions?: Record<string, unknown> with mcpServers?: Record<string, { url: string }> — typed, explicit, self-documenting
  • AgentResult: removed unused extensions field

packages/framework/src/runtime/launch-with-events.ts

  • InvocationMetric: removed unused extensions field

packages/framework/src/runtime/backend/backend.ts

  • CopilotBackend.invoke(): iterates invocation.mcpServers and pushes --additional-mcp-config per server
  • ClaudeBackend.invoke(): iterates invocation.mcpServers and pushes --mcp-config per server (with type: 'url' wrapper)

Motivation

The extensions field was a speculative untyped escape hatch (Record<string, unknown>) that was never set or read by any code — not by cadre itself, not by any consumer. Making MCP server forwarding a first-class typed field:

  • Provides autocomplete and compile-time checking for consumers
  • Eliminates blind as casts in the backends
  • Keeps the framework free of consumer-specific concepts (no AAMF references)

Replace the untyped extensions bag with a typed mcpServers field on
AgentInvocation. Both CopilotBackend and ClaudeBackend now iterate
mcpServers and emit the appropriate CLI flags
(--additional-mcp-config / --mcp-config).

Remove unused extensions fields from AgentResult and InvocationMetric.
@jafreck jafreck merged commit faeaae1 into main Mar 22, 2026
2 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 22, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.32%. Comparing base (49b752b) to head (6d4bbc8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/framework/src/runtime/backend/backend.ts 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #409      +/-   ##
==========================================
- Coverage   91.36%   91.32%   -0.04%     
==========================================
  Files         213      213              
  Lines       22862    22872      +10     
  Branches     3583     3585       +2     
==========================================
  Hits        20887    20887              
- Misses       1927     1937      +10     
  Partials       48       48              

☔ View full report in Codecov by Sentry.
📢 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.

1 participant