Codefetch MCP Server

Fetches all files in the current directory and outputs them in a Markdown file.

Local serverstdioTypeScript

What is the Codefetch MCP server?

Codefetch MCP server exists for a simple reason — assistants are far more useful when they can act on Codefetch directly instead of describing what you should do. Fetches all files in the current directory and outputs them in a Markdown file.

What you get

Codefetch is a powerful tool that converts git repositories and local codebases into structured Markdown files optimized for Large Language Models (LLMs). It intelligently collects, processes, and formats code while respecting ignore patterns and providing token counting for various AI models.

  • 📁 Local Codebase Processing - Convert entire codebases into AI-friendly Markdown
  • 🔗 Git Repository Support - Fast GitHub API fetching with git clone fallback
  • 🐙 Multi-Platform Support - Works with GitHub, GitLab, and Bitbucket
  • 🎯 Smart Filtering - Respect .gitignore patterns and custom exclusions
  • 📊 Token Counting - Track tokens for GPT-4, Claude, and other models
  • 🚀 CLI & SDK - Use via command line or integrate programmatically

Setting it up

codefetch on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.

What the assistant can call

Once Codefetch is connected, these are the calls the assistant has available:

  • Configuration — // Processing options projectTree: 2, // Tree depth (0 to disable) projectTreeSkipIgnoreFiles: false, // Set to true to show ignored files in tree

Configuration and credentials

You will need one environment variable: GITHUB_TOKEN. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the codefetch mcp server does with a few real requests.

Choosing this one

Plenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Codefetch's toolset — Configuration — is a fair guide to whether it matches your workflow. It is maintained by regenrek; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Available tools

ToolWhat it does
Configuration// Processing options projectTree: 2, // Tree depth (0 to disable) projectTreeSkipIgnoreFiles: false, // Set to true to show ignored files in tree tokenEncoder: "cl100k", tokenLimiter: "truncated",

How to install the Codefetch MCP server

{
  "mcpServers": {
    "codefetch": {
      "command": "npx",
      "args": ["-y", "codefetch"],
      "env": {
        "GITHUB_TOKEN": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
GITHUB_TOKENCredential the server authenticates with.Yes

Example prompts to try

  • Use Codefetch to Configuration.

Frequently asked questions

It connects Codefetch to MCP-compatible AI assistants such as Claude and Cursor, exposing 1 tool (Configuration) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Codefetch directly.