Connect to the Diagram MCP server
Connect an MCP client to Diagram using Streamable HTTP.
- Add a remote MCP server in a client that supports HTTP with custom headers.
- Paste the endpoint above and choose Streamable HTTP.
- Ask the deployment owner for a server token. In your client's private configuration, set
Authorization: Bearer YOUR_SERVER_TOKEN. - Refresh the tool list, then run
graph_statusto check the connection.
Anonymous requests are rejected. This endpoint uses a bearer token; it does not offer OAuth sign-in. Keep the token private and out of shared diagrams.
Set up Codex with the new token
- Request the current token privately from the deployment owner. Use the replacement token after a rotation.
- Set
MCP_DIAGRAM_TOKENin the environment of the computer running Codex. Its value must match the server's privateMCP_SERVER_TOKEN. - Add the configuration below once to
~/.codex/config.toml. It references the token without storing its value. - Fully quit and relaunch Codex from that environment, or start the CLI in that shell. A running app does not inherit a token set in another terminal.
- Refresh MCP tools: expect the ten names below. Call
graph_statuswith{}, then usegraph_list_nodesto get IDs for traces and views.
Windows PowerShell: run this to enter the token without putting it in command history, then launch Codex from the same shell.
$env:MCP_DIAGRAM_TOKEN = [System.Net.NetworkCredential]::new('', (Read-Host 'Diagram token' -AsSecureString)).Password 401: check the replacement token and restart the client. 429: wait at least one minute before
retrying. Initialization and notifications also count toward the process-local 20
requests/minute limit. Use bearer configuration; codex mcp login is for OAuth.
10 read-only graph tools
graph_statusgraph_list_nodesgraph_list_edgesgraph_tracegraph_layoutgraph_search_inventorygraph_adjacencygraph_querygraph_build_viewgraph_create_portable_view
Tools query the public map, trace connections, search public references, and build portable view links. Portable views validate the graph supplied by the caller. Tools do not save editor changes or access private inventory. The demo workspace's MCP playground is a local simulation.
Create a portable diagram with an AI agent
- Connect an MCP client using the private server token. Discover the tools, then call
graph_statuswith an empty object. - Call
graph_create_portable_viewwith the graph below. Add nodes, ports and edges as needed; every edge must reference existing ports. - Open the returned URL to inspect the diagram. The URL carries the graph and anyone with it can read that data; never put secrets in it.
{
"graph": {
"schemaVersion": 1,
"nodes": [
{
"id": "api",
"label": "API",
"tags": [],
"inputs": [],
"outputs": []
}
],
"edges": []
}
} The MCP tool creates a portable view, not a saved editor record. Export a document to retain edits.
Troubleshooting
401 means the server token is missing or invalid. 404 means the server is disabled on that deployment. 503 means the deployment owner must configure the token. 429 means the request limit was reached; wait before retrying.
Use POST to this exact endpoint. An optional Origin header must match the deployment's public origin. A client that requires OAuth and cannot send a bearer header is not compatible with this endpoint.