Repository navigation
Connect remote MCP servers and use their tools in chat - #102
Merged
Merged
Conversation
Add remote MCP servers in Settings → Integrations (Streamable HTTP, with no authentication, a bearer token, or OAuth sign-in) and choose which of their tools Talorys may use. Tools start off; an enabled tool asks for approval on every call unless the owner lets it run without asking. MCP tools go through the same validation, budgets and approvals as built-in tools and are never offered to scheduled runs. Credentials and OAuth sign-ins are encrypted with the new MCP_CREDENTIAL_KEY secret, which the installer adds. Endpoints must be public HTTPS hosts, checked in DNS, and requests never follow redirects or leave the server's origin except for OAuth with a vetted authorization server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional remote MCP support. The owner connects remote MCP servers in Settings → Integrations and chooses which of their tools Talorys may use in chat. Nothing changes when no server is configured.
ToolDefinitionshape, so validation, the call budget, per-tool caps, duplicate detection and approvals all apply. Built-in tools come first and themcp_prefix is reserved.Security
/api/mcpis owner-session + CSRF only; access tokens are refused, and the agent can't manage servers.MCP_CREDENTIAL_KEYsecret (the installer adds it;updateadds it to older installs). They are never returned, logged, sent to the model or exported.TALORYS_MCP_MAX_TOOLS).TALORYS_MCP=offturns the feature off.Design note
This uses
@modelcontextprotocol/clientthrough a guardedfetch, not the Agents SDK'sMCPClientManager. That manager stores transport headers (where a bearer token goes) in plain text incf_agents_mcp_serversand restores connections on wake with its own fetch, which would bypass the checks above. The OAuth callback is the SPA page/settings/mcp-oauth, which posts to/api/mcp/oauth/callbackwith the owner's session: theSameSite=Strictcookie isn't sent on the cross-site redirect. This works for both the Pages deployment and the one-Worker deployment.Upgrading
Migration 12 adds
tal_mcp_servers,tal_mcp_toolsand aresultcolumn on pending actions. Runnpx create-talorys@latest updateto addMCP_CREDENTIAL_KEY.Testing
npm run lint,npm run typecheck,npm run build: clean.npm test: agent 713, shared 25, web 28, installer 66, all passing. Coverage includes a real official-SDK Streamable HTTP server and a mock OAuth authorization server.Docs: docs/mcp.md, plus README, security, architecture, deployment and troubleshooting updates.
🤖 Generated with Claude Code