See it as a diagram
Everything below, as a diagram you can edit. Describe yours and see it in seconds.
No account needed · Editable canvas, not a picture
Connecting with the SDK
The TypeScript SDK gives you a Client and a StreamableHTTPClientTransport. The transport takes the endpoint URL and a requestInit object whose headers carry the bearer credential. The Python SDK has the same shape through its streamable HTTP client, which takes a headers mapping.
The server is stateless, which simplifies the client. It reports itself as datadef version 1.0.0 during the handshake, there is no session identifier to thread through subsequent requests, and a request carries everything the server needs to answer it. A tool call may run for up to five minutes, so set your client timeout above the default rather than discovering the ceiling through cancelled generations.
One caveat that has bitten people on several SDK versions: custom headers belong in the transport options, not in the client options, and older releases dropped them silently. If tool calls come back unauthorized while listings succeed, print the outgoing headers before suspecting the key.
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
const transport = new StreamableHTTPClientTransport(
new URL('https://datadef.io/mcp'),
{
requestInit: {
headers: { Authorization: `Bearer ${process.env.DATADEF_API_KEY}` },
},
},
);
const client = new Client({ name: 'my-agent', version: '1.0.0' });
await client.connect(transport);
const { tools } = await client.listTools(); // 36 tools
const result = await client.callTool({
name: 'create_diagram',
arguments: { prompt: 'Kafka to Snowflake pipeline with dbt models', scope: 'overview' },
});Discovery before credentials
You can build against this server before anyone has created a key. The handshake and the listings are anonymous: initialize, ping, tools/list, prompts/list, resources/list and the templates listing all answer without credentials. Only tools/call is gated. That is deliberate, so directories and crawlers can score the server, and it happens to be the most convenient thing about integrating with it.
The practical use is code generation and testing. Pull the tool schemas in CI, generate typed bindings from them, and assert that the tools your agent depends on still exist with the argument names it uses. A schema change then breaks a test rather than a production run.
The same anonymity gives you a clean health check that does not need a secret in the monitoring system. A tools/list that returns 36 entries means the server is up and complete.
Which tools to expose, and in what order
There are two layers. Nine outcome tools do whole-diagram work: create_diagram, create_blank_diagram, list_diagrams, get_diagram, edit_diagram, export_diagram, repo_status, repo_refresh and get_design_guide. Twenty-seven canvas tools, all prefixed canvas_, operate on individual elements: nodes, edges, columns, groups, lineage, annotations, geometry, layout and validation.
For an agent that should produce a good diagram from a description, expose create_diagram and stop there. For an agent that builds deliberately, the working order is get_design_guide first, then create_blank_diagram, then adding nodes, grouping them into zones, connecting them, laying out, and finally validating and measuring. Feeding the design guide in as a system prompt is more reliable than hoping the model calls the tool, because the guide is what keeps output at the same standard as a generated diagram.
End every build with canvas_validate_canvas and canvas_measure_canvas. Orphan nodes, overlaps and a canvas that is far too large are the failure modes a language model cannot detect in its own output, and they are exactly what these two report. An agent that treats their output as a to-fix list produces diagrams that survive review.
Credits and plans, in one line
The four limits a headless client has to handle
Time. A tool call may run for up to five minutes. create_diagram holds the connection for about 35 seconds and returns a finished diagram if generation lands inside that window; otherwise it returns a diagram_id and expects you to wait roughly 60 seconds and poll get_diagram every 30. Typical end-to-end is one to three minutes. Calling create_diagram again while one is still generating produces a duplicate and spends a second credit, so the retry path in your client has to be a poll, never a re-call.
Credits. Generation consumes one and refunds it when generation fails, so a failed run costs nothing but the wait. create_blank_diagram spends nothing at all, which is why an agent that builds deliberately with the canvas tools is cheaper than one that regenerates until it likes the result.
Refreshes. repo_refresh is bucketed at ten per ten minutes per account, so a client fanning out across linked projects has to pace itself rather than discover the ceiling in production. A refresh also regenerates from the repository and replaces manual canvas edits, so it belongs only on projects whose diagram is meant to be generated.
Attribution. Every call is recorded with the credential label, the tool name, the status, the duration and an argument excerpt capped at 140 characters; full prompts are never stored. Give an autonomous client its own key with its own label and its traffic stays separable from human traffic at a glance, which is the difference between debugging an agent and guessing about it.
FAQ
How does a custom client authenticate against this MCP server?
Do I need to manage a session identifier?
Can I read the tool schemas before I have an API key?
How long can a single tool call take?
Which tools should an autonomous agent be given?