Skip to content

feat(agent): add MCP server support - #627

Merged
AnthonyRonning merged 3 commits into
masterfrom
codex-maple-agent-mcp-mvp-maple
Jul 14, 2026
Merged

feat(agent): add MCP server support#627
AnthonyRonning merged 3 commits into
masterfrom
codex-maple-agent-mcp-mvp-maple

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Goose-style MCP server management to Agent Mode for STDIO and Streamable HTTP.
  • Persist account-scoped definitions and freeze selected server configuration per session, with validation, masked values, defaults, search, and live toggles.
  • Preserve agent usability on connection failures with actionable errors and automatic session-count refresh.
  • Document the MVP scope, authentication and persistence boundaries, local fixtures, and follow-ups.

Validation

  • Real Maple GUI: add, edit, delete, and discard flows; STDIO and HTTP echo tools; live toggles; restart persistence; offline HTTP recovery while the built-in agent remains usable.
  • Independent backend, frontend, and integration reviews; all clean after validated fixes.
  • nix develop -c just build
  • nix develop -c just lint (0 errors; 12 existing warnings)
  • nix develop -c bun test (96 passed)
  • nix develop -c cargo test --manifest-path frontend/src-tauri/Cargo.toml (110 passed)
  • nix develop -c just rust-lint
  • git diff --check

Deferred

  • Legacy HTTP+SSE, OAuth management, curated or built-in MCPs, health and reconnect UX, and protocol-version changes.

Open in Devin Review

Summary by CodeRabbit

  • New Features
    • Added MCP server support to Agent Mode with both STDIO and Streamable HTTP connections.
    • Added UI and backend controls to manage MCP servers globally and enable them per session/chat.
    • Session detail now surfaces MCP connection failures, shown as concise, actionable user messages (sanitized to avoid technical transport details).
    • Added per-session server selection when creating new chats, with safeguards against reserved server changes during active runs.
  • Documentation
    • Added a new guide for Agent Mode MCP integration, including security boundaries, limits, and an MVP behavior overview.
  • Tests
    • Added test coverage for MCP error sanitization/classification and MCP selection/validation rules.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: e1697c1
Status: ✅  Deploy successful!
Preview URL: https://c5b7dde8.maple-ca8.pages.dev
Branch Preview URL: https://codex-maple-agent-mcp-mvp-ma.maple-ca8.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6789a91c-4f05-47c5-b23b-29ae2ead5d03

📥 Commits

Reviewing files that changed from the base of the PR and between 93138b4 and e1697c1.

⛔ Files ignored due to path filters (1)
  • frontend/src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • frontend/src-tauri/Cargo.toml
📝 Walkthrough

Walkthrough

Adds Agent Mode MCP support across persisted configuration, Goose session setup, Tauri commands, frontend runtime services, connection-error handling, management dialogs, per-session toggles, and documentation for supported transports and MVP behavior.

Changes

Agent Mode MCP integration

Layer / File(s) Summary
MCP contracts and persisted configuration
docs/agent-mode-mcp.md, frontend/src-tauri/src/agent.rs, frontend/src-tauri/src/lib.rs
Defines MCP server models, persisted configuration, config loading, global and session command registration, and documented transport and validation rules.
MCP validation and Goose mapping
frontend/src-tauri/src/agent.rs
Normalizes and validates names, timeouts, commands, environment variables, headers, reserved names, duplicates, and transport-specific fields before mapping servers to Goose extensions.
Runtime and session MCP lifecycle
frontend/src-tauri/src/agent.rs
Selects MCP servers for sessions, attaches extensions, records connection errors, supports session-level enablement, and emits MCP error events without aborting prompts.
Frontend runtime API and error handling
frontend/src/services/agentRuntimeService.ts, frontend/src/services/agentMcpErrors.ts, frontend/src/services/agentMcpErrors.test.ts
Adds typed MCP service operations and converts connection failures into concise user-facing messages with structured and runtime error coverage.
Agent Mode MCP management UI
frontend/src/components/AgentMode.tsx, frontend/src/components/agent/AgentMcpControls.tsx, frontend/src/services/agentMcpServers.ts, frontend/src/services/agentMcpServers.test.ts
Adds MCP loading, selection, session synchronization, searchable toggles, configuration forms, persistence, validation, deletion flows, and connection-error presentation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AgentMode
  participant TauriAgent
  participant Goose
  User->>AgentMode: Select MCP servers and create session
  AgentMode->>TauriAgent: Create session with mcpServerNames
  TauriAgent->>Goose: Attach selected MCP extensions
  Goose-->>TauriAgent: Return extension load results
  TauriAgent-->>AgentMode: Return session detail with mcpErrors
  AgentMode-->>User: Show session and sanitized connection errors
Loading

Possibly related PRs

  • OpenSecretCloud/Maple#620: Refactors the MCP-based developer client and threads session-scoped tool permissions through the related execution path.

Poem

A rabbit configures tools with care,
STDIO and HTTP hop through the air.
Toggles bloom, errors turn clear,
MCP carrots persist year by year.
The burrow connects with a cheerful ear!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding MCP server support to Agent Mode.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex-maple-agent-mcp-mvp-maple

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Review-bot triage for 93138b4:

  • Fixed and validated: exact Goose name/timeout validation, pending new-chat MCP selection reconciliation, MCP-only restore-failure classification, bounded connection-error events, and the requested error-branch coverage.
  • The secret-field note was a false positive: the shared environment/header value input is type="password", and the UI explicitly discloses account-local/session-snapshot persistence.
  • I did not apply the suggested runtime_lifecycle quick fix. Simply dropping the guard around Goose MCP initialization can race logout/stop/clear and allow stale managers, session writes, or old-account events after cleanup. A safe follow-up needs bounded/cancellable MCP initialization or setup tracked by the lifecycle operation fence.
  • I left the current error event schema intact; the shared frontend predicate and backend short-format contract are now directly covered by tests.

Local validation is green: production build, typecheck/lint/Clippy, 104 frontend tests, and 112 Rust tests. Three independent review passes found no remaining blocker.

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Goose follow-up for e1697c11:

  • Updated the exact Goose pin from b7eb1e973 to 3c1fdd692 to pick up upstream empty-turn recovery (fix(agent): retry empty provider turns instead of stopping silently aaif-goose/goose#10360). Empty or thinking-only provider turns now retry up to three times and persistent emptiness becomes a visible assistant fallback instead of ending silently.
  • Audited the complete intervening range. It contains only two other commits: Responses replayed function-call name sanitization (safe, mostly inert for Maple's current Chat Completions path) and an x86 llama.cpp CPU guard (not compiled because Maple enables no Goose local-inference feature).
  • No Maple API/config migration or additional feature flag was required. The lockfile changed only the six Goose workspace source hashes.

Validation:

  • Exact upstream Goose empty-turn suite: 6/6 passed; Responses sanitizer regression: 1/1 passed.
  • Maple Rust suite: 112/112 passed; locked check, fmt/Clippy, frontend lint, production build, and pre-commit suite passed.
  • Real desktop GUI with public Microsoft Learn Streamable HTTP MCP: tool call succeeded; disabling it mid-chat removed the tool and produced a normal response; re-enabling it restored tool execution. No silent stop.
  • Three independent reviews approved the pin-only diff. CodeRabbit and Devin completed on this head with no new actionable finding.

Tradeoff: a pathological empty provider response can now cost up to four total calls (initial + three retries), without backoff. That is the deliberate upstream behavior. Responses proxy/tool-name completion and serializing send against an in-flight MCP toggle remain separate follow-ups, not requirements for this fix.

@AnthonyRonning
AnthonyRonning merged commit 014470e into master Jul 14, 2026
18 checks passed
@AnthonyRonning
AnthonyRonning deleted the codex-maple-agent-mcp-mvp-maple branch July 14, 2026 21:25
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