MCP Server

AI Agent Integration

The Model Context Protocol (MCP) lets AI tools — Claude Desktop, Cursor, VS Code, and others — use GitForge as a tool. Create repos, read files, commit code, and manage branches directly from your AI assistant.

Quick Setup

Add the following configuration to your MCP client. You will need a Personal Access Token (gf_...).

MCP Server Configuration (JSON)
{
  "mcpServers": {
    "gitforge": {
      "command": "npx",
      "args": ["-y", "@gitforge/mcp"],
      "env": {
        "GITFORGE_API_URL": "https://git-forge.dev",
        "GITFORGE_TOKEN": "gf_your_token_here"
      }
    }
  }
}

Where to put this config

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).

Cursor

Go to Settings → MCP Servers and add the server configuration above.

VS Code

Create or edit .vscode/mcp.json in your workspace root with the config above.

Available Tools

The MCP server exposes 18 tools grouped by category. Your AI assistant discovers these automatically once connected.

Repositories
create_repoCreate a new Git repository
list_reposList repositories with pagination
delete_repoDelete a repository (irreversible)
Files
list_filesList directory contents at a given ref (branch/tag/SHA)
get_fileRead a file's content from a repository at a given ref
Commits
create_commitCreate a commit with file additions/modifications/deletions (no git client needed)
get_commit_historyGet paginated commit history for a branch or ref
Branches
list_branchesList branches in a repository
create_branchCreate a new branch from a base branch or SHA
delete_branchDelete a branch
Ephemeral Branches
create_ephemeral_branchCreate a disposable ephemeral branch (auto-expires). Ideal for AI agent workspaces and previews.
promote_ephemeral_branchPromote an ephemeral branch to a permanent branch
Search
search_codeSearch file contents within a repository
get_diffCompare two branches/refs and get unified diffs
Auth
get_remote_urlGet an authenticated git clone URL with a short-lived token
Documentation
search_docsSearch GitForge documentation content
get_doc_pageGet the full content of a specific documentation page
Sandbox
create_sandbox_urlGenerate a time-limited, scoped Git remote URL for sandbox/agent use

Environment Variables

GITFORGE_API_URLYour GitForge instance URL (e.g. https://git-forge.dev)
GITFORGE_TOKENPersonal Access Token — create one at /settings/pats
MCP_PORTPort for HTTP transport mode (default: 3002)

Example Usage

Once connected, your AI assistant can interact with GitForge through natural language.

Create a repository

You: “Create a new repo called my-project”

Claude: [uses create_repo tool] → Created repo my-project (id: abc-123)

Read a file

You: “Show me the contents of src/index.ts on main”

Claude: [uses get_file tool] → Returns the file content

Commit changes

You: “Add a README.md with project description and commit to main”

Claude: [uses create_commit tool] → Created commit abc123 on main

Sandbox workflow

You: “Create a sandbox for repo X so I can test changes safely”

Claude: [uses create_sandbox_url tool] → Returns a scoped, time-limited clone URL with an ephemeral branch

Next Steps

MCP Server — AI Agent Integration | GitForge