Add MCP Connections support to sandbox startup#37
Merged
Conversation
Adds a new `mcpConnections` array input (resourceType: mcpConnector,
wildcard `*` server URL) that lets the user pick any MCP Connector they
have authorized in Settings > API & Integrations. On sandbox start the
Actor writes the chosen Connector IDs to /sandbox/mcp.json in the
standard `mcpServers` shape so tools like `mcpc connect` can pick them
up immediately. Authorization uses a `${APIFY_TOKEN}` placeholder so
the secret never lands on disk.
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
This PR adds support for MCP (Model Context Protocol) Connectors in the sandbox. When users select MCP Connectors (like Slack, Notion, GitHub) in the Actor input, the sandbox now writes them to
/sandbox/mcp.jsonon startup, making them immediately available to tools likemcpc connect.Key Changes
New MCP Connections Module (
sandbox/src/mcp-connections.ts):buildMcpConfig(): Constructs MCP server configuration from Connector IDs, building proxy URLs and authentication headerswriteMcpConfig(): Writes the configuration to/sandbox/mcp.jsonon sandbox startupComprehensive Unit Tests (
sandbox/tests/unit/mcp-connections.test.ts):${APIFY_TOKEN}placeholder is preserved in Authorization headers for runtime substitutionActor Input Integration (
sandbox/src/types.ts):mcpConnections?: string[]field toActorInputinterface to accept Connector IDsActor Configuration (
sandbox/.actor/actor.json):mcpConnectionsinput field with resource picker UI for selecting MCP ConnectorsSandbox Startup (
sandbox/src/main.ts):writeMcpConfig()call during sandbox initialization (non-local mode only)Documentation (
sandbox/artifacts/AGENTS.md):Implementation Details
/sandbox/mcp.jsoneven when the connection list is empty, ensuring downstream tools can rely on its presence_,-are safe; others replaced with_)Bearer ${APIFY_TOKEN}as a literal placeholder for runtime token substitutionhttps://claude.ai/code/session_01Kqvg4XLUCnqzWekWN889DJ