Skip to content

Add MCP App tool approval allowlist and sandbox framing - #17176

Open
cidrblock wants to merge 1 commit into
LibreChat-AI:devfrom
cidrblock:feat/mcp-app-tool-approval
Open

cidrblock wants to merge 1 commit into
LibreChat-AI:devfrom
cidrblock:feat/mcp-app-tool-approval

Conversation

@cidrblock

Copy link
Copy Markdown

Summary

  • Add an optional exact {server, tool} allowlist for MCP App-originated tool calls. Omitted or empty configuration keeps the existing approval prompt; App-authored messages remain approval-gated, and Agent tool approval behavior is unchanged.
  • Allow the sandbox document to be framed by explicitly trusted cross-origin ancestors by removing inherited X-Frame-Options only when the generated CSP permits those ancestors; retain the frameguard otherwise.

Verification

  • packages/api/src/mcp/apps/controller.spec.ts: 28 tests passed.
  • Client MCP approval and policy-context suites: 26 tests passed.
  • packages/data-provider/src/config.spec.ts: passed.

This PR is limited to MCP Apps host approval and sandbox framing; provider/model access policy is in a separate PR.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new publication-test fixture uses an incompatible allowlist format and fails TypeScript checking.

1 open finding
What changed in this PR

Adds configurable approval bypasses for trusted MCP App tools and supports sandbox framing by explicitly trusted cross-origin ancestors.

Changes:

  • Publishes and validates exact server/tool allowlists while preserving default approval behavior.
  • Applies allowlists to App tool calls, not App-authored messages.
  • Removes inherited frameguard only when sandbox headers permit cross-origin framing.
File Description
packages/​data-provider/​src/​config.ts Defines and publishes approval policy.
packages/​data-provider/​src/​config.spec.ts Tests policy validation and publication.
packages/​api/​src/​mcp/​apps/​controller.ts Removes conflicting inherited frameguard.
packages/​api/​src/​mcp/​apps/​controller.spec.ts Tests sandbox framing headers.
docs/​mcp-apps.md Documents allowlist configuration and boundaries.
client/​src/​Providers/​MCPAppsPolicyContext.tsx Validates published approval policy.
client/​src/​Providers/​__tests__/​MCPAppsPolicyContext.spec.tsx Tests valid and malformed policies.
client/​src/​hooks/​MCP/​approval.tsx Auto-approves exact allowlisted tool calls.
client/​src/​hooks/​MCP/​__tests__/​approval.spec.tsx Tests matching and retained approval safeguards.
client/​src/​components/​MCPUIResource/​MCPAppViews.tsx Supplies policy to approval handling.
api/​server/​routes/​config.js Exposes approval policy in startup configuration.
api/​server/​routes/​__tests__/​config.spec.js Tests startup policy publication.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/data-provider/src/config.spec.ts Outdated
@codegraph-librechat codegraph-librechat Bot added the 🗺️ MCP & OAuth codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 15, 2026
@cidrblock
cidrblock force-pushed the feat/mcp-app-tool-approval branch from 6de7fb2 to 7df468d Compare October 15, 2026 20:39
@cidrblock
cidrblock force-pushed the feat/mcp-app-tool-approval branch from 7df468d to 08b3f2d Compare October 15, 2026 20:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ MCP & OAuth codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants