GitDBDocs
VS Code extension

MCP server for AI agents

Give an MCP-capable AI agent access to your GitDB repository using the MCP server bundled with the extension.

The extension comes with an MCP (Model Context Protocol) server. With it, an MCP-capable agent such as Claude Code can work in the GitDB repository you're connected to in VS Code, with no clone needed. The agent can:

  • read files and list directories
  • search the code: find functions and their callers, list a file's symbols, search file names, and search contents with regular expressions
  • look at branches, tags, commit history, and differences between refs
  • commit its changes, and create branches and tags

Set up your agent

You'll need:

  • VS Code connected to the repository (see Install and connect).
  • Node.js on your PATH. Your agent starts the MCP server with the node command.

Then follow these steps:

  1. In VS Code, run GitDB: Copy MCP Config from the Command Palette. A confirmation appears, noting that the copied configuration contains a live access token.

  2. Open your agent's MCP configuration. Agents such as Claude Code list their MCP servers under an mcpServers key.

  3. Paste the copied entry inside mcpServers. What you copied is a JSON object with one entry, "gitdb", so it goes in like this:

    {
      "mcpServers": {
        "gitdb": {
          // Paste the contents of the copied "gitdb" entry here, unchanged:
          // its "command", "args", and "env" values.
        }
      }
    }
  4. Restart your agent, or reload its MCP servers, so it picks up the new entry.

If VS Code isn't connected when you run the command, you'll see GitDB: Not connected — connect to a repository first.

What the agent works on

  • Repository. The agent uses the repository VS Code was connected to when you copied the configuration. If you switch repositories in VS Code, copy the configuration again for the new one.
  • Branch. The agent's default branch is the one VS Code connected on, which is usually the repository's default branch. Switching branches in VS Code doesn't change the agent's branch, even if you copy the configuration again. Unless the agent names another branch, its commits go to this one.
  • Agent changes. The agent's changes are held by its own MCP server until it commits. They don't appear in VS Code's Source Control, and they're lost if the agent's MCP server stops before committing. When the agent commits, all of its pending changes go into one commit.
  • Seeing the results. After the agent commits, run GitDB: Refresh in VS Code to see the new commit and files.

Commits follow the same GitHub rule as your own. If your repository syncs with GitHub, the commit may go to a GitHub work branch, and you then open a pull request on GitHub. See Repositories that sync with GitHub.

Things to know about the copied configuration

  • Its access token expires. The configuration contains VS Code's current GitDB access token. Access tokens last 8 hours from when they're issued, and the copied token may already be partway through that. It can stop working anywhere from a few minutes to 8 hours after you copy it. When your agent's GitDB tools start failing to authenticate, run GitDB: Copy MCP Config again, replace the entry, and restart your agent.
  • It breaks when the extension updates. The configuration points to the MCP server file inside the extension's installed folder, and that folder changes when the extension updates. After an update, copy the configuration again.
  • Keep it private. Anyone with it can reach your repositories until the token expires. Don't share it, and don't commit it. If you paste it into a configuration file inside a project, keep that file out of version control.

MCP: running in VS Code's status bar refers to a separate MCP server that the extension runs for itself and renews automatically. Your agent starts its own copy from the copied configuration, and that copy doesn't renew its token. That's why the copied configuration eventually needs to be copied again.

On this page