Skip to content

SDK guides

Connectors is a remote HTTP MCP server. Every framework below loads it the same way — point at CONNECTORS_MCP_URL and pass the bearer token.

Use the MCP server as an HTTP MCP server in the SDK options.

import { query } from "@anthropic-ai/claude-agent-sdk";
const mcpServers = {
connectors: {
type: "http" as const,
url: process.env.CONNECTORS_MCP_URL!,
headers: {
Authorization: `Bearer ${process.env.CONNECTORS_API_KEY}`,
},
},
};
for await (const message of query({
prompt: "Find the latest Linear issues about onboarding and summarize the top blockers.",
options: { mcpServers, maxTurns: 20 },
})) {
if (message.type === "result") {
console.log(message);
}
}

Use the Responses API with an MCP tool. For authenticated remote MCP servers, pass the token in the MCP tool’s authorization field.

import OpenAI from "openai";
const client = new OpenAI();
const response = await client.responses.create({
model: process.env.OPENAI_MODEL!, // any model your account has enabled for the Responses API
input: "Search Connectors for recent Linear issues about onboarding and summarize the blockers.",
tools: [
{
type: "mcp",
server_label: "canvas_connectors",
server_description: "Canvas Connectors workspace search and app context.",
server_url: process.env.CONNECTORS_MCP_URL!,
authorization: process.env.CONNECTORS_API_KEY!,
require_approval: "never",
allowed_tools: [
"sketch_search",
"sketch_search_entities",
"sketch_get_entity_context",
"sketch_get_file_content",
],
},
],
});
console.log(response.output_text);

For production, choose require_approval based on the sensitivity of the connected data and action tools. The public Sketch MCP tools are read-oriented today, but live app-action tools should generally require approval unless the workflow is narrowly scoped.

Use @langchain/mcp-adapters to load Connectors tools into a LangChain agent.

import { MultiServerMCPClient } from "@langchain/mcp-adapters";
import { createAgent } from "langchain";
import { ChatOpenAI } from "@langchain/openai";
const mcpClient = new MultiServerMCPClient({
canvasConnectors: {
transport: "http",
url: process.env.CONNECTORS_MCP_URL!,
headers: {
Authorization: `Bearer ${process.env.CONNECTORS_API_KEY}`,
},
},
});
const tools = await mcpClient.getTools();
const agent = createAgent({
model: new ChatOpenAI({ model: process.env.OPENAI_MODEL! }), // any model your account has enabled
tools,
});
const result = await agent.invoke({
messages: [
{ role: "user", content: "Find the Linear issue for the new onboarding flow and draft a Slack summary." },
],
});
console.log(result);

List tools:

const listResponse = await fetch(process.env.CONNECTORS_MCP_URL!, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CONNECTORS_API_KEY}`,
Accept: "application/json, text/event-stream",
"Content-Type": "application/json",
"Mcp-Protocol-Version": "2025-03-26",
},
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" }),
});
console.log(await listResponse.json());

Call search:

const callResponse = await fetch(process.env.CONNECTORS_MCP_URL!, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CONNECTORS_API_KEY}`,
Accept: "application/json, text/event-stream",
"Content-Type": "application/json",
"Mcp-Protocol-Version": "2025-03-26",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 2,
method: "tools/call",
params: {
name: "sketch_search",
arguments: { query: "customer onboarding launch blockers", kind: "task", sortBy: "recency", limit: 5 },
},
}),
});
console.log(await callResponse.json());