Use Graphrun with an AI agent

Create an Agent Access Key, connect your MCP client, and use natural-language prompts to understand, design, validate, and simulate distributed systems.

Create an Agent Access Key

Each key belongs to one workspace and one approved MCP client. Give every client its own key so you can see where it is used, rotate it, or revoke it without interrupting other clients.

  1. Open your account menu, choose Settings, and select the workspace the client should access. You can also go directly to Agent Access Keys.
  2. Choose Create Agent Access Key and enter a name that identifies the client and device, such as Coding agent on my laptop.
  3. Choose View diagrams only for explanation and review, Full MCP access for a trusted client that should create, edit, and run work, or Custom access for a smaller grant.
  4. Choose an expiry. Keys that can make changes must expire within 14 days; Full MCP access starts with a seven-day expiry.
  5. Review the access summary, create the key, and copy it immediately. Graphrun shows the complete key only once.
Note

Store the key in the client's password setting, your operating system's secret store, or a local environment variable. Never put it in a repository, URL, screenshot, ticket, log, or prompt.

Connect your MCP client

Add the Graphrun Streamable HTTP server to your client. The server is the API address, not the website address, and the key must be sent as a Bearer Authorization header.

Connection details

Server: https://api.graphrun.app/mcp/v2
Environment variable: GRAPHRUN_AGENT_ACCESS_KEY
Credential: Bearer <Agent Access Key>

Choose your client below. Each example keeps the key in an environment variable or password prompt rather than a tracked project file.

Your MCP client

Codex

  1. Choose Full MCP access if you want Codex to create and edit Graphrun work, or Custom access for a smaller grant.
  2. Load the key from your approved secret store into GRAPHRUN_AGENT_ACCESS_KEY.
  3. Run the command below to add Graphrun to Codex.
  4. Restart Codex, then check that Graphrun resources are available.
Codex CLI
# Load GRAPHRUN_AGENT_ACCESS_KEY from your approved secret store.
codex mcp add graphrun \
  --url "https://api.graphrun.app/mcp/v2" \
  --bearer-token-env-var "GRAPHRUN_AGENT_ACCESS_KEY"

This adds a shared server entry. Each Codex client must receive GRAPHRUN_AGENT_ACCESS_KEY from its own launch environment.

Verify the connection

  1. Close and restart the MCP client after adding the key.
  2. Ask the client to connect to Graphrun and list the diagrams it can access.
  3. Ask it to summarize its Graphrun capabilities and any missing permissions or workspace settings.
  4. Start with a small read request, such as “Explain the checkout diagram without making changes,” before asking it to author or run a larger slice.

Choose the smallest useful access

View diagrams only

Best for understanding and review. The agent can inspect checkpointed diagram structure, but it cannot change drafts, use authoring tools, or read real stored values.

Full MCP access

Best for a trusted authoring client. It can work across every current and future diagram in the workspace, including real stored values. Workspace write controls and server-side journey execution availability still apply.

Custom access

Best for focused automation. Choose the actions and information types the client needs, such as architecture authoring, journeys, contracts, checkpoints, or approved run evidence.

Note

A View diagrams only key exposes authorized read resources and no authoring tools. An empty tool list is expected. Use Custom access when the client also needs journeys, contracts, approved runs, implementation links, or handoff packs.

Custom authoring needs write access enabled, the matching actions and information types, and a diagram grant that follows the latest draft. Diagram creation also needs its separate creation switch enabled. For journey authoring and execution, choose View journeys, Create and edit journeys, the Journeys information type, and the owner-confirmed Real stored values payload policy. Add View diagrams and Diagrams and architecture to discover valid journey starts. Merely choosing Structure only cannot authorize a run.

Add the model-authoring skill

Pair your MCP connection with the author-graphrun-models skill so your coding agent follows Graphrun's discovery, authoring, and verification workflow. The Skills guide explains how skills and MCP work together, links the public repository, and includes installation steps and example prompts for your coding agent.

What you can do through MCP

Graphrun gives an MCP client a grant-scoped architecture workspace. The client can combine Graphrun with the files, tickets, or repositories it can already access. The Agent Access Key, workspace write controls, and server availability determine which Graphrun operations are usable. These prompts describe tasks for the agent, not additional built-in tools or a guarantee that every requested feature is modeled.

Note

These prompts name both the installed skill and Graphrun MCP. Use your coding agent's skill selector or supported invocation syntax if it requires one. Confirm the skill is loaded and the MCP connection works before authoring.

Understand an existing system

Suggested access: View diagrams only; Custom access for journey and contract evidence

Inspect checkpointed architecture and component structure without changing the workspace, then add read access only for the extra evidence the task needs.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to open the Checkout Platform diagram and explain the end-to-end purchase flow. Identify every service, queue, data store, external dependency, trust boundary, and modeled failure route. Separate facts from assumptions, do not make changes, and tell me if journey or contract access would provide useful missing evidence.”

Turn a brief into an executable architecture

Suggested access: Full MCP access; Custom needs View diagrams, Create and edit diagrams, View journeys, Create and edit journeys, the Diagrams and architecture and Journeys information types, the Real stored values payload policy, and journey execution enabled

Create a diagram, choose components from Graphrun's catalog, connect handler-owned interactions, lay it out, and add journeys that prove important routes.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to create a Graphrun diagram for a multi-tenant notification platform. Include the public API, tenant and preference services, scheduler, queue, email and SMS workers, provider APIs, database, cache, and dead-letter queue. Model one successful delivery journey and one provider-timeout journey, validate both, and summarize any assumptions.”

Map a codebase into Graphrun

Suggested access: Repository access in the client plus Full MCP access; Custom needs View diagrams, Create and edit diagrams, View journeys, Create and edit journeys, the Diagrams and architecture and Journeys information types, the Real stored values payload policy, and journey execution enabled

Let an agent that can also read your repository translate real applications, routes, dependencies, queues, and stores into a model while marking uncertain inferences.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to study this repository, then create a Graphrun diagram of the system it implements. Trace entry points, service calls, asynchronous messages, data stores, and third-party APIs back to file paths. Add the main user journey and one failure journey. Mark anything inferred rather than evidenced, then validate the result.”

Design APIs, events, and data contracts

Suggested access: Full MCP access; Custom needs View diagrams, View contracts, Create and edit contracts, and the Diagrams and architecture and Contracts information types, and the Real stored values payload policy

Author HTTP operations, message operations, schemas, examples, and logical resources, then use the gap report to find missing bindings or inconsistent shapes.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to define the create-order HTTP contract, the OrderAccepted event, and the orders data resource for the Order Service. Include request, success, validation-error, and conflict shapes. Bind each operation to the correct component handler, run the contract gap report, and fix blocking gaps without approving or publishing anything.”

Exercise success and failure journeys

Suggested access: Full MCP access; Custom needs View diagrams, View journeys, Create and edit journeys, the Diagrams and architecture and Journeys information types, the Real stored values payload policy, and journey execution enabled

Create exact saved journeys with fixtures, run them against the current draft, and inspect bounded event, payload, and failure evidence.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to create and run two checkout journeys: a successful card payment and a payment-provider timeout followed by retry exhaustion. Use deterministic fixtures, verify the expected response or failure at each step, and report the actual route, state changes, emitted messages, and first unexpected event.”

Review resilience before an incident

Suggested access: Full MCP access; Custom needs View diagrams, Create and edit diagrams, View journeys, Create and edit journeys, the Diagrams and architecture and Journeys information types, the Real stored values payload policy, and journey execution enabled

Inspect timeouts, retries, backoff, acknowledgements, dead-letter paths, handler failures, and state mutations, then prove the improved behavior with a journey.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to review the payment path for reliability gaps. Check timeout ownership, retry limits, backoff, duplicate delivery, idempotency, queue ACK/NACK behavior, dead-letter routing, and failure responses. Propose the smallest supported changes first; after I confirm, apply them and run a journey that proves the failure route terminates safely.”

Plan a deployment topology

Suggested access: Full MCP access; Custom needs View diagrams, Create and edit diagrams, and the Diagrams and architecture information type

Add a deployment overlay for regions, zones, runtimes, networks, and replicas without changing the logical behavior of the graph.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to create a deployment view for the existing checkout system across two regions. Place edge, API, worker, database, cache, and queue workloads into appropriate zones and network boundaries. Show the active-region path and failover dependencies, validate the overlay, and call out where the logical model does not contain enough evidence for a deployment decision.”

Assess a proposed architecture change

Suggested access: Custom diagram, journey, and contract viewing to assess; Full or suitable Custom write access to implement

Use the current model as evidence for change-impact analysis before touching the draft, then apply only an approved bounded slice.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to assess what would change if inventory reservation moved from a synchronous request to an event-driven workflow. Trace affected components, contracts, ordering guarantees, failure handling, journeys, and operational trade-offs. Do not edit the diagram yet. Give me a minimal change plan and the journeys we should run to compare the designs.”

Find and repair model gaps

Suggested access: Full MCP access; Custom needs diagram, journey, and contract read and write actions, the Diagrams and architecture, Journeys, and Contracts information types, the Real stored values payload policy, and journey execution enabled

Validate the graph and contracts, find disconnected or non-executable behavior, and make focused repairs while preserving correct work.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to audit the Order Processing diagram for validation failures, disconnected components, interactions without arrival-handler behavior, producers without message emission, unbound contracts, missing failure outcomes, and journeys that cannot execute. Rank the findings, fix only blocking issues, then revalidate and run the critical journey.”

Create a review-ready checkpoint

Suggested access: Full MCP access; Custom needs View diagrams, View journeys, Create and edit journeys, View contracts, Create checkpoints, the Diagrams and architecture, Journeys, and Contracts information types, the Real stored values payload policy, and journey execution enabled

Freeze an immutable graph revision with selected journey snapshots after validation, giving reviewers a stable point-in-time model.

Try this prompt

“Use the author-graphrun-models skill and Graphrun MCP to prepare the current checkout draft for architecture review. Validate the graph and contracts, run the successful checkout and payment-timeout journeys, summarize unresolved warnings, and create a checkpoint containing the exact validated graph and those saved journeys. Do not approve, publish, share, or export anything.”

Tip

Strong prompts name the target diagram, the outcome, the evidence to inspect, whether changes are allowed, and the verification you expect. Ask the agent to mark assumptions whenever the model or connected repository does not provide enough evidence.

Run and verify journeys through MCP

Journey tools retain their existing API names. Read the current authoring context with get_scenario_authoring_context, then list or create the saved journey draft. Before running, read it with get_scenario_draft and pass its returned version_token as scenario_version_token to run_scenario_draft. Do not substitute the graph token, a reference from another key, or an ID copied from the browser address bar.

The server worker runs that exact saved journey against the current follow-latest graph. It does not persist a run artifact or add an approved run to your workspace. Review the returned status, outcome, execution coverage, and trace; a successful tool call can still contain a failed, guarded, or rejected modeled journey. Run every critical success and failure path, not just the easiest one to finish.

Responses default to a bounded summary. Ask for full detail and paginate when you need more evidence. See MCP event pages and coverage for limits, filtering, and reference handling. A diagram checkpoint saves selected journey inputs, not this transient run evidence.

Map an existing codebase without sending its source

Open a diagram's Implementation tab when the system already has a repository. Graphrun can give a connected coding agent stable architecture, contract, data-resource, and mapping targets without receiving repository files or credentials.

  1. Choose Create mapper key. The preset is scoped to this diagram, follows its latest revision, exposes structure only, and expires after seven days. It permits implementation mapping writes, not graph or contract edits or journey runs.
  2. Configure the key in the MCP client, then return to the Implementation tab and choose Copy MCP task.
  3. Run the task from the local repository. The agent lists diagrams, reads the manifest's implementation-context link, and compares stable targets with local files, symbols, manifests, CODEOWNERS, and Git refs.
  4. Keep evidence metadata-only. Repository paths, symbol names, manifest kinds, CODEOWNERS matches, and Git refs are supported; source snippets, file or manifest bodies, credentials, and arbitrary structured payloads are rejected.
  5. If apply_implementation_bindings is advertised, the agent can create or replace up to 100 mappings in one atomic batch. Successful mappings become active immediately: there is no proposal or approval queue. Ask for a candidate list first if you want to review before any write. If the tool is absent, return candidates without changing Graphrun.
  6. Reread the mapping context and bindings after a committed batch. Corrections use the current binding reference and version, not a duplicate create. You can edit or remove active mappings in the Implementation tab; uncertain targets should remain unmapped.
Note

The implementation-context resource is a projection for discovery. It does not change the authoritative implementation-binding index and never grants the agent access to repository source.

Give the agent a safe working loop

  1. Discover: list available diagrams, select the target, and read the current model before planning changes.
  2. Plan: ask for a bounded change slice that includes graph behavior, contracts or resources when needed, and at least one journey that can prove the route.
  3. Author: let the agent use Graphrun's current component catalog and operation guidance instead of guessing component ports or write shapes.
  4. Verify: validate the graph, check contract gaps, and run the saved critical journey. A connection alone is not executable behavior; handlers must own the response, failure, or message action.
  5. Report: summarize evidence, assumptions, unresolved warnings, and exactly what changed. Create a checkpoint only when you need a stable review point.

What MCP deliberately cannot do

MCP can edit drafts, run transient journeys when enabled, validate work, and create checkpoints. It cannot approve contracts, publish work, create approved runs, create share links, or create exports. Authorized readers can retrieve existing approved artifacts, including contract downloads. Contract approval remains a signed-in web action; run publication and share creation are currently disabled in the alpha editor.

Note

A transient journey run is debugging evidence. It does not create an approved run or publish any payload, state, or contract data.

Troubleshooting

What you seeWhat to check
The client cannot connectUse the exact server address, send the key as an HTTPS Bearer header, and fully restart the client. Graphrun does not accept credentials in a URL, cookie, or request body.
The client says the key is invalidUse the complete one-time key, and check that it has not expired or been revoked. An HTTP 401 response means the credential was not accepted.
The client can read but cannot make changesThe key may use View diagrams only, or workspace MCP writing may be disabled. Create a Full or suitable Custom key for an approved client and ask a workspace owner to enable MCP writing.
A capability is missingAsk the client to read Graphrun's capabilities resource and explain the missing grant or workspace setting. Restart or refresh the client after changing access.
Implementation context is missingCreate the mapper key from the diagram's Implementation tab. Implementation context needs implementation-binding access; add architecture or contract access for those target types. Rediscover the diagram manifest after reconnecting.
The agent says its diagram reference is staleAsk it to list diagrams and reload the current draft before continuing. Do not paste saved internal IDs into prompts.
The client reports success but the draft did not changeAsk it to inspect the structured result, reload the current draft, and verify the intended change. Never ask it to blindly retry an old mutation.
Note

For support, share the time of the problem and the safe key name or public ID. Never share the key itself or logs containing real values.

Continue learning

Read Journeys to learn how Graphrun explains successful and failed system paths, or Contracts and data to model APIs, messages, schemas, and logical resources.