Connect
Anthropic SDK (Python + TS)
Anthropic's Python + TypeScript SDKs include an MCP Connector beta. Pass Dock's URL to messages.create and Claude can call Dock tools inline during a completion, no separate tool loop in your app.
Client
Anthropic SDK (Python + TS)
Anthropic's SDK has a built-in MCP connector for messages.create.
HTTP JSON-RPC (streamable-http)
Dock MCP
trydock.ai/api/mcp
37 tools · OAuth 2.1 + DCR · Bearer
Auth path
1
Client fetches
/.well-known/oauth-authorization-server.2
Self-registers via DCR, opens your browser to Dock consent.
3
Dock returns an access token, client uses it on every request.
Prerequisites
- Anthropic SDK installed.
- A Dock OAuth token (paste from Settings) or a
dk_Bearer key.
Pythonpython
import os
from anthropic import Anthropic
client = Anthropic()
message = client.beta.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "List my Dock workspaces."}],
mcp_servers=[
{
"type": "url",
"url": "https://trydock.ai/api/mcp",
"name": "dock",
"authorization_token": os.environ["DOCK_API_KEY"],
}
],
extra_headers={"anthropic-beta": "mcp-client-2025-04-04"},
)
print(message.content)TypeScripttypescript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const message = await client.beta.messages.create({
model: "claude-sonnet-4-5",
max_tokens: 1024,
messages: [{ role: "user", content: "List my Dock workspaces." }],
mcp_servers: [
{
type: "url",
url: "https://trydock.ai/api/mcp",
name: "dock",
authorization_token: process.env.DOCK_API_KEY!,
},
],
betas: ["mcp-client-2025-04-04"],
});Troubleshooting
Symptom
Fix
"Unknown parameter: mcp_servers"
Include the
mcp-client-2025-04-04 beta header. Without it, the SDK rejects the mcp_servers field.Frequently asked questions
- How do I connect Dock to Anthropic SDK?
- Add Dock as a remote MCP server in Anthropic SDK. Either let Anthropic SDK's OAuth 2.1 + DCR flow handle auth (recommended; no credential ceremony), or paste a scoped Dock `dk_` API key in Anthropic SDK's MCP config under the `Authorization: Bearer dk_…` header.
- Does Anthropic SDK work with Dock's MCP server?
- Yes. Dock exposes 43 MCP tools at `https://trydock.ai/api/mcp` over HTTP transport with OAuth 2.1 + DCR and Bearer-token auth. Any MCP-spec-compliant client, including Anthropic SDK, discovers them via the standard `tools/list` handshake. Learn more →
- How do I limit which Dock workspaces Anthropic SDK can write to?
- When you mint the `dk_` key for Anthropic SDK in Settings → API keys, pick the workspace from the dropdown. The key returns 403 on every other workspace regardless of what the prompt asks. To scope across multiple, mint multiple keys or add the agent as an explicit member of each. Learn more →
- How do I see what Anthropic SDK did in my Dock workspace?
- Open the workspace in your browser. Every row Anthropic SDK created or updated is stamped with the agent's identity (orb + name) in the createdBy / updatedBy field. The workspace activity feed shows every action chronologically. Learn more →
- How do I undo a row Anthropic SDK wrote to Dock?
- Open the row, click the kebab menu, choose Delete (soft-delete preserves history). For bulk reverts use the activity feed to find the agent's session and delete its rows in batch. To prevent future writes, revoke Anthropic SDK's `dk_` key in Settings → API keys.
- Can multiple Anthropic SDK sessions share state through Dock?
- Yes. Every Anthropic SDK session reads and writes the same workspace, so handoffs across machines or across long-running multi-session workflows just work. The Dock workspace IS the shared state; no separate message bus required.
- Does Anthropic SDK need OAuth or a dk_ API key for Dock?
- Either works. OAuth 2.1 + DCR is the recommended path: Anthropic SDK hits Dock's discovery endpoint at `/.well-known/oauth-authorization-server` and auto-registers as a client. The `dk_` Bearer token path is fine for owned-code agents and CI scripts; pick whichever fits your stack. Learn more →
- How do I call Dock's MCP server from the Anthropic SDK?
- Use the SDK's MCP connector tool: `client.beta.messages.create(model='claude-sonnet-4-5', mcp_servers=[{name: 'dock', type: 'url', url: 'https://trydock.ai/api/mcp', authorization_token: 'dk_...'}])`. Claude can then call any Dock tool inline.
- Does Anthropic's MCP connector tool support Dock's OAuth 2.1 + DCR?
- The MCP connector tool currently uses Bearer-token auth (`authorization_token: dk_...`). For OAuth flows, use Claude Desktop or Claude Code instead, both of which handle the DCR dance natively.
- How do I have Claude write to a Dock workspace from a Python script?
- Pass Dock's MCP URL + `dk_` token to `client.messages.create(mcp_servers=[...])`. Then prompt Claude with `append a row to the launch-plan workspace with title='X' and status='drafted'`. Claude calls the `create_row` tool transparently.