Connect
MCP Python SDK
For custom Python agents, eval runs, and CI scripts: call Dock's MCP directly via the official MCP Python SDK. No framework needed.
Client
MCP Python SDK
Official mcp package. Streamable-http and SSE transports.
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
- Python 3.10+.
mcpinstalled (pip install mcp).- A Dock
dk_key.
client.pypython
import asyncio, os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async def main():
async with streamablehttp_client(
"https://trydock.ai/api/mcp",
headers={"Authorization": f"Bearer {os.environ['DOCK_API_KEY']}"},
) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
print(f"{len(tools.tools)} Dock tools available")
result = await session.call_tool(
"create_row",
arguments={
"slug": "content-pipeline",
"data": {"title": "From Python", "status": "drafted"},
},
)
print(result.content)
asyncio.run(main())Verify
DOCK_API_KEY=dk_live_... python client.py
# → 13 Dock tools available
# → [TextContent(text='Created row row_01HX...')]Troubleshooting
Symptom
Fix
ImportError: streamablehttp_client not found
Upgrade the
mcp package to 1.0+. Older builds only shipped SSE.SSL / certificate errors on connect
Your Python install uses a stale CA bundle. Install
certifi and set SSL_CERT_FILE=$(python -m certifi) before running.