feat(connector-mcp): adopt MCP servers as connectors (ADR-0024)#1424
Merged
Conversation
Add @objectstack/connector-mcp — a single generic adapter that turns any
Model Context Protocol server into an ordinary type:'api' connector on the
automation engine, with no per-server code.
- createMcpConnector(): connect over stdio or streamable-HTTP, call
tools/list, map each tool to a connector action (name→key,
description→label/description, inputSchema→inputSchema), and dispatch
connector_action calls to tools/call. Results normalise to the shared
{ ok, content, ... } envelope; logical tool errors surface as ok:false.
- ConnectorMcpPlugin: registers via the existing engine.registerConnector()
path (no new engine surface, no mcp_call node) and tears the MCP connection
down on destroy(). Fail-soft when the server or automation engine is absent.
- Credentials stay with the MCP server (transport env/headers), never in
ConnectorSchema or the discovery-exposed def.
- Mirrors the connector-rest/connector-slack conventions; the real MCP SDK
client is lazily imported and injectable so unit tests stay hermetic.
https://claude.ai/code/session_01G9v2WA48voVBSkQ7sjFkqC
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Keeps @objectstack/connector-mcp versioned in lockstep with the rest of the public monorepo, satisfying scripts/check-changeset-fixed.mjs (the Validate Package Dependencies CI gate). https://claude.ai/code/session_01G9v2WA48voVBSkQ7sjFkqC
os-zhuang
marked this pull request as ready for review
May 31, 2026 23:05
Comment on lines
+115
to
+118
| const slug = input | ||
| .toLowerCase() | ||
| .replace(/[^a-z0-9]+/g, '_') | ||
| .replace(/^_+|_+$/g, ''); |
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
Implements ADR-0024: ship
@objectstack/connector-mcp, a single generic adapter that turns any Model Context Protocol (MCP) server into an ordinarytype: 'api'connector on the automation engine — with no per-server code. One adapter unlocks the entire MCP ecosystem (filesystem, GitHub, Slack, databases, search, hundreds of community servers).What's in the package
Mirrors the
connector-rest/connector-slackconventions (Apache-2.0, tsup build, acreate…Connectorfactory + a…Plugin).createMcpConnector({ transport, include?, … })— connects over stdio or streamable-HTTP, callstools/list, and builds theConnectordefinition once. Each tool maps mechanically to an action (name → key,description → label/description,inputSchema → inputSchema); each handler closes over the tool name and dispatches totools/call. Results normalise to the shared{ ok, content, … }envelope — a logical tool error surfaces asok: falserather than throwing, so a flow can branch on${node.ok}.ConnectorMcpPlugin— registers the connector through the existingengine.registerConnector()path (no new engine surface, nomcp_callnode, no parallel registry — the anti-patterns ADR-0024 §5 rules out) and tears the MCP connection down ondestroy(). Fail-soft: an unreachable server or a missing automation engine is logged and skipped.connector_actionnode, the discovery route, and the Studio palette all see a plain connector — they never know it is MCP-backed (ADR-0024 §2).Security posture (ADR-0024 §3)
Credentials live with the MCP server, not in
ConnectorSchema. The operator-supplied transportenv(stdio) /headers(http) are passed straight to the MCP client and kept out of the serialized, discovery-exposeddef. The open tier runs an operator-provided server with operator-provided credentials; managed secrets, per-tenant lifecycle, and sandboxed stdio execution remain the enterprise tier (§4).Implementation notes
clientFactory), mirroringconnector-rest'sfetchImpl— so unit tests stay hermetic and the SDK only loads when a real connection is made.Pluginlifecycle exposesdestroy()(notstop()), so teardown is wired todestroy()to ensure the MCP connection / child process is actually released on shutdown.Testing
pnpm build— ✅ ESM + CJS + DTSpnpm exec tsc --noEmit— ✅ strictpnpm test— ✅ 9 passing (discovery → action mapping,includeallowlist,tools/calldispatch + result normalisation incl.isError, lifecycle/close, and an end-to-end flow throughLiteKernel+ the automation engine)Follow-ups (out of scope, per ADR-0024)
examples/entry (reference filesystem / GitHub MCP server → allowlisted actions in a flow).https://claude.ai/code/session_01G9v2WA48voVBSkQ7sjFkqC
Generated by Claude Code