---
title: "Developers · Mentat"
description: "The Mentat developer portal: get a workspace API key in one request, call the REST API from its OpenAPI spec, connect the MCP server, script it with the CLI, and try it all against a sandbox graph with no key."
url: https://trymentat.pages.dev/developers
---

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.

| Endpoint | Limit | Counted |
| --- | --- | --- |
| POST /api/workspaces | 10 per hour | per IP address |
| /api/demo/\* | 120 per minute | per IP address |
| /mcp | 600 per minute | per 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](https://trymentat.pages.dev/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.json](https://trymentat.pages.dev/openapi.json)**OpenAPI 3.1.** Every REST operation, typed, with an operationId each.

[/.well-known/mcp/server-card.json](https://trymentat.pages.dev/.well-known/mcp/server-card.json)**MCP server card.** Transport, endpoint, auth, and the full tool list.

[/llms.txt](https://trymentat.pages.dev/llms.txt)**llms.txt.** The site map for language models, with when to use Mentat.

[/llms-full.txt](https://trymentat.pages.dev/llms-full.txt)**llms-full.txt.** Every page on this site as one Markdown file.

[/.well-known/api-catalog](https://trymentat.pages.dev/.well-known/api-catalog)**API catalog.** RFC 9727 linkset pointing at the spec and docs.

[/sitemap.xml](https://trymentat.pages.dev/sitemap.xml)**Sitemap.** Every public page.

---

Mentat: https://trymentat.pages.dev/ · Docs: https://trymentat.pages.dev/docs · Developers: https://trymentat.pages.dev/developers · API: https://trymentat.pages.dev/openapi.json · Index for agents: https://trymentat.pages.dev/llms.txt
