Invite-only.
Connect

Mastra

Mastra ships an MCP client out of the box. Construct an MCPClient pointing at Dock and every Mastra Agent gets the 13 Dock tools in its toolbelt.

Client
Mastra
TypeScript-first agent framework. First-class MCP client.
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+.
  • @mastra/mcp installed (npm i @mastra/mcp).
  • A Dock dk_ key.
agent.tstypescript
import { MCPClient } from "@mastra/mcp";
import { Agent } from "@mastra/core";
import { anthropic } from "@ai-sdk/anthropic";

const mcp = new MCPClient({
  servers: {
    dock: {
      url: new URL("https://trydock.ai/api/mcp"),
      requestInit: {
        headers: {
          Authorization: `Bearer ${process.env.DOCK_API_KEY}`,
        },
      },
    },
  },
});

const tools = await mcp.getTools();

export const contentAgent = new Agent({
  name: "ContentAgent",
  instructions: "You help operate a shared Dock workspace.",
  model: anthropic("claude-opus-4-7"),
  tools,
});

Verify

DOCK_API_KEY=dk_live_... npx mastra dev
# → Agent "ContentAgent" is ready with 37 tools from dock

Troubleshooting

Symptom
Fix
Mastra dev shows 0 tools from dock
MCPClient rejects relative URLs. Pass new URL(...) not a plain string.
Auth works in dev, fails in prod
Env vars don't always propagate through Mastra's prod bundler. Pass the Bearer header via a constant pulled at build time, or inject via a secrets manager.

Related