# Code index MCP server

The code index MCP server lets a coding agent, such as Claude Code, read the same code index the Code Review reviewers read: where a name is declared, who calls it, what it calls, what reads a constant, and the tables your code keeps data in. This page is for developers who want their agent to look code up the way a review does, and for the admins who give them access.

![Your coding agent, such as Claude Code, added with claude mcp add, connects over MCP to the hosted code index and signs in with a browser login an admin approves or a token from the portal. The code index offers twelve tools in three groups. Snapshots: snapshot_status, list_snapshots, index_commit and index_change, which indexes a change you haven't pushed. Code: search_symbol, find_callers, find_readers, find_implementations, find_callees and file_symbols. Data model: list_entities and describe_entity. Every lookup reads your repositories at an exact commit, from the same index the reviewers read.](/illustrations/mcp-code-index.svg)

> **Note:** The code index MCP server is in a trial. Solidafy turns it on per organization. If you don't see an **MCP tokens** tab on **Settings** > **Code Review**, ask your Solidafy contact.

MCP (Model Context Protocol) is the standard way AI assistants call tools. Every tool here reads; the only ones that change anything are `index_commit` and `index_change`, and all they change is what the index reads next.

The server's address is:

```text
https://index.admin.solidafy.com/mcp
```

It's a remote MCP server over HTTP: there's nothing to install, and your coding agent connects to it directly.

## What it reads

The index holds your repositories at exact commits. Each one indexed is a snapshot: a repository, named `owner/name`, at one commit. Every lookup reads one snapshot. Your agent can name the commit by its full SHA, or by a branch: its name, such as `main`, `origin/main`, or `HEAD` for your default branch. A branch is read at its latest commit, and every answer says which commit that was, so your agent can keep reading the same one. When a branch's latest commit isn't indexed yet, the answer says so and names the newest commit of that branch that is, rather than reading another one without saying. A short SHA isn't accepted.

Only repositories the Solidafy Code Review GitHub App is installed on for your organization can be read, and everything is read as your organization, so you never see another organization's code.

A commit your reviews already looked at, the newest commits on your default branch and the head of every open pull request are usually indexed already. For any other commit, your agent can ask for it with `index_commit`. For code you haven't pushed at all, your agent can [upload the change](#asking-about-changes-you-haven-t-pushed) and read that instead.

## Connecting a coding agent

There are two ways to connect: a browser login, or a token you create in the portal. The browser login needs no token at all, so start there unless your agent runs somewhere without a browser.

### Claude Code

```bash
claude mcp add --transport http solidafy-index https://index.admin.solidafy.com/mcp
```

Then run `/mcp` in Claude Code, pick `solidafy-index` and choose to authenticate. Claude Code opens the [browser login](#browser-login).

Claude Code loads the code index tools as soon as a session starts, so your agent has them from its first step without searching for them.

### Codex

```bash
codex mcp add solidafy-index --url https://index.admin.solidafy.com/mcp
codex mcp login solidafy-index
```

`codex mcp login` opens the [browser login](#browser-login).

### Cursor

Add the server to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for every project:

```json
{
  "mcpServers": {
    "solidafy-index": {
      "url": "https://index.admin.solidafy.com/mcp"
    }
  }
}
```

When Cursor first connects to the server, it opens the [browser login](#browser-login).

### Other MCP clients

Any client that speaks MCP over HTTP works: point it at `https://index.admin.solidafy.com/mcp`. A client that supports the MCP login flow opens the browser login by itself; any other one sends a [token from the portal](#a-token-from-the-portal) as a bearer token in the `Authorization` header.

### Browser login

When your agent first connects without a token, it opens a browser at the Solidafy portal, which asks you to sign in if you haven't, then whether to let your agent, under the name it gave itself, read your code index:

1. Check the host the page says access will be sent to, and only go on if you started this from a coding tool on that host.
2. Pick the **Organization** whose code index the agent may read.
3. Click **Approve**.

The browser then hands back to your agent, which is connected from its next request. Approving takes an organization admin, in an organization that has the trial. If none of your organizations qualifies, the page says so.

The access a browser login gives lasts 30 days. After that the agent's requests are refused, and you sign in again the same way.

### A token from the portal

On **Settings** > **Code Review** > **MCP tokens**:

1. Under **Create a token**, give it a **Token name** (for example the machine it's for) and pick **Expires after**: 7, 30 or 90 days. The default is 30.
2. Click **Create token**.
3. Copy the token now. It's shown only this once and can't be retrieved again.

The page also shows the command that adds the server to Claude Code with your token filled in. With a token, the setup for each client is:

```bash
# Claude Code
claude mcp add --transport http solidafy-index https://index.admin.solidafy.com/mcp \
  --header "Authorization: Bearer <token>"

# Codex: reads the token from the environment variable you name
export SOLIDAFY_INDEX_TOKEN=<token>
codex mcp add solidafy-index --url https://index.admin.solidafy.com/mcp \
  --bearer-token-env-var SOLIDAFY_INDEX_TOKEN
```

For Cursor, add the token to the server's entry in `mcp.json`:

```json
{
  "mcpServers": {
    "solidafy-index": {
      "url": "https://index.admin.solidafy.com/mcp",
      "headers": {
        "Authorization": "Bearer <token>"
      }
    }
  }
}
```

A configuration file with a token in it holds the token in plain text, so keep it out of git. Any other MCP client works the same way: point it at `https://index.admin.solidafy.com/mcp` and send the token as a bearer token in the `Authorization` header.

### Managing tokens

The **MCP tokens** tab lists every token of your organization with who created it and how: **Created here** for a token made on the page, or **Browser login** with the name the coding agent gave itself. Organization owners and admins create and revoke tokens; other members who use Code Review can see the list. **Revoke** cuts a token off on the agent's next request.

## Tools

| Tool | What it answers |
| --- | --- |
| `snapshot_status` | Whether a repository is indexed at a commit: ready, building (try again shortly) or absent. |
| `list_snapshots` | The commits of a repository the index holds or has been asked for, newest first, each with its state, and the head of your default branch. |
| `index_commit` | Asks for a commit to be indexed and says where it stands: ready, building or queued. |
| `index_change` | Indexes a change you haven't pushed, sent as a `git diff` over an indexed commit, and answers an id every other tool reads in place of a commit. |
| `search_symbol` | A name's declarations with their signatures and locations, and around the first of them what it calls, who calls it and who reads it. Takes a bare name, a qualified `Type.member`, or a name inside a declaration or call. |
| `find_callers` | Every caller of a name, a page at a time, each saying whether it was matched by the type it's called through or by name alone. |
| `find_readers` | Every definition that reads a name without calling it: what depends on a constant, a limit, a timeout or a flag. |
| `find_implementations` | The types that implement an interface or trait, or extend a class. |
| `find_callees` | What the definition at a path and line calls, and the declarations each call resolves to. |
| `file_symbols` | Every declaration in one file, and whether the file is indexed, unreadable or absent from that commit. |
| `list_entities` | The tables, collections and containers of the repository's [data model](/docs/code-review/overview#data-model), a page at a time, each with its database. |
| `describe_entity` | One table, collection or container by any name your code uses for it: its columns with types, keys, indexes, relations, row-level security, and the code reading and writing it. |

A few things help an agent get good answers:

- **Pass the file you're working on.** `search_symbol` takes `from_file`, the path of the file the calling code is in. Declarations a call from that file can reach, in its own language family, are then listed first. TypeScript, JavaScript and Vue count as one family, Java and Kotlin as another, Swift and Objective-C as a third.
- **A text search isn't proof.** When a query names nothing, the answer suggests a text search instead, and zero hits from a text search don't mean a name is absent: it may be spelled differently or built at run time.
- **Callers say how they were matched.** A caller matched by the type it's called through is certain; one matched by name alone is a candidate to check. Callers in test files come after the rest.

## Asking for a commit to be indexed

`index_commit` answers at once with where the commit stands, and asking again for the same commit files nothing new. Requests wait behind every review, so a commit can take minutes: poll `snapshot_status` or `list_snapshots` until it's ready.

Your organization can file 30 index requests an hour through the MCP server, refused ones included. A repository the app can't read for your organization, and a commit the repository doesn't have, are refused the same way. A commit that's neither among the newest on your default branch nor the head of an open pull request is kept for at least an hour after it's indexed, not for good.

## Asking about changes you haven't pushed

The index reads commits on GitHub, so on its own it knows nothing about the code your agent is in the middle of writing. `index_change` closes that gap: your agent sends its changes as a `git diff` over a commit the index already has, gets back an id, and passes that id as the commit to every other tool. `find_callers`, `search_symbol`, `file_symbols`, `describe_entity` and the rest then answer about your code with your changes in it, so your agent can check who calls a function it just changed before you push.

A small change is ready in seconds, because only the files it touches are read; everything else comes from the commit it was made over.

### From Claude Code, Codex or Cursor

Your agent does this itself, following the tool's own description: ask it to look something up in the code it has changed, and it makes the diff, calls `index_change` and reads at the id it gets back. The diff it makes, from the repository, is:

```bash
git fetch
git add -N .
git diff --full-index --binary --no-color --no-ext-diff \
  --src-prefix=a/ --dst-prefix=b/ origin/main
```

It passes that output as `patch`, with the repository as `repo` and the commit the diff was made against as `base`: a full SHA, or a branch such as `main` or `origin/main`, read at its latest commit on GitHub. That's why the fetch comes first: the diff has to be made against the same commit the index reads for that branch.

A few things to know about the diff:

- **New files need `git add -N` first.** `git diff` leaves out files git doesn't track yet. `git add -N .` tells git about them without staging their contents, so the diff includes them.
- **It covers everything since the base.** A diff against `origin/main` holds your local commits as well as the edits you haven't committed.
- **The base must be fully indexed.** If it isn't indexed, is still being indexed, or its index isn't complete, the change is refused with what to do instead: ask for the commit with `index_commit`, or take the newest ready commit from `list_snapshots`. When the base is a branch whose latest commit isn't indexed yet, the answer names that branch's newest indexed commit, so you can make the diff against that commit instead.

### Posting the diff with your token

A diff your agent copies into a tool call can be at most 48 KiB, and every byte of it is text the model has to write out. For a bigger change, or from a script, post the diff straight to the server with a [token from the portal](#a-token-from-the-portal) instead, so only the id it answers passes through your agent:

```bash
git fetch
git add -N .
BASE=$(git rev-parse origin/main)
git diff --full-index --binary --no-color --no-ext-diff \
  --src-prefix=a/ --dst-prefix=b/ "$BASE" > change.patch
jq -n --arg repo your-org/your-repo --arg base "$BASE" --rawfile patch change.patch \
  '{repo: $repo, base: $base, patch: $patch}' > change.json
curl -sS -X POST https://index.admin.solidafy.com/mcp/local-changes \
  -H "Authorization: Bearer $SOLIDAFY_INDEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data @change.json
```

Here `base` is a full SHA or a branch, the same as for the tool; the example uses the SHA so the diff and the base are certain to name the same commit. The answer is the same as the tool's: the `id`, the `base` it was read over, `changed_paths`, how many files it `parsed`, and `state`, which is `indexed` when this call indexed the change and `present` when it was already there. When `base` named a branch, the answer also says which `branch`.

### Limits

- A change can touch at most 1,000 paths, and its diff can be at most 4 MiB (48 KiB through the `index_change` tool). A bigger change belongs on a pushed branch, which the index reads from GitHub.
- A binary file, or one too large to read, is recorded as unreadable rather than left out, the same as in a pushed commit.
- Your organization can upload 120 changes an hour. Sending the same change again over the same base answers the same id at once, with `state` `present`, and doesn't count.
- A change is kept in your organization's index for at least an hour after it's indexed, and then deleted. After you edit your code, send the new diff: it gets a new id, and the old one ages out. Only your organization can read it, and `list_snapshots` lists commits only, never an uploaded change.

## Related

- The tools the [Review Agents app](/docs/code-review/review-agents-app#asking-from-an-ai-assistant) offers in AI assistants answer at the repository level (how reviews went, the pull requests reviewed, the supply chain). This server answers about the code itself.
- [AI agents and MCP](/docs/cli/ai-agents) covers Solidafy's main MCP server for the data platform.
