Skip to content

MCP Server

gitinspect includes a built-in Model Context Protocol (MCP) server, making it directly invokable by AI coding agents.

What is MCP?

The Model Context Protocol is an open standard that enables AI applications to securely connect to external data sources and tools. It provides a standardized way for LLMs to access and interact with external systems.

Starting the MCP Server

bash
gitinspect mcp

This starts an MCP server over stdio — the standard transport for AI agent integration. The server listens for JSON-RPC messages on stdin and writes responses to stdout.

Available Tools

inspect_repo

Inspect a Git repository and return a structured snapshot with file contents, dependencies, and stats.

Parameters:

ParameterTypeRequiredDefaultDescription
repostringLocal path or remote URL
formatstringjsonOutput format: json, text, yaml
max_tokensnumber6000Maximum token budget
max_filesnumber0Max files (0 = unlimited)
includestringInclude glob patterns (comma-separated)
excludestringExclude glob patterns (comma-separated)
stripbooleanfalseStrip comments and blank lines
no_cachebooleanfalseDisable caching

list_repo_files

List all files in a repository with priority scores and token estimates — useful for deciding which files to inspect before reading contents.

Parameters:

ParameterTypeRequiredDefaultDescription
repostringLocal path or remote URL
includestringInclude glob patterns (comma-separated)
excludestringExclude glob patterns (comma-separated)

Two-Step Inspection Pattern

The recommended pattern for AI agents is a two-step approach:

  1. List files with list_repo_files to understand the repository structure
  2. Inspect with inspect_repo using targeted include/exclude patterns and appropriate max_tokens

This avoids wasting the token budget on files the agent doesn't need.

Released under the Apache-2.0 License.