Guides

Connecting your agent

How coding agents read Carrick through local hooks, the hosted MCP index and editor diagnostics, with setup for each MCP client.

Coding agents interact with Carrick through three distinct channels:

  1. Hosted MCP server: Answers queries on demand at https://api.carrick.tools/mcp across your entire organisation (including repositories that are not checked out locally), providing semantic intent search, cross-service call graphs, caller lookups, and compiler-resolved endpoint types.
  2. Local hooks: Deliver instant feedback in Claude Code and Codex directly in the same turn as a file edit without invoking remote models, reporting routes, calls, local counterparts, and broken contracts.
  3. Editor diagnostics: Surface contract drift and type mismatch errors in the IDE Problems panel for editor-integrated agents.

MCP client configuration

The Carrick MCP server runs over HTTP transport at https://api.carrick.tools/mcp. The recommended way to connect is npm install -g carrick && carrick init, which is the quickstart’s step 3. It connects Claude Code and writes the hooks, task skills and AGENTS.md section that prompt your agent to use Carrick. The sections below are the manual path: use them for a client carrick init does not configure, or where you cannot run the CLI. Adding only the MCP server installs none of the hooks, skills or instructions.

carrick init adds the Claude Code entry, and the Cursor, Windsurf and VS Code entries when you accept them. An entry it writes carries an X-Carrick-Install-Id header, a UUID generated once, kept in ~/.carrick/install-id, and sent with every MCP call so a slow session can be told apart from a busy one. It identifies neither the machine nor the person. carrick remove deletes it, and the next carrick init generates another. A carrick entry that already exists is left exactly as it is, with or without the header.

Claude Code

carrick init runs this for you. To add the server without the CLI:

Discovery:

claude mcp add --scope user --transport http carrick https://api.carrick.tools/mcp

On the first tool call, Claude Code opens the browser OAuth consent flow. Approving the request stores a workspace-level credential that persists across sessions. The --scope user flag makes the server available across all local projects.

Manual key fallback:

claude mcp add --scope user --transport http carrick https://api.carrick.tools/mcp \
  --header "Authorization: Bearer <YOUR_MCP_KEY>"

Cursor

Discovery:

Add the following to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "carrick": {
      "url": "https://api.carrick.tools/mcp"
    }
  }
}

Restart Cursor. The first tool invocation opens the browser authorization screen.

Manual key fallback:

{
  "mcpServers": {
    "carrick": {
      "url": "https://api.carrick.tools/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_MCP_KEY>"
      }
    }
  }
}

Windsurf

Discovery:

Add the following to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "carrick": {
      "serverUrl": "https://api.carrick.tools/mcp"
    }
  }
}

Manual key fallback:

{
  "mcpServers": {
    "carrick": {
      "serverUrl": "https://api.carrick.tools/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_MCP_KEY>"
      }
    }
  }
}

VS Code

Discovery:

Save the configuration in your user mcp.json file:

  • macOS: ~/Library/Application Support/Code/User/mcp.json
  • Linux: ~/.config/Code/User/mcp.json
  • Windows: %APPDATA%\Code\User\mcp.json
{
  "servers": {
    "carrick": {
      "type": "http",
      "url": "https://api.carrick.tools/mcp"
    }
  }
}

For manual keys, add an Authorization: Bearer <YOUR_MCP_KEY> header as supported by your VS Code configuration.

Codex

carrick init writes the Codex hooks but does not add the MCP server, so this step is always manual for Codex. After carrick init, open codex in the folder once and choose to trust the project’s hooks. Only the Codex terminal app asks, and until you do, Codex skips the hooks without saying so.

Discovery:

codex mcp add carrick --url https://api.carrick.tools/mcp
codex mcp login carrick

Manual key fallback:

export CARRICK_MCP_TOKEN='<YOUR_MCP_KEY>'
codex mcp add carrick --url https://api.carrick.tools/mcp \
  --bearer-token-env-var CARRICK_MCP_TOKEN

Other MCP clients

For clients supporting HTTP transport MCP servers, target https://api.carrick.tools/mcp directly with an Authorization: Bearer <YOUR_MCP_KEY> header. For clients that require stdio transport, run a standard HTTP-to-stdio MCP bridge.

Agent usage rules

carrick init writes a short section into the folder’s AGENTS.md that points your agent to the rules in .carrick/RULES.md. Those rules tell the agent to consult Carrick before it writes a helper, changes a shared shape, or calls another service. Each file the agent edits is checked in the background, and the answer arrives with a later tool call or the next turn, so the agent does not run or wait for a check. If you connect without the CLI, add the following section to your repository’s AGENTS.md or CLAUDE.md:

## Carrick: use it while you work, not only at the end

This workspace is indexed by Carrick. The `mcp__carrick__*` tools answer questions about code outside the file you are editing more completely than grep. Pass `project` or `repo` on every Carrick call.

1. Before you write a new function, helper or utility, call `search_by_intent` (or `find_similar`) with a plain-English description of what it does. If something in any package already does the job, import it and call it instead of writing your own.
2. Before you change a route, a request or response shape, an event payload or an exported function, call `get_operation` or `get_callers`, and update or explicitly clear every consumer it lists, in every repository.
3. Before you write code that calls another service's endpoint or handles its event, call `get_endpoint_types` (or `get_contract_pair`) and use the real request and response types it returns.
4. Use grep and Read to confirm and to read code once Carrick has told you where to look.
5. In your final summary, say what Carrick found and what you changed because of it.

Carrick is read-only; data reflects each repo's last scan.

Local channels and coordination

Carrick coordinates local feedback mechanisms so you receive consistent diagnostics without duplicate output:

  • Claude Code hooks: carrick init registers PostToolUse hooks for file edits (post-edit), file reads (post-read) and shell commands (post-bash), a SessionStart hook (session-start), a Stop hook (stop) and a UserPromptSubmit hook (user-prompt). The post-edit hook returns immediate diagnostics in the same turn as an edit. The first time a file is opened in a session, the post-read hook surfaces its dependencies, such as function callers, type usages, and counterpart routes and calls. No hook waits for a running check: its result arrives at the next hook event, and stop names the files still being checked.
  • Codex hooks: carrick init writes .codex/hooks.json with a SessionStart hook (session-start), a PostToolUse hook on apply_patch (post-edit) and a UserPromptSubmit hook (user-prompt). The UserPromptSubmit hook reports once, on the next prompt after the edit, because Codex’s Stop event cannot add context for the model.
  • Language server: To run the LSP server directly in Claude Code, install the plugin from the Carrick marketplace:
    claude plugin marketplace add carrick-tools/carrick
    claude plugin install carrick@carrick
    Or load the bundled plugin for one session:
    claude --plugin-dir "$(npm root -g)/carrick/plugin"
    When the post-edit hook is active, the language server suppresses duplicate terminal messages.
  • Environment override: Set CARRICK_CHANNEL=off to disable all local hook and language server reporting.

Terminal agents without MCP support can execute carrick check <file> --json to inspect contract verdicts directly.

Authentication and token management

Carrick authenticates CLI tools and MCP clients independently:

  • CLI Authentication: carrick login authenticates the local CLI to download and synchronise index data.
  • MCP Client Authentication: Agent clients authenticate via OAuth browser consent or manual bearer tokens to query hosted tools.

Both authentication methods grant read-only access scoped to your Carrick workspace. Agents cannot modify index records, trigger scans, or alter organisation settings.

Manage active API keys and tokens on the Account page. Revoking a token disables access within one minute.

  • Task skills covers the five specialised workflows installed for coding agents.
  • In your editor covers IDE extensions and Problems panel integration.
  • Quickstart provides the end-to-end onboarding walkthrough.
  • MCP tools contains the complete reference for hosted tools and schemas.