Connect
LangGraph
LangGraph builds stateful multi-step agent graphs on top of LangChain primitives. Wire Dock in through langchain-mcp-adapters, the same package LangChain uses, and every graph node can call Dock tools.
Client
LangGraph
Stateful agent graphs. Uses the same MCP adapters as LangChain.
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+.
langgraphandlangchain-mcp-adaptersinstalled.- A Dock
dk_key.
graph.pypython
import os
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic
mcp = MultiServerMCPClient({
"dock": {
"url": "https://trydock.ai/api/mcp",
"transport": "streamable_http",
"headers": {
"Authorization": f"Bearer {os.environ['DOCK_API_KEY']}"
},
}
})
tools = await mcp.get_tools()
# Bring your own LangChain ChatModel, Dock is provider-agnostic.
# (ChatAnthropic, ChatOpenAI, ChatGoogleGenerativeAI, ChatLiteLLM, ...)
agent = create_react_agent(llm, tools)
result = await agent.ainvoke({
"messages": [{"role": "user", "content": "List my Dock workspaces."}]
})Troubleshooting
Symptom
Fix
Graph hangs on tool call
Ensure the MCP client session isn't closed before the graph runs. Scope the async-with to the full
agent.ainvoke call.Frequently asked questions
- How do I connect Dock to LangGraph?
- Add Dock as a remote MCP server in LangGraph. Either let LangGraph's OAuth 2.1 + DCR flow handle auth (recommended; no credential ceremony), or paste a scoped Dock `dk_` API key in LangGraph's MCP config under the `Authorization: Bearer dk_…` header.
- Does LangGraph 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 LangGraph, discovers them via the standard `tools/list` handshake. Learn more →
- How do I limit which Dock workspaces LangGraph can write to?
- When you mint the `dk_` key for LangGraph 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 LangGraph did in my Dock workspace?
- Open the workspace in your browser. Every row LangGraph 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 LangGraph 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 LangGraph's `dk_` key in Settings → API keys.
- Can multiple LangGraph sessions share state through Dock?
- Yes. Every LangGraph 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 LangGraph need OAuth or a dk_ API key for Dock?
- Either works. OAuth 2.1 + DCR is the recommended path: LangGraph 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 use Dock as the persistence layer for a LangGraph agent?
- LangGraph's checkpointers are typically Postgres or SQLite. Treat Dock differently: instead of checkpointing graph state to Dock, have your LangGraph nodes call Dock's MCP tools (`create_row`, `update_doc`) to write durable, human-readable artifacts the team can review. Learn more →
- Can LangGraph nodes call Dock's MCP tools directly?
- Yes. Use `langchain-mcp-adapters` to wrap Dock's MCP server as a LangGraph tool node. Each node call hits Dock with the agent's `dk_` token; writes are attributed to that signed agent.
- How do I let humans see and comment on a LangGraph agent's intermediate work?
- Have the LangGraph workflow append intermediate outputs to a Dock doc surface via `append_doc_section`. Humans can comment on specific paragraphs in the Dock UI; LangGraph nodes can poll for new comments via `GET /workspaces/:slug/comments`.