context-sniper-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@context-sniper-mcpsearch code for 'validateUser' in current repo"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
context-sniper-mcp
A tiny local MCP server that indexes a repository into line-range chunks and serves compact "evidence packets" (file + lines + score + snippet) instead of dumping whole files into the model's context. Meant to be shared by Claude Code and Codex to cut token usage when exploring or debugging a repo.
No database — the index is a single JSON file written to
<repo>/.context-index/chunks.json.
Tools
index_repo
{ root }— scansroot(skippingnode_modules,.git,dist,build,.next,coverage,.venv,target), chunks supported files (ts tsx js jsx py java go rs md json yml yaml toml) into ~80-line sliding windows (max 120 lines/chunk), and writesroot/.context-index/chunks.json. Dependency lockfiles (package-lock.json,pnpm-lock.yaml,npm-shrinkwrap.json), minified bundles (*.min.js,*.bundle.js), and files larger than 512 KB are skipped so the index stays focused on real source.search_code
{ root, query, topK? }— loads the chunk index and scores it againstquerywith a BM25-style ranker. Returns up totopK(defaulthits, each with
FILE,LINES,SCORE, and a snippet capped at 4000 characters. If no index exists yet, it tells you to runindex_repofirst.
read_snippet
{ root, path, startLine, endLine }— reads an explicit line range from one file insideroot. Capped at 300 lines per call (longer ranges are truncated with a note).pathis resolved and checked againstroot; anything that would escaperootis refused.run_test_filtered
{ root, command }— runs one of a fixed allowlist of commands (npm_test→npm test,pnpm_test→pnpm test,pytest→pytest -q) viaspawnwithshell: false— no arbitrary shell execution. Captures stdout/stderr, keeps only lines matchingerror|failed|failure|assert|expected|received|tracebackor a test-file path, tail-capped at 120 lines. If nothing matches, falls back to the last 80 raw output lines. Always reports the resolved command and exit code.
There is intentionally no run_shell or equivalent — only the four tools
above are exposed.
Related MCP server: Repo Interrogator
Installation
For installation and client configuration, see INSTALL.md.
Recommended usage
Call index_repo once per repo (and again after large changes) before doing anything else.
Before fixing a bug, prefer search_code over opening files — search for the symptom, error message, or function name first.
Don't read a whole file up front. Let the evidence packet from
search_codetell you where to look.If a test fails, use run_test_filtered to get the trimmed failure output instead of piping raw test-runner logs into context.
If a returned snippet cuts off before the context you need, use read_snippet with a widened
startLine/endLinerange around it (still capped at 300 lines per call) rather than reading the entire file.
Project layout
context-sniper-mcp/
├── package.json
├── tsconfig.json
├── src/
│ ├── index.ts # MCP server wiring + tool registration
│ ├── repo-index.ts # scanning, chunking, safe path resolution, index I/O
│ ├── search.ts # BM25-style scoring + evidence packet formatting
│ ├── snippets.ts # bounded, path-safe line-range reads
│ └── output-gate.ts # allowlisted test runner + output filtering
├── build/ # compiled output (npm run build)
├── INSTALL.md
├── HUMAN.md
└── README.mdThis server cannot be installed
Maintenance
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
- Alicense-qualityBmaintenanceA local MCP server that provides AI coding assistants with semantic search capabilities over codebases. It indexes code using local embeddings and exposes tools for efficient code retrieval, saving tokens and improving response quality.Last updated314MIT
- AlicenseAqualityAmaintenanceA local-first MCP server that enables AI tools to safely inspect and search code repositories, providing indexing, deterministic BM25 search, code outlining, and context bundles without code modification.Last updated91MIT
- AlicenseAqualityAmaintenanceMCP server that indexes your codebase's public API at startup and serves it via compact tool responses, saving tokens vs reading source files.Last updated521MIT
- AlicenseAqualityBmaintenanceAn MCP server that indexes reference repositories and provides tools for AI coding agents to retrieve lossless code context, enabling reasoning over codebases larger than the agent's context window.Last updated82Apache 2.0
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ywq090522/context-sniper-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server