Repo Context MCP logo

Repo Context MCP

Community
nduc99911

MCP server: repo map, code search, and token-aware context packs for AI coding agents

Publishernduc99911
Repositoryrepo-context-mcp
LanguageTypeScript
Forks
85
Stars
105
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Repo Context MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    105 stars and 85 forks from the linked repository.

repo-context-mcp

MCP server that helps AI coding agents understand a repository — without dumping the entire monorepo into the prompt.

CI License: MIT Node.js >= 18 MCP

Works with Codex, Claude Code, Cursor, Cline, and any client that speaks Model Context Protocol.

Why

AI agents waste tokens re-walking node_modules, missing entrypoints, or pasting random files. repo-context-mcp exposes three focused tools:

ToolPurpose
repo_mapLightweight tree + manifests/entrypoints
search_codeFast substring search with path:line hits
pack_contextToken-budgeted markdown pack for LLM prompts

Local-only. No cloud. No telemetry. Stdio transport.

Install

bash
# run from source
git clone https://github.com/nduc99911/repo-context-mcp.git
cd repo-context-mcp
npm install
npm run build

# or via npx (after publish)
npx -y repo-context-mcp

Requires Node.js 18+.

CLI (no MCP client)

bash
npm run build

# repository map
node dist/cli.js map .
node dist/cli.js map examples/sample-repo

# search
node dist/cli.js search login examples/sample-repo

# token-aware pack
node dist/cli.js pack . --focus auth,api --max-tokens 8000

# JSON for scripts / CI
node dist/cli.js map . --json
node dist/cli.js pack . --focus src --json

After global install / npx:

bash
npx repo-context-mcp map .
npx repo-context-mcp pack . --focus auth

MCP client config

Claude Desktop / Claude Code

json
{
  "mcpServers": {
    "repo-context": {
      "command": "npx",
      "args": ["-y", "repo-context-mcp"],
      "env": {
        "REPO_CONTEXT_ROOT": "/absolute/path/to/your/repo"
      }
    }
  }
}

Cursor

Settings → MCP → add server with command npx and args ["-y", "repo-context-mcp"].

Codex / generic stdio

bash
REPO_CONTEXT_ROOT=/path/to/repo node /path/to/repo-context-mcp/dist/server.js

From this repository after build:

bash
npm run build
node dist/cli.js serve
# or: node dist/server.js

See also examples/mcp-config.claude.json and examples/mcp-config.local.json.

Optional env:

VariableMeaning
REPO_CONTEXT_ROOTDefault repository root when tools omit root

Each tool also accepts an explicit root argument.

Tools

repo_map

text
root?: string
max_depth?: number      # default 6
max_entries?: number    # default 400

Returns a markdown tree, file count, and likely entrypoints (package.json, README.md, src/index.ts, AGENTS.md, …). Skips node_modules, .git, dist, etc.

search_code

text
query: string
root?: string
max_results?: number    # default 50
case_sensitive?: boolean

Substring search across source-like extensions.

pack_context

text
root?: string
focus?: string[]        # keywords / path fragments to prioritize
max_tokens?: number     # default 12000 (approx)
max_files?: number      # default 40

Ranks files (entrypoints + focus matches), respects a rough token budget (~4 chars/token), and returns a single markdown document ready to paste into an agent prompt or PR review.

Library API

You can use the core without MCP:

ts
import {
  buildRepoMap,
  formatRepoMap,
  searchCode,
  packContext,
} from "repo-context-mcp";

const map = buildRepoMap({ root: process.cwd() });
console.log(formatRepoMap(map));

const hits = searchCode({ root: process.cwd(), query: "TODO" });
const pack = packContext({
  root: process.cwd(),
  focus: ["auth"],
  maxTokens: 8000,
});
console.log(pack.markdown);

Demo (no MCP client)

bash
npm install
npm test
npm run build

# map the sample tree
node --input-type=module -e "import { buildRepoMap, formatRepoMap } from './dist/index.js'; console.log(formatRepoMap(buildRepoMap({ root: 'examples/sample-repo' })));"

Security

  • Reads files only under the requested root.
  • Does not execute project code.
  • Skips common vendor dirs and obvious binaries.
  • Still: only point it at repositories you trust.

See SECURITY.md.

Project status

v0.1.1 — MCP server + CLI + gitignore + PR Action.

Roadmap:

  • .gitignore respect
  • CLI (map / search / pack) + --json
  • GitHub Action: pack context on each PR
  • Optional ripgrep backend for large monorepos
  • Baseline symbol index (tree-sitter) for find_symbol
  • Configurable ignore file (.repo-contextignore)

Contributing

See CONTRIBUTING.md.

bash
npm install
npm test
npm run lint
npm run build

License

MIT © Nguyen Duc


Built as a real maintainer / agent-tooling utility for the MCP ecosystem — not a placeholder repo. Issues and PRs welcome.

Installation

TypingMind
{
  "mcpServers": {
    "repo-context-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "repo-context-mcp"
      ],
      "env": {
        "REPO_CONTEXT_ROOT": "<REPO_CONTEXT_ROOT>"
      }
    }
  }
}

Use Repo Context MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Repo Context MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Repo Context MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Repo Context MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "repo-context-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "repo-context-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Repo Context MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Repo Context MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Repo Context MCP to help me with this task?
Repo Context MCP
Sure. I read it.
Here is what I found using Repo Context MCP.

Frequently asked questions

What is the Repo Context MCP MCP server used for?

Repo Context MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Repo Context MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Repo Context MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Repo Context MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Repo Context MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Repo Context MCP MCP to TypingMind?

Repo Context MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Repo Context MCP MCP provide in TypingMind?

Repo Context MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Repo Context MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Repo Context MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇