Skip to Content
GitDBDocs
MCP

Connect your AI agent

Connect Claude Code, Codex, Cursor, Gemini CLI, VS Code, or Windsurf to a GitDB repository over MCP with a personal access token.

GitDB hosts an MCP server for your repositories. Any agent that can talk to a remote MCP server connects to it directly, with nothing to install: you give it the server URL and your personal access token, and name the repository to work on.

Before you start

You need:

  • A gitdb.net account. Your agent can create a repository over MCP (gitdb_create_repo), or work in one you can already access.
  • A personal access token (step 1 below).
  • An MCP client, such as Claude Code, Codex, Cursor, Gemini CLI, VS Code, or Windsurf.

Connection details

SettingValue
Server URLhttps://mcp.gitdb.net/mcp
TransportHTTP (Streamable HTTP)
Authorization headerBearer followed by your personal access token
X-Gitdb-Repo headerThe repository to work on, written as org/repo

Each connection has a default repository, the one X-Gitdb-Repo names. Any single tool call can work on another repository your token can access by passing a repo argument, written as org/repo:

  • If your account can access exactly one repository, X-Gitdb-Repo is optional. Setting it anyway keeps the connection working on that repository after you gain access to a second one.
  • If your account can access more than one repository, or none yet, a connection without X-Gitdb-Repo still connects with just your token. In it, your agent can list your organizations and the repositories your token can access (gitdb_list_repos), create a repository (gitdb_create_repo), and call any other tool with repo naming one of those repositories. A tool called without repo answers repo_selection_required with the repositories you can choose from.
  • A call's repo overrides the connection's repository for that call only. A repository your token can't access is refused with code forbidden, and so is any repo on a connection that reads a public repository you aren't a member of — reconnect naming the repository instead. When an answer carries a next, it keeps the repo, so calling again with next as is stays on the same repository.
  • To work with several repositories, pass repo on each call from one connection, or add one server entry per repository, each with its own name and its own X-Gitdb-Repo value. One gitdb_batch can mix repositories of one organization, not of several.

If your client can't send custom headers other than Authorization, add the repository to the URL instead: https://mcp.gitdb.net/mcp?repo=org/repo. Use one method or the other. If the header and the URL name different repositories, the connection is refused.

Staged changes are kept per token: each personal access token stages into its own space, apart from your other tokens' staged changes, and a client that sends the X-GitDB-Session-Id and X-GitDB-Thread-Id headers gets a separate space for each session and thread it names. An agent linked to your account (one signed in to GitDB with OAuth, or one you created as an agent) stages per agent instead: all of its tokens share its space, so what it staged is still there after its token is rotated. If you can't find changes you staged with an older or revoked token, contact support.

Step 1: Create a personal access token

  1. Sign in at gitdb.net and open Settings → Personal access tokens (gitdb.net/settings/tokens).
  2. Click Generate new token.
  3. Give the token a name that tells you which agent uses it.
  4. Choose scopes:
    • repo:read covers every tool that reads: code, history, pull requests, checks, gitdb_list_repos, and memory recall. git:read covers only the code and history reads.
    • Add repo:write if the agent should also write: stage and commit changes, create or delete branches, create tags, merge branches, open, review, merge, or close pull requests, save or forget memories, or create repositories. git:write covers staging, committing, branches, tags, and merges, but not pull requests, memories, or creating repositories.
    • Each tool checks these scopes. A call they don't cover is refused with insufficient_scope, naming the scope it needs, and your agent's tool list leaves out the tools it can't call. repo:write includes repo:read, and git:write includes git:read. A token with only user:read can't use the repository tools.
    • checks:write grants no MCP tools: it only lets a CI job post check statuses through the REST API's /checks/report, so an agent doesn't need it.
  5. Choose an expiration and generate the token.
  6. Copy the token right away. You will not be able to see it again. Personal access tokens start with gdb_.

The token acts with your permissions. It can reach the repositories your account can reach, and it can write only where your organization role allows writing. Treat it like a password. If it's ever exposed, revoke it on the same settings page and generate a new one.

The examples below read the token from an environment variable named GITDB_TOKEN, so the token never appears in a config file. To set it for your current terminal session on macOS or Linux, run this and paste the token when prompted (nothing is echoed):

read -rs GITDB_TOKEN && export GITDB_TOKEN

On Windows, the equivalent in PowerShell 7.1 or later shows asterisks in place of what you type:

$env:GITDB_TOKEN = Read-Host -MaskInput

The variable must be visible to the program that runs your agent. You can also paste the token in place of the variable reference in a config file. If you do, keep that file out of version control.

The configuration below is the same on Windows, macOS, and Linux, with two translations for Windows. A path starting with ~/ is in your user profile folder, C:\Users\<name>. And in commands you type yourself, write the variable the way your shell expects — $env:GITDB_TOKEN in PowerShell, %GITDB_TOKEN% in Command Prompt — on a single line: the \ line breaks in the examples are POSIX shell syntax. A variable reference inside a config file is read by the tool itself, not by your shell, so it stays as written on every platform.

Step 2: Add GitDB to your agent

In every example, replace acme/web-app with your own organization and repository.

Claude Code

Add the server from your project directory:

claude mcp add --transport http gitdb https://mcp.gitdb.net/mcp \
  --header "Authorization: Bearer $GITDB_TOKEN" \
  --header "X-Gitdb-Repo: acme/web-app"

Your shell fills in the token when you run the command. Claude Code saves the server for the current project.

If you have no local repository — your agent works on the GitDB-hosted repository directly — or you want GitDB in every project, add the server at user scope instead. Run from any directory:

claude mcp add --scope user --transport http gitdb https://mcp.gitdb.net/mcp \
  --header "Authorization: Bearer $GITDB_TOKEN" \
  --header "X-Gitdb-Repo: acme/web-app"

User scope is saved in the ~/.claude.json file in your home directory and loads in every Claude Code session, whatever directory you start it from. Don't put a .mcp.json file in the ~/.claude/ folder — Claude Code reads .mcp.json only from a project root and ignores it there. If the same server name exists in several scopes, the project definition wins over the user one.

To share the setup with your team, commit a .mcp.json file to the project root instead. Each teammate then sets their own GITDB_TOKEN:

{
  "mcpServers": {
    "gitdb": {
      "type": "http",
      "url": "https://mcp.gitdb.net/mcp",
      "headers": {
        "Authorization": "Bearer ${GITDB_TOKEN}",
        "X-Gitdb-Repo": "acme/web-app"
      }
    }
  }
}

Codex CLI

Codex reads MCP servers from ~/.codex/config.toml, so one entry works in every directory you run Codex from — with or without a local repository. Add:

[mcp_servers.gitdb]
url = "https://mcp.gitdb.net/mcp"
bearer_token_env_var = "GITDB_TOKEN"
http_headers = { "X-Gitdb-Repo" = "acme/web-app" }

bearer_token_env_var tells Codex to read the token from the GITDB_TOKEN environment variable and send it as the Authorization header, so the token never sits in the file. You can also register the server from the command line. codex mcp add can't set custom headers, so this form names the repository in the URL instead:

codex mcp add gitdb --url "https://mcp.gitdb.net/mcp?repo=acme/web-app" \
  --bearer-token-env-var GITDB_TOKEN

Both write the same global file. In a project Codex trusts, a .codex/config.toml in the project root can hold a project-specific entry instead.

Cursor

Add the server to ~/.cursor/mcp.json to use it in every project, or to .cursor/mcp.json in a project root to use it in that project only:

{
  "mcpServers": {
    "gitdb": {
      "url": "https://mcp.gitdb.net/mcp",
      "headers": {
        "Authorization": "Bearer ${env:GITDB_TOKEN}",
        "X-Gitdb-Repo": "acme/web-app"
      }
    }
  }
}

Gemini CLI

Add the server at user scope, so it works in every directory. Without -s user, Gemini CLI saves the server to the current project's .gemini/settings.json instead:

gemini mcp add -s user -t http gitdb https://mcp.gitdb.net/mcp \
  -H "Authorization: Bearer $GITDB_TOKEN" \
  -H "X-Gitdb-Repo: acme/web-app"

Your shell fills in the token when you run the command, and the server is saved to ~/.gemini/settings.json. To edit that file yourself, the entry looks like this — note httpUrl, Gemini CLI's field for a Streamable HTTP server (url means an SSE server there), and that Gemini CLI expands environment variables in the file's string values when it loads them:

{
  "mcpServers": {
    "gitdb": {
      "httpUrl": "https://mcp.gitdb.net/mcp",
      "headers": {
        "Authorization": "Bearer $GITDB_TOKEN",
        "X-Gitdb-Repo": "acme/web-app"
      }
    }
  }
}

VS Code (GitHub Copilot)

To use GitDB in every workspace, add it to your user configuration: run MCP: Open User Configuration from the Command Palette, and add:

{
  "servers": {
    "gitdb": {
      "type": "http",
      "url": "https://mcp.gitdb.net/mcp",
      "headers": {
        "Authorization": "Bearer ${input:gitdb-token}",
        "X-Gitdb-Repo": "acme/web-app"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "gitdb-token",
      "description": "GitDB personal access token",
      "password": true
    }
  ]
}

VS Code's mcp.json uses a servers key, not mcpServers. The ${input:gitdb-token} reference makes VS Code prompt you for the token rather than keeping it in the file. For a single workspace instead, put the same JSON in .vscode/mcp.json in the workspace folder.

Windsurf (now Devin Desktop)

Open the MCP config file from the Cascade panel: click the ... (Actions) menu at the top right, then click Open MCP config file in the MCPs section. On macOS and Linux the file is ~/.config/devin/mcp_config.json; on Windows it's %APPDATA%\devin\mcp_config.json. Add:

{
  "mcpServers": {
    "gitdb": {
      "serverUrl": "https://mcp.gitdb.net/mcp",
      "headers": {
        "Authorization": "Bearer ${env:GITDB_TOKEN}",
        "X-Gitdb-Repo": "acme/web-app"
      }
    }
  }
}

Windsurf names the URL field serverUrl, not url.

Other MCP clients

Any client that supports remote MCP servers over Streamable HTTP with custom request headers can connect using the connection details above.

Step 3: Verify the connection

  1. Confirm that your client sees the server:
    • Claude Code: run /mcp in a session. gitdb should show as connected.
    • Codex: run codex mcp list in a terminal, or /mcp inside a session. gitdb should be listed.
    • Cursor: in Cursor's MCP settings, check that gitdb is enabled and lists its tools.
    • Gemini CLI: run /mcp in a session. gitdb should be listed with its tools.
    • VS Code: run MCP: List Servers from the Command Palette. gitdb should be listed; select it to see its status and output.
    • Windsurf: in the MCPs section of the Cascade panel, check that gitdb is listed.
  2. Ask your agent: "List the branches and tags in this repository."

The agent calls gitdb_list_refs and replies with your repository's branches and tags. That confirms your token and your repository selection work. gitdb_list_refs is a standard tool: on a paid plan it isn't counted, and on the free plan it uses one of your fast calls. See MCP tools for everything your agent can do.

Fast calls, premium ops, and the 5-hour window

  • Every tool is standard (Git, file, grep, commit, branch, pull request, and staging tools) or premium (AST code intelligence, semantic search, and agent memory). See MCP tools for how the classes work.
  • On a paid plan (Pro, Max, Ultra), standard tools are unmetered: they're never counted and always run at full speed. Each premium tool call counts as one premium op against your plan's premium allowance for the current 5-hour window.
  • On the free plan, each standard tool call uses one of your fast calls for the window and runs at full speed. When the fast calls are used up, standard tools keep working at reduced speed until the window resets — they're never refused for running out. With agent-ops credits and spending on, they stay at full speed instead. Premium tools — AST code intelligence, semantic search, and agent memory — run on credits from the first call; the 7-day Pro trial or a paid plan includes them. See Free plan: fast calls and reduced speed.
  • Calls draw on the account that owns the connected repository — your personal account, or an organization. In a Team organization, there's no window: every member's calls are paid from the organization's prepaid agent-ops credits, and a call no credit can pay for isn't run and returns code CREDITS_REQUIRED (see Troubleshooting). On Enterprise, there's no window either — standard tools are unmetered and premium calls are billed to the enterprise's contract as usage credits (see below).
  • The window opens with the first call your plan counts and lasts 5 hours. When it ends, the next counted call opens a fresh window with the full allowance. How many premium ops you get per window depends on your plan; see gitdb.net/pricing.
  • Connecting, reconnecting, and listing the available tools don't count.
  • A tool refused because your plan doesn't include its feature doesn't count either.
  • Git clones, fetches, and pushes never count. Your repository stays fully usable over Git at all times; see When your fast calls or premium allowance run out.
  • When a paid plan's premium allowance runs out, the connection stays open and standard tools keep working at full speed. Premium tools are refused without running until the window resets, until you upgrade to a plan with a larger allowance, or — within about two minutes — once your organization has agent-ops credits and you have turned credit spending on (it is off by default). Credits are spent only after the premium allowance is used up.
  • For repositories owned by your personal account, you can track usage on the Agent ops this window card on your dashboard, on Settings → Billing & plans, and in the footer of every gitdb.net page. Settings → Usage shows the exact time the window resets, in UTC and in your local time.

On an individual plan, when a premium tool call is refused because the organization's premium allowance is used up, the tool returns this JSON object instead of its result (formatted here for reading):

{
  "error": "MCP premium tool-call allowance (AST, semantic search, memory) exceeded for this organization: the limit is N premium tool calls per 5-hour window. 'TOOL' was not executed. Standard tools are not metered on your plan and keep working. The window resets at HH:MM UTC — retry in about MINUTES minutes (retry_after_secs) — raise the limit by upgrading at https://gitdb.net/pricing, or keep going now with agent-ops credits — ask an owner of 'ORG' to add them at https://gitdb.net/settings/billing?view=credits&org=ORG. Your repo stays fully usable over git: clone it locally, keep working, and push back — git transport is never metered against this allowance.",
  "code": "QUOTA_WINDOW_EXCEEDED",
  "retry_after_secs": SECONDS
}

N is your plan's premium allowance per window, TOOL is the tool your agent called, and HH:MM is the time the window resets, in UTC, rounded up to the minute. MINUTES is the same wait rounded up to minutes; retry_after_secs (SECONDS) is the exact wait in seconds. ORG is the login of the account the call is charged to — your personal account or the organization that owns the repository; the link opens that account's credits page (Settings → Billing → Credits for your own account, the organization's Settings → Credits for an organization, which only its owner can use). On a call that reads a public repository through no grant of your own, the sentence reads "add them at https://gitdb.net/settings/billing?view=credits" instead. Scripts and agents should check the code field, which stays the same even if the wording changes.

On Enterprise, there's no 5-hour window: the organization's agent ops are billed to the enterprise's contract as usage credits. Standard tools are not metered and always run at full speed. Each premium tool call is billed as usage credits for the current billing period, up to the organization's usage cap. Once the cap is reached, premium tool calls are refused with code QUOTA_CREDIT_CAP_EXCEEDED and standard tools keep working — see Troubleshooting. A refused call is not charged.

On the free plan — your personal account's repositories — when the fast calls are used up and no credit pays for a call, standard tools run at reduced speed (a Team organization and Enterprise have no window and never run standard tools at reduced speed — see above). If a call would have to wait too long, or too many of your calls are already waiting, it isn't run and the tool returns this JSON object instead (formatted here for reading):

{
  "error": "Your N fast calls for this 5-hour window are used, so the free plan is running standard tools at reduced speed — 'TOOL' was not executed: retry in SECONDS seconds (retry_after_secs). Fast calls return at HH:MM UTC. This organization has no agent-ops credits available right now (a just-bought balance is picked up within about two minutes, with \"Use credits when my window runs out\" turned on). Keep full speed now with agent-ops credits — ask an owner of 'ORG' to add them at https://gitdb.net/settings/billing?view=credits&org=ORG, or upgrade / start a 7-day Pro trial (https://gitdb.net/pricing). Your repo stays fully usable over git: clone it locally, keep working, and push back — git transport is never metered against this allowance.",
  "code": "QUOTA_THROTTLED",
  "retry_after_secs": SECONDS
}

N is your plan's fast calls per window, TOOL is the tool your agent called, ORG is the account the call is charged to (as above), SECONDS is how long to wait before retrying (the same number in the message and in retry_after_secs), and HH:MM is when the window resets and the fast calls return, in UTC, rounded up to the minute. The sentence about credits depends on your balance: if your credits are still loading, it says so and asks you to retry in about two minutes; if you hold credits but spending is off, it asks you to ask an owner of ORG to turn on Use credits when my window runs out.

Troubleshooting

GitDB answers failed requests with one of the messages below. Depending on the client, you'll see it in the agent's reply or in the client's MCP logs.

MessageWhat it meansWhat to do
Bearer token requiredNo token reached GitDB.Check the Authorization header. If you use GITDB_TOKEN, make sure the variable is set for the program running your agent.
invalid tokenGitDB doesn't recognize the token.Check that you copied the whole token. If it was revoked, generate a new one.
token expiredThe token's expiration date has passed.Generate a new token and update your config.
A tool returns code repo_selection_required (this token can access multiple repositories — specify one via the X-Gitdb-Repo header or ?repo=org/name)The connection doesn't name a repository and the call passed no repo, so only gitdb_list_repos and gitdb_create_repo work without one. The message lists the repositories you can choose from.Pass repo naming one of them on the call, or add the X-Gitdb-Repo header (or ?repo=) naming one of them and reconnect.
requested repository is not accessible to this tokenThe repository in X-Gitdb-Repo isn't one your account can access.Check the spelling. The format is org/repo.
conflicting repo selectorsThe header and the ?repo= URL parameter name different repositories.Keep only one of them.
length limit exceeded (HTTP 413 or HTTP 500)One MCP request can carry at most 16 MiB, and this one was larger, so nothing ran. It usually means a gitdb_batch of many large writes.Split the work into smaller requests — for example fewer large writes per gitdb_batch — and retry.
no accessible repositoriesYour account doesn't have access to any repository yet.Create one — with gitdb_create_repo from a connection that names no repository, or on gitdb.net — or accept an invitation to one, then pass repo naming it on your calls, or reconnect naming it.
no_personal_namespace (HTTP 403, or as a tool's code)Your account has no personal namespace to bill a connection that names no repository, or a gitdb_create_repo call, to — for example an account your company's identity provider manages.Connect naming a repository with X-Gitdb-Repo, or ask an organization owner to create the repository.
A tool returns code insufficient_scope (this personal access token lacks the '…' scope required for this operation)The token's scopes don't cover this tool. Nothing was read or changed.Generate a token with the scope the message names — see Step 1 — and update your config.
agent seat limit exceeded (HTTP 429)Each personal access token that an agent uses takes one agent seat while it's active, and your plan limits how many can be active at once. Connections that share a token share a seat.Wait for the time in the response's Retry-After header, or until another agent goes idle, then retry. To run more agents at once, upgrade your plan.
Other HTTP 429 responsesToo many requests in a short period.Wait for the time in the Retry-After header, then retry.
A tool returns permission denied and says the credential is read-onlyThe token has no write scope, or your role in the organization is read-only.Generate a token with repo:write, or ask an organization owner for write access.
A tool returns does not include this featureYour plan doesn't include the feature this tool needs. Semantic search and agent memory are on paid plans; on the free plan the message offers the 7-day Pro trial or an upgrade. The call isn't counted.Start the 7-day Pro trial, or see gitdb.net/pricing for the plans that include it.
A tool returns code CREDITS_REQUIREDNo agent-ops credit could pay for this call. In a Team organization, every tool call is paid with the organization's credits; on the free plan, AST tools run on credits. The message says why: your credits are still loading, credit spending is off, or you have no credits — and links to the credits page of the account the call is charged to (https://gitdb.net/settings/billing?view=credits&org=ORG). The tool was not executed and nothing was spent.Loading: retry in about two minutes. Spending off: turn on Use credits when my window runs out on that page — Settings → Billing → Credits for your own account, or the organization's Settings → Credits, where only its owner can switch it. No credits: add some there — or, for your own account on the free plan, start the 7-day Pro trial. In a Team organization whose license has lapsed, calls stay refused until the license is reactivated.
A tool returns code AST_INDEX_BUILDING (index building — retry in a few minutes)Your first credit-paid AST call on this repository started its AST index. The call wasn't charged.Retry in a few minutes, once the index is built. See AST indexing on credits.
A tool returns MCP premium tool-call allowance (AST, semantic search, memory) exceeded for this organization with code QUOTA_WINDOW_EXCEEDEDThe organization's premium allowance for the current 5-hour window is used up. The premium tool was not executed; standard tools keep working.Wait until the reset time the message gives (UTC) — or wait retry_after_secs seconds and retry; a refused op is never charged. Or upgrade for a larger allowance, or add agent-ops credits — they take over within about two minutes if you have turned credit spending on (it is off by default). Meanwhile, clone the repository and keep working locally; see When your fast calls or premium allowance run out.
A tool returns code QUOTA_THROTTLED (Your N fast calls for this 5-hour window are used, so the free plan is running standard tools at reduced speed)Your fast calls for the current 5-hour window are used up and no credit paid for this call, so standard tools run at reduced speed. This call would have had to wait too long, or too many of your calls were already waiting, so it was answered at once. The tool was not executed and nothing was counted.Wait the retry_after_secs the response gives, then retry. The message also says when the fast calls return (the window reset, UTC) and whether your credits are loading, held because spending is off, or used up. To stay at full speed, add agent-ops credits with spending on, or upgrade.
A tool answers that GitDB is at capacity, with a retry_after_secsGitDB is briefly at capacity. The call was not sent and nothing ran.Retry after the retry_after_secs the response gives (about a second).
A tool answers that the repository is busyThe repository is briefly busy. The call wasn't served and the repository wasn't changed. A premium tool call (AST, semantic search, memory) isn't charged: whatever it would have used — premium allowance, agent-ops credits, or usage-cap credits — is returned. A standard tool call counts as usual.Retry in a few seconds.
A tool answers that the repository couldn't be openedGitDB couldn't open the repository just then. The call wasn't served and the repository wasn't changed. A premium tool call (AST, semantic search, memory) isn't charged: whatever it would have used — premium allowance, agent-ops credits, or usage-cap credits — is returned. A standard tool call counts as usual.Retry. If it keeps failing, contact support.
A semantic search tool returns code EMBED_AT_CAPACITYSemantic search is briefly at capacity, so the query was not processed and nothing ran.Retry after the wait the message gives.
A semantic search tool returns code EMBED_RATE_LIMITEDThe embedding service is throttling requests, so the text was not embedded and nothing ran.Wait the retry_after_secs the response gives, then retry.
A semantic search tool returns code bad_request ('query' is longer than the 8000-token embedding limit, or 'text' when saving a memory)The query, or the memory's text, is longer than the 8,000 tokens the embedding service accepts, so it was not embedded and nothing ran. Sending the same text again won't succeed.Shorten it to at most 8,000 tokens, then retry.
A tool returns MCP tool-call refused: this organization's usage cap for the current billing period is reached with code QUOTA_CREDIT_CAP_EXCEEDEDThe organization's usage cap for the current billing period is reached. The tool was not executed.An owner or admin of the organization can review the organization's usage. Meanwhile, your repository stays fully usable over Git: clone it, keep working locally, and push back.
credit-usage billing is not configuredUsage billing isn't set up for this organization yet, so tool calls are refused without running.An owner or admin of the organization can contact support. Meanwhile, your repository stays fully usable over Git: clone it, keep working locally, and push back.

On this page