MCP tools
Connect remote MCP servers per request and manage the current developer-owned hosted integration surface.
connectMcpTools connects remote HTTP or SSE MCP servers, merges their tools into
a turn, and returns cleanup for the handler to run when the request settles.
Local stdio subprocess transport is not supported.
import { connectMcpTools }
from '@mordn/chat-widget/server/mcp';
createChatHandler({
getUserId: getChatUserId,
model,
store,
buildTools: async (ctx) =>
connectMcpTools(await resolveAgentMcpServers(ctx)),
});
Server configuration
const servers = [
{
id: 'linear',
label: 'Linear',
url: 'https://mcp.linear.app/sse',
transport: 'sse',
headers: { Authorization: `Bearer ${developerToken}` },
namespaceTools: true,
},
];
Connections are isolated per server. Failures appear in results and do not
block healthy servers. Namespacing avoids collisions, and cleanup is idempotent.
Hosted management API
@mordn/chat-api exposes tenant-key-authenticated endpoints:
| Endpoint | Purpose |
|---|---|
GET /v1/mcp |
List servers with credential values redacted |
GET /v1/mcp/connect |
Server-to-server read of enabled connection details |
POST /v1/mcp |
Add a server with a read-write key |
PATCH /v1/mcp/:id |
Update a server with a read-write key |
DELETE /v1/mcp/:id |
Remove a server with a read-write key |
The API key fixes tenant and agent scope. Credentials stay on the server.
The dashboard’s current Integrations manager reflects this developer-owned surface. Custom MCP remains an advanced path; catalog-managed providers must not allow the browser to override backend-owned endpoints or header names.