Connect
MCP TypeScript SDK
When you want raw control (custom agent loop, evals harness, backend integration), the MCP TypeScript SDK gives you a direct MCP client. Perfect for calling Dock tools from any Node process.
Client
MCP TypeScript SDK
Official @modelcontextprotocol/sdk (Node + browser).
HTTP JSON-RPC (streamable-http)
Dock MCP
trydock.ai/api/mcp
37 tools · OAuth 2.1 + DCR · Bearer
Auth path
1
Mint a
dk_ key in Dock Settings → API keys.2
Paste it as
Authorization: Bearer dk_… in the client config.3
Client calls Dock MCP directly on every request.
Prerequisites
- Node 20+.
@modelcontextprotocol/sdkinstalled (npm i @modelcontextprotocol/sdk).- A Dock
dk_key.
client.tstypescript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const transport = new StreamableHTTPClientTransport(
new URL("https://trydock.ai/api/mcp"),
{
requestInit: {
headers: {
Authorization: `Bearer ${process.env.DOCK_API_KEY}`,
},
},
}
);
const client = new Client(
{ name: "my-agent", version: "1.0.0" },
{ capabilities: {} }
);
await client.connect(transport);
// List tools
const { tools } = await client.listTools();
console.log(`${tools.length} Dock tools available`);
// Call a tool
const result = await client.callTool({
name: "create_row",
arguments: {
slug: "content-pipeline",
data: { title: "From a script", status: "drafted" },
},
});
console.log(result.content);
await client.close();Verify
DOCK_API_KEY=dk_live_... npx tsx client.ts
# → 13 Dock tools available
# → { type: "text", text: "Created row row_01HX..." }Troubleshooting
Symptom
Fix
Transport hangs on connect
You may be behind a proxy that doesn't forward Mcp-Session-Id headers. Test with a direct network first. Dock uses the standard streamable-http transport shape; anything else implies a network-layer issue.
Tool calls return JSON-RPC error -32015
Plan cap hit. Read the
data field on the error object for the next-step endpoint (usually upgrade_plan or request_limit_increase).