Connect
langchain logo

LangChain

LangChain's MCP adapters wrap any MCP server as first-class LangChain tools. Point them at Dock and your agent chains get all 63 tools with no glue code.

Client
LangChain
Framework (Python + JS). MCP via langchain-mcp-adapters.
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+ or Node 20+.
  • langchain-mcp-adapters installed (pip install langchain-mcp-adapters) or @langchain/mcp-adapters (npm i @langchain/mcp-adapters).
  • A Dock dk_ key.
Pythonpython
import os
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents 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({
    "input": "List my Dock workspaces and seal the oldest drafted row."
})
TypeScripttypescript
import { MultiServerMCPClient } from "@langchain/mcp-adapters";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatAnthropic } from "@langchain/anthropic";
import { connectorFaqs } from "@/lib/connector-faqs";

const mcp = new MultiServerMCPClient({
  dock: {
    url: "https://trydock.ai/api/mcp",
    transport: "streamable-http",
    headers: { Authorization: `Bearer ${process.env.DOCK_API_KEY}` },
  },
});

const tools = await mcp.getTools();
// Bring your own LangChain ChatModel, Dock is provider-agnostic.
// (ChatAnthropic, ChatOpenAI, ChatGoogleGenerativeAI, ChatLiteLLM, ...)
const agent = createReactAgent({ llm, tools });

Verify

Smoke testbash
DOCK_API_KEY=dk_c914f1c6... python agent.py
# → "Found 3 workspaces: content-pipeline, research-queue, product-brief"

Troubleshooting

Symptom
Fix
Adapter never returns tools
Make sure transport is streamable_http (underscore in Python, hyphen in JS). The adapter silently hangs on mismatched transport names.
Tool calls return content: "[]"
That's a valid empty result from Dock (no workspaces, no rows). Create a workspace first or mint a key scoped to one that has data.

Frequently asked questions

How do I connect Dock to LangChain?
Add Dock as a remote MCP server in LangChain. Either let LangChain's OAuth 2.1 + DCR flow handle auth (recommended; no credential ceremony), or paste a scoped Dock `dk_` API key in LangChain's MCP config under the `Authorization: Bearer dk_…` header.
Does LangChain 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 LangChain, discovers them via the standard `tools/list` handshake. Learn more →
How do I limit which Dock workspaces LangChain can write to?
When you mint the `dk_` key for LangChain 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 LangChain did in my Dock workspace?
Open the workspace in your browser. Every row LangChain 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 LangChain 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 LangChain's `dk_` key in Settings → API keys.
Can multiple LangChain sessions share state through Dock?
Yes. Every LangChain 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 LangChain need OAuth or a dk_ API key for Dock?
Either works. OAuth 2.1 + DCR is the recommended path: LangChain 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 LangChain?
Use `langchain-mcp-adapters` to wrap Dock's MCP server: `MCPServerHttp(url='https://trydock.ai/api/mcp', headers={'Authorization': 'Bearer dk_...'})`. Pass the adapter to `create_tool_calling_agent` and Dock's 43 tools become callable from any LangChain chain.
Can a LangChain agent stream its work to a Dock doc as it runs?
Yes. Use a streaming callback that calls `append_doc_section` per significant intermediate step. The Dock doc becomes a live transcript of the agent's reasoning, viewable + commentable by humans in real time.
How is Dock different from LangChain's own Memory components?
LangChain Memory is per-chain ephemeral state. Dock is a shared, hosted workspace your team and your agents both write to with attribution. Use LangChain Memory for chain-local context; use Dock for the durable team-visible artifacts the chain produces.

Related

Updated