# Context Repo — Full Agent Context

> Context Repo is the AI Context Repo for agents. Save prompts and
> documents with version history, organize them in collections, and access
> them from ChatGPT or connected clients through a 29-tool MCP server. Its
> `search` and `fetch` tools provide ChatGPT App
> compatibility through OpenAI Apps SDK Company Knowledge.

This file inlines a curated, hand-authored, agent-readable knowledge pack.

Other agent surfaces:

- [`/llms.txt`](https://contextrepo.com/llms.txt) — Index file (60–100 lines, llmstxt.org spec)
- [`/openapi.json`](https://contextrepo.com/openapi.json) — OpenAPI 3.1 spec for the 35 REST operations
- [`/api/openapi.yaml`](https://contextrepo.com/api/openapi.yaml) — YAML mirror of the OpenAPI spec
- [`/index.md`](https://contextrepo.com/index.md) — Markdown rendering of the homepage
- [`/pricing.md`](https://contextrepo.com/pricing.md) — Plain markdown pricing reference
- [`/agent`](https://contextrepo.com/agent) — Machine-readable capability catalog (JSON or markdown)
- [`/.well-known/mcp.json`](https://contextrepo.com/.well-known/mcp.json) — MCP discovery (SEP-1649)
- [`/.well-known/agent.json`](https://contextrepo.com/.well-known/agent.json) — OpenAI ai-plugin manifest
- [`/.well-known/agent-card.json`](https://contextrepo.com/.well-known/agent-card.json) — A2A Agent Card
- [`/.well-known/mcp/server-card.json`](https://contextrepo.com/.well-known/mcp/server-card.json) — MCP server card (29 tools)
- [`/.well-known/api-catalog`](https://contextrepo.com/.well-known/api-catalog) — RFC 9727 linkset
- [`/.well-known/oauth-protected-resource/v1`](https://contextrepo.com/.well-known/oauth-protected-resource/v1) — RFC 9728 (REST)
- [`/.well-known/oauth-protected-resource/mcp`](https://contextrepo.com/.well-known/oauth-protected-resource/mcp) — RFC 9728 (MCP)
- [`/.well-known/oauth-protected-resource/grok-mcp`](https://contextrepo.com/.well-known/oauth-protected-resource/grok-mcp) — RFC 9728 (Grok MCP compatibility resource)
- [`/.well-known/oauth-authorization-server`](https://contextrepo.com/.well-known/oauth-authorization-server) — RFC 8414
- [Grok connector guide](https://contextrepo.com/docs/integrations/grok) — Custom connector setup for the dedicated Grok MCP entrypoint

## When To Use Context Repo

Use Context Repo when an agent needs to:

### 1. Retrieve A Versioned Prompt Template

- Pull a stored prompt by id or by semantic search
- List version previews or restore a selected snapshot
- Reuse stored `${variable}` placeholders; the caller manages any substitution

### 2. Search A User's Own Knowledge Workspace

- Semantic / 1536-dim vector search across prompts, documents, collections
- Literal full-body search when exact-match is required — titles, descriptions, and indexed document body text via hierarchical chunks (full-body literal matching, eventually consistent with chunking; title and preview matches are immediate)
- Hierarchical "deep search" inside long documents (chunk-level)
- One best-effort cited answer over stored document content with `reason` (read-only; documents only, not prompts)
- Citation-ready results for the ChatGPT App through the OpenAI Apps SDK Company Knowledge contract

### 3. Store New Context From An Agent Workflow

- Create / update prompts and documents (with auto-embedding)
- Add items to collections for later retrieval
- Save a public web page by URL through Firecrawl (dashboard, Chrome Extension, or REST `scrapeUrl`), then refresh it later (dashboard or REST `refreshDocument`) to keep it current (Pro Max and Ultimate)
- The Context Repo ingestion and upload pipeline supports 75+ file formats via LlamaIndex Cloud. MCP `create_document` accepts plain text or Markdown.
- Documents are stored as Markdown, which agents read well, and render as formatted pages for people, with tables, code highlighting, and Mermaid diagrams

### 4. Save Conversations, Decisions, And Handoffs

- The Chrome Extension saves the visible ChatGPT or Claude conversation as one Markdown document, with each user and assistant turn in order
- A connected agent can save a transcript, summary, decision log, or session handoff with MCP `create_document` or REST `POST /v1/documents`
- A saved conversation is an ordinary document: versioned, chunked, and embedded. Once processing completes, other connected clients can use it with `find_items`, `deep_search`, and `reason`.

### 5. Sync Context Across Clients

- Same workspace available through the dashboard, Chrome Extension, ChatGPT
  App, REST API, and compatible MCP clients
- REST API for non-MCP automation
- Real-time sync via Convex subscriptions in the web dashboard
- Share a prompt or document with people through a read-only public link, published from the dashboard

## When Not To Use Context Repo

Context Repo holds the context you and your agents choose to keep. A few
jobs belong to other tools:

- **Open-web search.** Context Repo searches your stored content, not the
  live web. Use it alongside a search tool: when a page is worth keeping,
  save it by URL (Pro Max and Ultimate) and refresh it later to keep it current.
- **Raw vector storage for bulk application data.** Context Repo does not
  accept your own vectors, and REST and MCP writes cap document content at
  900 KB. Instead, it runs
  retrieval for you: automatic chunking and embeddings, semantic and
  exact-match search, step-by-step `deep_search` inside long documents,
  and cited answers from `reason`.
- **Organization or team accounts.** Each account belongs to one person
  today; there are no shared org workspaces, member seats, or org-level
  roles. Within one account, a team of agents works well:
  - Connect several agents and tools to the same repository, each with its
    own API key scoped to prompts, documents, or both, with read or write
    access.
  - Document updates and restores through MCP must name the revision they
    are based on (`expectedRevision`), so one agent cannot silently
    overwrite another's edit. REST clients get the same check by sending
    `If-Match` or `expectedRevision`.
  - For documents several agents edit at the same time, turn on
    `lease_required`. Through the REST API, an agent takes a time-limited
    lease before writing. Each lease carries a fence number: once a lease
    is released, or expires and another agent takes it, writes that still
    carry the old lease are rejected. MCP clients cannot hold a lease, so
    lease-managed documents are written through REST.
  - Share a prompt or document with people through a read-only public
    link, published from the dashboard.

## Platform At A Glance

- **Built on** — Next.js 15 (App Router, Turbopack) + Convex
  (real-time backend) + Clerk (auth + billing) + TypeScript strict mode
- **License** — Proprietary ([policies](https://contextrepo.com/policies))
- **Status** — Pre-launch SaaS; subscription-gated dashboard
- **Region** — Vercel global edge + Convex serverless
- **Domain** — [contextrepo.com](https://contextrepo.com)
- **Support** — [support@contextrepo.com](mailto:support@contextrepo.com)
- **Runtime inventory** — 16 database tables, 37 physical Convex HTTP
  route registrations, 35 public REST operations, and 29 MCP tools

### Content Model

- **prompts** — Versioned text templates with optional `${variable}`
  placeholders stored verbatim. Context Repo does not substitute or execute
  them. Current prompt records include title, description, content,
  parameters, variables, and tags; stored version snapshots retain content,
  parameters, variables, and an optional change log.
- **documents** — Markdown / plain-text knowledge artifacts with full
  version history, automatic 1536-dim embeddings, and chunk-level
  "deep search" navigation. Origins: manual, file upload (75+ formats
  via LlamaIndex), web scrape (Firecrawl).
- **collections** — Folders that group prompts and documents,
  optionally colored / iconed. Items can belong to multiple
  collections. Use `get_collection` to read members; `deep_search`
  and `reason` accept `collectionId` for document-only retrieval.

### Authentication

Clerk handles all user auth. Two Bearer-token shapes are accepted:

- **Session JWT** — logged-in dashboard / extension users
- **`oat_*`** — Clerk OAuth user-delegation token (ChatGPT MCP connector)

Plus first-party API key:

- **`gm_<publicId>_<secret>`** — via header `Authorization: API-Key gm_...`

JWT / `oat_` tokens bypass scope gates; `gm_` keys
MUST carry one of the four declared scopes: `prompts.read`,
`prompts.write`, `documents.read`, `documents.write`. The
`documents.write` scope covers `POST /v1/documents/scrape` (there is
no separate scrape scope). `*.write` implies `*.read` within the same
resource.

Auth metadata:

- [`/.well-known/oauth-authorization-server`](https://contextrepo.com/.well-known/oauth-authorization-server) (RFC 8414)
- [`/.well-known/oauth-protected-resource/v1`](https://contextrepo.com/.well-known/oauth-protected-resource/v1) (REST, RFC 9728)
- [`/.well-known/oauth-protected-resource/mcp`](https://contextrepo.com/.well-known/oauth-protected-resource/mcp) (MCP, RFC 9728)
- [`/.well-known/oauth-protected-resource/grok-mcp`](https://contextrepo.com/.well-known/oauth-protected-resource/grok-mcp) (Grok MCP compatibility resource, RFC 9728)

### Rate Limits

Per authenticated user, sliding window:

| Family | Window | Endpoints |
|---|---|---|
| `scrape` | 10 requests / 60 s | `POST /v1/documents/scrape` |
| `api` | 100 requests / 60 s | `POST` / `PATCH` / `DELETE` / `PUT`, search, `pd/*` |
| `readonly` | 120 requests / 60 s | `GET /v1/...`; `pd/read`; `pd/expand` |

Rate-limit response metadata:

- `X-RateLimit-Limit`
- `X-RateLimit-Remaining`
- `X-RateLimit-Reset` (ISO 8601)
- `Retry-After` (seconds; present on `429`)

## MCP Server

- **Endpoint** — [`https://contextrepo.com/mcp`](https://contextrepo.com/mcp)
- **Grok endpoint** — [`https://contextrepo.com/grok-mcp`](https://contextrepo.com/grok-mcp), an auth-required compatibility entrypoint for the same 29 tools. Setup: [`/docs/integrations/grok`](https://contextrepo.com/docs/integrations/grok)
- **Transport** — streamable-http (MCP spec rev ≥ 2025-03-26)
- **Streaming: YES** — Clients that advertise `Accept: text/event-stream`
  receive SSE-framed JSON-RPC; JSON-only clients receive a single
  chunked response (an Accept-shim unframes the SSE body before
  delivery, so simpler agents can call `/mcp` without negotiating
  event-stream).
- **Discovery** — [`/.well-known/mcp.json`](https://contextrepo.com/.well-known/mcp.json) (SEP-1649)
- **Server card** — [`/.well-known/mcp/server-card.json`](https://contextrepo.com/.well-known/mcp/server-card.json) (29 tools)
- **Auth** — OAuth 2.1 (Clerk) OR Context Repo API key
- **Auth dispatch** — Canonical `/mcp` leaves selected capability-discovery methods public; `/grok-mcp` requires authentication for every request so Grok receives an OAuth challenge during its first handshake
- **npm package** — [`context-repo-mcp`](https://www.npmjs.com/package/context-repo-mcp)

Both hosted entrypoints expose all 29 tools. The `context-repo-mcp` v3 stdio
package bridges to the canonical hosted endpoint and dynamically exposes the
same tools, schemas, and result contract.

Run via `npx`:

```bash
npx -y context-repo-mcp
```

Cursor one-click install (deeplink):

```text
cursor://anysphere.cursor-deeplink/mcp/install?name=context-repo&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImNvbnRleHQtcmVwby1tY3AiXSwiZW52Ijp7IkNPTlRFWFRSRVBPX0FQSV9LRVkiOiIifX0=
```

Claude Desktop / generic MCP config:

```json
{
  "mcpServers": {
    "context-repo": {
      "command": "npx",
      "args": ["-y", "context-repo-mcp"],
      "env": { "CONTEXTREPO_API_KEY": "<gm_...>" }
    }
  }
}
```

### Tool Categories (29 Registrations)

#### User (1)

| Tool | Description |
|---|---|
| `get_user_info` | Authenticated user identity + permissions |

#### Prompts (7)

| Tool | Description |
|---|---|
| `search_prompts` | List / search prompts |
| `read_prompt` | Full prompt body + variables |
| `create_prompt` | New prompt |
| `update_prompt` | Edit (content edit → new version) |
| `delete_prompt` | Delete (irreversible) |
| `get_prompt_versions` | Version list with change logs and content previews up to 200 characters |
| `restore_prompt_version` | Roll back to a past version |

#### Documents (7)

| Tool | Description |
|---|---|
| `list_documents` | Paginated list |
| `get_document` | Document content up to the REST response limit plus revision, content hash, provenance, snapshot completeness, and ETag metadata; use Deep Search for targeted retrieval from large documents |
| `create_document` | New document (auto-embeds) |
| `update_document` | Safe edit with required `expectedRevision`, one atomic REST write, no-op detection, and compact acknowledgement |
| `delete_document` | Delete (irreversible) |
| `get_document_versions` | Version history |
| `restore_document_version` | Safe restore with required `expectedRevision`, one atomic REST write, compact acknowledgement, and partial-snapshot warning |

#### Collections (7)

| Tool | Description |
|---|---|
| `list_collections` | Paginated list |
| `get_collection` | Membership + metadata |
| `create_collection` | New collection |
| `update_collection` | Edit metadata |
| `delete_collection` | Delete an empty collection; remove all member items first, which does not delete the underlying prompts or documents |
| `add_to_collection` | Attach items |
| `remove_from_collection` | Detach items |

#### Catalog Search (1)

| Tool | Description |
|---|---|
| `find_items` | Semantic OR literal across prompts / documents / collections |

`find_items` accepts `query`, optional `type`, optional `semantic`, and
optional `tags`. It returns up to 10 matches per selected type. Semantic
results include scores; snippets appear only when available.

#### ChatGPT App compatibility — OpenAI Apps SDK Company Knowledge (2)

| Tool | Description |
|---|---|
| `search` | Flat citation-ready result set |
| `fetch` | Full prompt content, document content up to the REST response limit, or collection metadata plus up to 50 member items; use Deep Search for targeted retrieval from large documents |

#### Deep Search (3)

| Tool | Description |
|---|---|
| `deep_search` | Vector-similarity inside document chunks |
| `deep_read` | Single chunk with hierarchy metadata |
| `deep_expand` | Navigate up / down / next / previous / surrounding from a chunk |

#### Reasoning (1)

| Tool | Description |
|---|---|
| `reason` | Best-effort cited answer with citations and non-exhaustive limitations. Disagreements appear as ordinary cited statements in the answer. (read-only) |

### MCP Resources

- `contextrepo://openapi` — public OpenAPI 3.1 specification.
- `ui://search-results` — optional MCP Apps search-results UI, registered
  only when the server's MCP Apps feature flag is enabled.

## REST API (35 Operations Under /v1)

- **Spec** — [`/openapi.json`](https://contextrepo.com/openapi.json) (OpenAPI 3.1, JSON)
- **YAML** — [`/api/openapi.yaml`](https://contextrepo.com/api/openapi.yaml)
- **Catalog** — [`/.well-known/api-catalog`](https://contextrepo.com/.well-known/api-catalog) (RFC 9727 linkset)

### Tags

- `prompts`
- `documents`
- `collections`
- `search`
- `progressive-disclosure`
- `user`

### Operations

| Operation | Verb | Path | Success Status |
|---|---|---|---|
| `listCollections` | GET | `/v1/collections` | 200 |
| `createCollection` | POST | `/v1/collections` | 201 + `Location` |
| `getCollection` | GET | `/v1/collections/{id}` | 200 |
| `getCollectionItems` | GET | `/v1/collections/{id}/items` | 200 |
| `updateCollection` | PATCH | `/v1/collections/{id}` | 200 |
| `deleteCollection` | DELETE | `/v1/collections/{id}` | 200 + `{success,id}` |
| `addItemsToCollection` | POST | `/v1/collections/{id}/items` | 200 |
| `removeItemsFromCollection` | PUT | `/v1/collections/{id}/items` | 200 (PUT because DELETE-with-body is non-standard) |
| `listDocuments` | GET | `/v1/documents` | 200 |
| `createDocument` | POST | `/v1/documents` | 201 + `Location` |
| `getDocument` | GET | `/v1/documents/{id}` | 200 |
| `getDocumentCoordination` | GET | `/v1/documents/{id}/coordination` | 200 |
| `enableDocumentCoordination` | PUT | `/v1/documents/{id}/coordination` | 200 |
| `disableDocumentCoordination` | DELETE | `/v1/documents/{id}/coordination` | 200 |
| `operateDocumentLease` | POST | `/v1/documents/{id}/coordination/lease` | 200 |
| `refreshDocument` | POST | `/v1/documents/{id}/refresh` | 202 + `Location` |
| `getDocumentVersions` | GET | `/v1/documents/{id}/versions` | 200 |
| `updateDocument` | PATCH | `/v1/documents/{id}` | 200 |
| `deleteDocument` | DELETE | `/v1/documents/{id}` | 200 + `{success,id}` |
| `restoreDocumentVersion` | POST | `/v1/documents/{id}/restore` | 200 |
| `scrapeUrl` | POST | `/v1/documents/scrape` | 202 Accepted |
| `listPrompts` | GET | `/v1/prompts` | 200 |
| `createPrompt` | POST | `/v1/prompts` | 201 + `Location` |
| `getPrompt` | GET | `/v1/prompts/{id}` | 200 |
| `getPromptVersions` | GET | `/v1/prompts/{id}/versions` | 200 |
| `updatePrompt` | PATCH | `/v1/prompts/{id}` | 200 |
| `deletePrompt` | DELETE | `/v1/prompts/{id}` | 200 + `{success,id}` |
| `restorePromptVersion` | POST | `/v1/prompts/{id}/restore` | 200 |
| `search` | GET | `/v1/search` | 200 |
| `pdSearch` | POST | `/v1/pd/search` | 200 |
| `pdExpand` | POST | `/v1/pd/expand` | 200 |
| `pdRead` | GET | `/v1/pd/read/{chunkId}` | 200 |
| `pdCreateSession` | POST | `/v1/pd/session` | 201 |
| `reason` | POST | `/v1/reason` | 200 |
| `getMe` | GET | `/v1/user/me` | 200 |

### Canonical Document Revision Protocol

- MCP `update_document` and `restore_document_version` require
  `expectedRevision` from `get_document` or the latest successful document
  acknowledgement. Each invocation makes exactly one REST write with no
  preflight GET.
- On `REVISION_MISMATCH`, read again. If the intended state is already
  present, stop; otherwise reapply the change to the latest content and retry
  with its revision. Documents using `lease_required` managed editing must use
  the REST coordination workflow.
- The remaining protocol details in this section apply to raw REST clients.
- `GET /v1/documents/{id}` returns canonical `revision`,
  `contentHash`, and `lastChangedAt` metadata plus an `ETag`.
- PATCH and restore accept either `If-Match` or body `expectedRevision`.
  When both are supplied, their revisions must agree and the header's
  content hash is also checked. Preconditions and `Idempotency-Key`
  remain optional in standard mode. Reusing an idempotency key with the
  same request replays its receipt; reusing it for different bytes is
  rejected.
- Retry the identical operation with its original revision, key, payload,
  lease fields, and original precondition representation (`If-Match` or body
  `expectedRevision`). Do not replace the revision or key to recover an
  uncertain result. Matching receipts are retained for 24 hours from creation.
  Reconcile uncertain operations by reading the document and history before
  taking further action.
- Logical no-op writes do not create a revision. Update and restore
  return a compact acknowledgement containing `id`, `revision`,
  deprecated alias `currentVersion`, `contentHash`, `lastChangedAt`,
  and `noop`, with optional `warnings`.
- A completed receipt replay returns the same acknowledgement and sets
  `Idempotent-Replayed: true`.
- A restore from an incomplete historical snapshot preserves fields
  absent from that snapshot and returns
  `LEGACY_PARTIAL_SNAPSHOT` in `warnings`.

### Fenced Document Coordination

- `GET /v1/documents/{id}/coordination` reads the `standard` or
  `lease_required` policy, its fence, caller-visible lease state, and
  current revision metadata.
- `PUT /v1/documents/{id}/coordination` enables `lease_required`;
  `DELETE` returns to `standard`. Both require the exact current ETag
  in `If-Match`.
- `POST /v1/documents/{id}/coordination/lease` accepts `acquire`,
  `renew`, or `release` and always requires `Idempotency-Key`.
  `renew` and `release` also require `X-ContextRepo-Lease-Id` and
  `X-ContextRepo-Lease-Fence`.
- Managed PATCH and restore require either revision precondition above
  plus `Idempotency-Key`, `X-ContextRepo-Lease-Id`, and
  `X-ContextRepo-Lease-Fence`. Stale fences cannot write after a new
  lease is acquired.
- Refresh and coordination-policy operations retain their existing
  preconditions. Standard-mode refresh may omit `If-Match` and
  `Idempotency-Key`; managed refresh requires `If-Match`, the key, and
  both lease headers. Policy changes still require the exact current
  ETag in `If-Match`.

### Standard Envelopes

Single resource:

```json
{ "data": { } }
```

List resource:

```json
{
  "data": [],
  "pagination": { "cursor": "<opaque>", "hasMore": false }
}
```

Search:

```json
{
  "data": {
    "documents": [],
    "prompts": [],
    "collections": []
  },
  "meta": { "query": "<str>", "semantic": true, "latencyMs": 0 }
}
```

Delete (M-048):

```json
{ "success": true, "id": "<resourceId>" }
```

Error:

```json
{
  "error": {
    "code": 400,
    "message": "<str>",
    "details": null
  }
}
```

### Response Status Codes

| Code | Meaning |
|---|---|
| 200 | Success on GET / PATCH / search / DELETE (M-048) |
| 201 | Resource created |
| 202 | Scrape or source refresh accepted |
| 400 | Validation / malformed input |
| 402 | Plan required, feature not in plan, or allowance used up; see `error.reason` |
| 401 | Unauthenticated / verification failed |
| 403 | Insufficient permission scope |
| 404 | Not found |
| 409 | Lease conflict, fence mismatch, or idempotency conflict |
| 412 | Revision or ETag mismatch |
| 413 | Payload too large |
| 422 | Idempotency key reused with different inputs, or document cannot enter coordination |
| 428 | Required revision, idempotency, or lease precondition missing |
| 429 | Rate limit exceeded (with rate-limit headers) |
| 503 | The plan could not be confirmed; honor `Retry-After` |
| 500 | Internal error fallthrough |

## Examples

Synthetic identifiers (`doc_...`, `prm_...`, `gm_...`) are placeholders.
Send your own IDs and tokens at call time.

### REST — List Documents (Happy Path)

Request:

```http
GET /v1/documents?limit=20 HTTP/1.1
Host: contextrepo.com
Authorization: Bearer <session-jwt-or-oat_token>
Accept: application/json
```

Response (`200 OK`):

```json
{
  "data": [
    {
      "id": "doc_2yA3kQv7nP1xR8sD",
      "title": "Quarterly product strategy",
      "tags": ["strategy", "Q2"],
      "updatedAt": "2026-04-21T14:32:11.000Z"
    }
  ],
  "pagination": {
    "cursor": "eyJpZCI6ImRvY18yeUEza1F2N25QMXhSOHNEIn0=",
    "hasMore": true
  }
}
```

### REST — Create Prompt (201 + Location)

Request:

```http
POST /v1/prompts HTTP/1.1
Host: contextrepo.com
Authorization: API-Key gm_<publicId>_<secret>
Content-Type: application/json

{
  "title": "Summarize meeting transcript",
  "description": "Condense raw transcript into action items",
  "content": "Summarize the following transcript:\n${transcript}"
}
```

Response (`201 Created`):

```http
HTTP/1.1 201 Created
Location: /v1/prompts/prm_8Vb2nY4mZ6pQ9rT1
Content-Type: application/json

{
  "data": {
    "id": "prm_8Vb2nY4mZ6pQ9rT1",
    "title": "Summarize meeting transcript",
    "description": "Condense raw transcript into action items",
    "createdAt": "2026-04-27T09:14:55.000Z"
  }
}
```

### MCP — `find_items` Tool Call

JSON-RPC over the streamable-http transport at `/mcp`.

Request:

```json
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "find_items",
    "arguments": {
      "query": "incident response runbook",
      "type": "all",
      "semantic": true
    }
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "## Semantic Search Results for \"incident response runbook\"\n\n### Prompts (1)\n- **Post-incident review template** (id: prm_8Vb2nY4mZ6pQ9rT1, score: 0.74) - Run a structured review after an incident.\n\n### Documents (1)\n- **Incident response runbook v3** (id: doc_2yA3kQv7nP1xR8sD, score: 0.87)"
      }
    ],
    "structuredContent": {
      "data": {
        "prompts": [
          {
            "promptId": "prm_8Vb2nY4mZ6pQ9rT1",
            "title": "Post-incident review template",
            "description": "Run a structured review after an incident.",
            "tags": ["operations"],
            "score": 0.74
          }
        ],
        "documents": [
          {
            "documentId": "doc_2yA3kQv7nP1xR8sD",
            "title": "Incident response runbook v3",
            "tags": ["operations"],
            "score": 0.87
          }
        ],
        "collections": []
      },
      "meta": {
        "query": "incident response runbook",
        "semantic": true,
        "latencyMs": 42
      }
    }
  }
}
```

## Pricing

7-day free trial on the Pro and Pro Max plans.

| Plan | Monthly | Includes |
|---|---|---|
| **Pro** | $9.99 | ChatGPT App, Claude Desktop MCP, OAuth MCP Server, API key access, prompt and document version history, collections, 75+ upload file-format processing, semantic search, Chrome Extension |
| **Pro Max** | $19.99 | Everything in Pro at 2× the Reason and parse allowances, plus web scraping (500 scrape credits a month) |
| **Ultimate** | $99.99 | Everything in Pro at 10× the Reason and parse allowances, plus web scraping (2,500 scrape credits a month) |

Every plan limit is listed in `/pricing.md`.

Pricing source-of-truth: Clerk Billing dashboard. Live signup:
[contextrepo.com/pricing](https://contextrepo.com/pricing).

## Integrations (Named, First-Party)

- Claude Desktop (MCP)
- Cursor (MCP, one-click deeplink install)
- ChatGPT App (OAuth)
- VS Code (Copilot, MCP)
- Grok Bot (MCP)
- Factory (MCP)
- Amp (MCP)
- Chrome Extension (Firecrawl-based web capture)
- REST API client (Bearer / API-key)
- [`context-repo-mcp`](https://www.npmjs.com/package/context-repo-mcp) npm package (standalone CLI / programmatic)

Other clients can connect when they support authenticated Streamable HTTP or
can launch the local stdio bridge with a scoped Context Repo API key.

## Error Handling Reference

REST failures generally use this JSON envelope:

```json
{
  "error": {
    "code": 400,
    "message": "Title is required when creating a prompt",
    "details": { "field": "title" }
  }
}
```

MCP tool failures use MCP tool-result semantics: a text content item plus
`isError: true`. Revision-protocol failures for document updates and restores
can also include validated structured error details. Do not assume every MCP
error contains the REST envelope.

Common error scenarios:

- **400** — Missing required field, invalid Convex ID, schema validation
- **401** — Missing `Authorization` header, token verification failed
- **403** — Token / API-key lacks the required scope for this operation
  (writes need `prompts.write` or `documents.write`; scrape is covered
  by `documents.write`)
- **402**: the plan does not allow the request. `error.reason` is
  `PLAN_REQUIRED`, `FEATURE_NOT_IN_PLAN` (with `details.plansWithFeature`),
  or `QUOTA_EXCEEDED` (with `details.meter`, `limit`, `used`, and
  `resetsAt`). A 402 is never stored under an `Idempotency-Key`, so the
  same key works after an upgrade. `GET /v1/user/me` returns the current
  plan and usage.
- **404** — Resource not found OR resource not owned by the authenticated
  user (resources are workspace-scoped; cross-user access is impossible
  and surfaces as 404, not 403)
- **413** — Body too large; prompt and direct document content fields are capped at 900,000 UTF-8 bytes, and the whole request body at 2,000,000 bytes
- **429** — Rate limit exceeded; consult headers and `Retry-After`
- **500** — Unexpected handler error; transient — retry idempotently if safe
- **503**: `ENTITLEMENT_UNAVAILABLE`, the plan could not be confirmed; honor `Retry-After`

## Design Constraints Agents Should Know

- **Vector dimension: 1536 (text-embedding-3-small).** Context Repo
  generates stored-content and query embeddings; public REST and MCP
  inputs do not accept caller-supplied vectors.
- **Prompt and direct document content cap: 900,000 UTF-8 bytes per
  field.** The whole request body is capped at 2,000,000 bytes. The
  separate 2,000,000-byte REST wire-field cap applies when serializing
  document reads, not to create or update input fields.
- **Prompts store `${variable}` placeholders verbatim.** Interpolation
  is the client's responsibility at call time.
- **Pagination cursors are opaque base64 strings;** do not parse them.
- **Default page size is 20; max is 100.**
- **DELETE returns 200 + `{success,id}`, not 204.** Intentional for
  MCP-client compatibility (M-048).
- **List endpoints return at most 100 items per page;** agents that
  need full enumeration must follow `pagination.cursor` until
  `hasMore=false`.

## Contact

- Email: [support@contextrepo.com](mailto:support@contextrepo.com)
- X: [x.com/contextrepo](https://x.com/contextrepo)
- GitHub: [Gitmaxd/context-repo-mcp](https://github.com/Gitmaxd/context-repo-mcp)
- Docs: [contextrepo.com/docs](https://contextrepo.com/docs)
- Status: [contextrepo.com/status](https://contextrepo.com/status)

Last verified: 2026-10-08
