Skip to main content
Glama

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:

Tool

Purpose

repo_map

Lightweight tree + manifests/entrypoints

search_code

Fast substring search with path:line hits

pack_context

Token-budgeted markdown pack for LLM prompts

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

Related MCP server: codeweave-mcp

Install

# 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+.

MCP client config

Claude Desktop / Claude Code

{
  "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

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

From this repository after build:

npm run build
node dist/server.js

Optional env:

Variable

Meaning

REPO_CONTEXT_ROOT

Default repository root when tools omit root

Each tool also accepts an explicit root argument.

Tools

repo_map

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

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

Substring search across source-like extensions.

pack_context

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:

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)

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.0 — usable MCP server + library.

Roadmap:

  • Optional ripgrep backend for large monorepos

  • .gitignore native respect (beyond default ignore list)

  • SARIF / JSON machine output modes

  • GitHub Action: pack context on each PR

  • Baseline symbol index (tree-sitter) for find_symbol

Contributing

See CONTRIBUTING.md.

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.

Install Server
A
license - permissive license
A
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    C
    maintenance
    An MCP server for semantic code search & navigation that helps AI agents work efficiently without burning through costly tokens. Instead of reading entire files, agents can search conceptually and jump directly to the specific functions, classes, and code chunks they need.
    118
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    An MCP server that helps AI agents comprehend a codebase by providing tools for navigating, searching, and understanding code structure and history.
    10
    MIT
  • A
    license
    -
    quality
    C
    maintenance
    Universal MCP server that analyzes any codebase and provides structured context to AI assistants. Dynamic, accurate, and token-efficient.
    19
    MIT

View all related MCP servers

Related MCP Connectors

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nduc99911/repo-context-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server