Connect your AI agent
Connect Claude Code, Cursor, 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, your personal access token, and the repository to work on.
Before you start
You need:
- A gitdb.co account with access to at least one repository.
- A personal access token (step 1 below).
- An MCP client, such as Claude Code, Cursor, or Windsurf.
Connection details
| Setting | Value |
|---|---|
| Server URL | https://mcp.gitdb.co/mcp |
| Transport | HTTP (Streamable HTTP) |
Authorization header | Bearer followed by your personal access token |
X-Gitdb-Repo header | The repository to work on, written as org/repo |
Each connection works on one repository. GitDB's tools don't take a repository argument, so the connection itself names the repository:
- If your account can access more than one repository,
X-Gitdb-Repois required. - If your account can access exactly one repository, it's optional. Setting it anyway keeps the connection working after you gain access to a second repository.
- To work with several repositories, add one server entry per repository, each with its own name and its own
X-Gitdb-Repovalue.
If your client can't send custom headers other than Authorization, add the repository to the URL instead: https://mcp.gitdb.co/mcp?repo=org/repo. Use one method or the other. If the header and the URL name different repositories, the connection is refused.
Step 1: Create a personal access token
- Sign in at gitdb.co and open Settings → Personal access tokens (gitdb.co/settings/tokens).
- Click Generate new token.
- Give the token a name that tells you which agent uses it.
- Choose scopes:
repo:readis enough for the search, read, and history tools.- Add
repo:writeif the agent should create branches or tags, stage and commit changes, merge branches, or save memories. Without a write scope, those tools are refused.
- Choose an expiration and generate the token.
- 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_TOKENThe 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.
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.co/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.
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.co/mcp",
"headers": {
"Authorization": "Bearer ${GITDB_TOKEN}",
"X-Gitdb-Repo": "acme/web-app"
}
}
}
}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.co/mcp",
"headers": {
"Authorization": "Bearer ${env:GITDB_TOKEN}",
"X-Gitdb-Repo": "acme/web-app"
}
}
}
}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.co/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
- Confirm that your client sees the server:
- Claude Code: run
/mcpin a session.gitdbshould show as connected. - Cursor: in Cursor's MCP settings, check that
gitdbis enabled and lists its tools. - Windsurf: in the MCPs section of the Cascade panel, check that
gitdbis listed.
- Claude Code: run
- 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, your repository selection, and your allowance all work. The check itself uses one tool call. See MCP tools for everything your agent can do.
Daily tool-call allowance
- Each tool call your agent makes counts as one call against the daily allowance of the organization that owns the connected repository.
- Connecting, reconnecting, and listing the available tools don't count.
- A tool refused because your plan doesn't include its feature (such as semantic search or agent memory) doesn't count either.
- The allowance resets at 00:00 UTC. How many calls you get per day depends on your plan; see gitdb.co/pricing.
- When the allowance runs out, the connection stays open. Each tool returns a message saying the organization's daily MCP quota was exceeded and the tool was not executed. Tools work again after 00:00 UTC, or after you upgrade to a plan with a larger allowance.
- For repositories owned by your personal account, you can track usage on the MCP tool calls today card on your dashboard, on Settings → Billing & plans, and in the footer of every gitdb.co page.
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.
| Message | What it means | What to do |
|---|---|---|
Bearer token required | No 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 token | GitDB doesn't recognize the token. | Check that you copied the whole token. If it was revoked, generate a new one. |
token expired | The token's expiration date has passed. | Generate a new token and update your config. |
this token can access multiple repositories — specify one via the X-Gitdb-Repo header or ?repo=org/name | Your account can access several repositories and the connection didn't name one. | Add the X-Gitdb-Repo header. The message lists the repositories you can choose from. |
requested repository is not accessible to this token | The repository in X-Gitdb-Repo isn't one your account can access. | Check the spelling. The format is org/repo. |
conflicting repo selectors | The header and the ?repo= URL parameter name different repositories. | Keep only one of them. |
no accessible repositories | Your account doesn't have access to any repository yet. | Create a repository or accept an invitation to one, then reconnect. |
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 responses | Too 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-only | The 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 feature | Your plan doesn't include the feature this tool needs. | See gitdb.co/pricing for the plans that include it. |
A tool returns daily MCP quota exceeded for this organization | The organization's daily allowance is used up. | Wait until 00:00 UTC, or upgrade for a larger allowance. |