Connect
Node.js
Node 20+ ships with global fetch. No SDK needed for REST: just authorize + JSON. For rich agent work, use the MCP TypeScript SDK.
Client
Node.js
Native fetch for REST, MCP TypeScript SDK for tool-calling.
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+.
- A Dock
dk_key.
fetch · read + write rowstypescript
const API = "https://trydock.ai/api";
const H = {
Authorization: `Bearer ${process.env.DOCK_API_KEY}`,
"Content-Type": "application/json",
};
// List workspaces
const ws = await fetch(`${API}/workspaces`, { headers: H }).then((r) => r.json());
// Append a row
const row = await fetch(
`${API}/workspaces/content-pipeline/rows`,
{
method: "POST",
headers: H,
body: JSON.stringify({
data: { title: "From Node", status: "drafted" },
}),
}
).then((r) => r.json());
// Seal it
await fetch(
`${API}/workspaces/content-pipeline/rows/${row.id}`,
{
method: "PATCH",
headers: H,
body: JSON.stringify({ data: { status: "sealed" } }),
}
);SSE · listen for changestypescript
// Node 20+ supports EventSource via the 'eventsource' package
import { EventSource } from "eventsource";
const es = new EventSource(
"https://trydock.ai/api/workspaces/content-pipeline/subscribe",
{
fetch: (url, init) =>
fetch(url, {
...init,
headers: {
...init?.headers,
Authorization: `Bearer ${process.env.DOCK_API_KEY}`,
},
}),
}
);
es.addEventListener("row.updated", (e) => {
console.log("row updated:", JSON.parse(e.data));
});Verify
DOCK_API_KEY=dk_live_... node -e "fetch('https://trydock.ai/api/me', \
{headers:{Authorization:\`Bearer ${process.env.DOCK_API_KEY}\`}}) \
.then(r=>r.json()).then(console.log)"Troubleshooting
Symptom
Fix
fetch not defined
Node version is below 20. Upgrade. On 18.x you can use
node-fetch@3 as a drop-in polyfill.Typescript typing gaps
Generate typed clients from
https://trydock.ai/openapi.json with openapi-typescript.