Developers

Mentat for developers and their agents.

One origin serves everything: a REST API described by OpenAPI, a stateless MCP server over Streamable HTTP, a CLI on npm, and a sandbox graph you can call right now without a key. There is no signup. A key is one request away.

Quickstart

Three steps, each one optional. The first works before you have decided anything.

1. ASK THE SANDBOX WHAT GOVERNS A FILE

curl -s https://trymentat.pages.dev/api/demo/resolve \ -H 'content-type: application/json' \ -d '{"file_path":"src/routes/orders.ts"}'

No key. The sandbox graph already holds a real contradiction, so this returns a block naming both authors.

2. CREATE A WORKSPACE AND GET ITS KEY

curl -s -X POST https://trymentat.pages.dev/api/workspaces \ -H 'content-type: application/json' \ -d '{"name":"my-team"}'

The response carries a token starting mtk_. It is shown once and never again.

3. CALL YOUR OWN GRAPH

curl -s https://trymentat.pages.dev/api/graph/resolve \ -H "Authorization: Bearer $MENTAT_TOKEN" \ -H 'content-type: application/json' \ -d '{"file_path":"src/routes/orders.ts"}'

OR CONNECT AN AGENT INSTEAD

claude mcp add --transport http mentat https://trymentat.pages.dev/mcp \ --header "Authorization: Bearer $MENTAT_TOKEN"

API keys

A workspace key is the only credential. Send it as Authorization: Bearer mtk_... on every request to /api/graph, /api/workspaces/me, and /mcp. Only its SHA-256 hash is stored, so a lost key cannot be recovered and the graph it opened is gone with it. That is the price of having no account system.

EndpointLimitCounted
POST /api/workspaces10 per hourper IP address
/api/demo/*120 per minuteper IP address
/mcp600 per minuteper workspace key, or per IP without one

A limited request gets HTTP 429 with a JSON body saying which limit it hit. Errors are always { error, message }, and the message is written to be shown to a person.

REST API

Base URL https://trymentat.pages.dev. The OpenAPI document is the reference: every operation has an operationId, typed parameters, and response schemas, so it loads directly into a function-calling agent or a client generator.

PUBLIC, NO KEY

GET /api/health, GET /api/demo/graph, POST /api/demo/resolve, POST /api/demo/derive, GET /api/precedent/ledger, and the anonymised precedent reads. The demo routes run the real pipeline against a fresh copy of the sandbox graph on every call.

YOUR WORKSPACE, WITH A KEY

Read and replace the graph, resolve a path, record and promote decisions, break and monitor assumptions, read the contradiction queue, compile AGENTS.md, and generate CI rules. Extracted decisions always land as proposed: nothing governs a file until a human promotes it.

MCP server

https://trymentat.pages.dev/mcp speaks the Model Context Protocol over Streamable HTTP and is stateless: no session id, every POST answered with one JSON body. Without a key it serves the read-only sandbox graph. The full tool reference is in the docs.

CLI and SDK

The CLI is published on npm as @mentatlabs/cli and runs the same engine offline against a graph committed in your repository. The SDK wraps a hosted workspace in a typed client, or runs the engine in your own process.

CLI

npx -y @mentatlabs/cli init

CLI AS A LOCAL MCP SERVER

npx -y @mentatlabs/cli mcp

For agents

Every page on this site answers Accept: text/markdown with Markdown instead of HTML. These are the files an agent should read first.

/openapi.jsonOpenAPI 3.1. Every REST operation, typed, with an operationId each.
/.well-known/mcp/server-card.jsonMCP server card. Transport, endpoint, auth, and the full tool list.
/llms.txtllms.txt. The site map for language models, with when to use Mentat.
/llms-full.txtllms-full.txt. Every page on this site as one Markdown file.
/.well-known/api-catalogAPI catalog. RFC 9727 linkset pointing at the spec and docs.
/sitemap.xmlSitemap. Every public page.