Context_Recon_MCP
Integrates with Google Gemini CLI as the local context retrieval engine, using Gemini CLI auth for retrieval, status, quota/usage info, and optional Gemini-based reranking.
Integrates with OpenAI Codex CLI as an optional reranking provider, using codex exec with structured JSON output, configurable models, and usage tracking via CLI JSON or web-cookie sync.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Context_Recon_MCP
A lightweight, local MCP server for deterministic context retrieval
Built to stay simple, predictable, and inexpensive to run.
We like putting our dollars where they actually count.
This tool grew out of that mindset, and weβre sharing it so others can do more with less.
π¦ Legal & Usage
Please read this section before using the project:
No affiliation with Google, Anthropic, OpenAI, or any other vendor
You bring and manage your own Gemini CLI credentials
You are responsible for usage, billing, and compliance
This repository is source code only (not hosted, not commercial)
Provided as-is, with no dedicated support or roadmap commitments. If you find ways to improve it, feel free to share them.
Related MCP server: semantic-code-intelligence
π§ What This Server Does
Context_Recon_MCP is focused on retrieval only.
It helps tools and agents:
Inspect a local codebase
Search deterministically
Extract stable, citeable excerpts
It intentionally does not modify files or mutate your project.
Scope at a glance
π₯οΈ Runs locally only
π§ Uses Gemini CLI as context retrieval engine
π§Ύ Deterministic search and excerpting for stability and auditability
π Retrieval-only surface (no code editing)
π« Dot-prefixed paths excluded by default
ποΈ Skips common system/cache directories during broad scans
π§° Tool Surface
A small, focused set of MCP tools:
Tool | Description |
| Directory orientation and key file hints |
| Index status, limits, Gemini status, dashboard URL |
| Lexical discovery across the project |
| Ranked excerpts for a query |
| Single-tool semantic retrieval wrapper |
| Authoritative excerpts with hash and mtime |
| Pulls latest server changes from git ( |
| Terminates sibling/orphaned server processes |
π₯οΈ Local Dashboard
Default URL:
http://127.0.0.1:8765Served from ui/index.html.
Dashboard features
Connection and status checks
Request counts and token totals
Usage and quota info from local Gemini CLI auth
File explorer, query console, snippet inspector
Click-to-load recent MCP activity
Frequently used query chips
Runtime behavior
UI refresh runs only when open
No model connectivity checks on refresh
Visibility-aware background polling
Gemini auto-poll disabled by default
Orphan auto-exit when parent process is gone (
ppid == 1)Idle auto-exit after 15 minutes
Optional startup auto-update (
git pull --ff-only)Optional periodic auto-update poll (default every 5 minutes)
Conservative token usage defaults
If the dashboard is closed, no UI refresh runs.
For terminal-only inspection, use context.index_inspection.
π¦ Install
./scripts/install_system.shDefault paths
${XDG_DATA_HOME:-$HOME/.local/share}/context_recon_mcp~/.local/bin/context-recon-mcp
Required environment (OAuth mode)
GEMINI_DEFAULT_AUTH_TYPE=oauth-personal
NO_BROWSER=true
OAUTH_CALLBACK_HOST=127.0.0.1Optional environment (required for some Workspace/Code Assist accounts)
GOOGLE_CLOUD_PROJECT=<your-gcp-project-id>
GOOGLE_CLOUD_PROJECT_ID=<your-gcp-project-id>Optional process label:
CONTEXT_RECON_PROCESS_NAME=Context_Recon_MCPOptional process lifecycle controls:
# Environment variable (launcher default is true). Set false to disable orphan self-shutdown.
CONTEXT_RECON_ORPHAN_SHUTDOWN=true# config.yaml lifecycle defaults
orphan_shutdown_enabled: true
idle_shutdown_seconds: 900Optional update controls:
# Optional environment overrides
CONTEXT_RECON_AUTO_UPDATE_ON_START=true
CONTEXT_RECON_UPDATE_REMOTE=origin
CONTEXT_RECON_UPDATE_BRANCH=main
CONTEXT_RECON_UPDATE_ALLOW_DIRTY=false
CONTEXT_RECON_UPDATE_TIMEOUT_SECONDS=45
CONTEXT_RECON_UPDATE_POLL_SECONDS=300# config.yaml update defaults
auto_update_on_start: true
update_remote: "origin"
update_branch: "" # empty means current branch
update_allow_dirty: false
update_timeout_seconds: 45
update_poll_seconds: 300Notes:
Updates use
git pull --ff-onlyand will not create merge commits.If local changes exist and
update_allow_dirty=false, update is skipped.After a successful code update, restart MCP to load the new server code.
Process Cleanup (Stale Servers)
Preferred cleanup path is the MCP tool context.tool_cleanup.
Terminal fallback (keeps the newest server PID and stops older duplicates):
pids="$(pgrep -f 'context-recon-mcp/src/server.py' || true)"; keep="$(printf '%s\n' "$pids" | sort -n | tail -n 1)"; printf '%s\n' "$pids" | while IFS= read -r pid; do [ -n "$pid" ] && [ "$pid" != "$keep" ] && kill "$pid"; doneπ MCP Configuration Examples
Command
context-recon-mcpCodex (~/.codex/config.toml)
[mcp_servers.Context_Recon_MCP]
command = "context-recon-mcp"
args = []
enabled = true
[mcp_servers.Context_Recon_MCP.env]
GEMINI_DEFAULT_AUTH_TYPE = "oauth-personal"
NO_BROWSER = "true"
OAUTH_CALLBACK_HOST = "127.0.0.1"
CONTEXT_RECON_ORPHAN_SHUTDOWN = "true"
CONTEXT_RECON_AUTO_UPDATE_ON_START = "true"
CONTEXT_RECON_UPDATE_POLL_SECONDS = "300"
GOOGLE_CLOUD_PROJECT = "<your-gcp-project-id>"
GOOGLE_CLOUD_PROJECT_ID = "<your-gcp-project-id>"Claude Code (~/.claude.json)
{
"Context_Recon_MCP": {
"type": "stdio",
"command": "context-recon-mcp",
"args": [],
"env": {
"GEMINI_DEFAULT_AUTH_TYPE": "oauth-personal",
"NO_BROWSER": "true",
"OAUTH_CALLBACK_HOST": "127.0.0.1",
"CONTEXT_RECON_ORPHAN_SHUTDOWN": "true",
"CONTEXT_RECON_AUTO_UPDATE_ON_START": "true",
"CONTEXT_RECON_UPDATE_POLL_SECONDS": "300",
"GOOGLE_CLOUD_PROJECT": "<your-gcp-project-id>",
"GOOGLE_CLOUD_PROJECT_ID": "<your-gcp-project-id>"
}
}
}Cursor / VS Code
{
"mcpServers": {
"Context_Recon_MCP": {
"command": "context-recon-mcp",
"args": [],
"env": {
"GEMINI_DEFAULT_AUTH_TYPE": "oauth-personal",
"NO_BROWSER": "true",
"OAUTH_CALLBACK_HOST": "127.0.0.1",
"CONTEXT_RECON_ORPHAN_SHUTDOWN": "true",
"CONTEXT_RECON_AUTO_UPDATE_ON_START": "true",
"CONTEXT_RECON_UPDATE_POLL_SECONDS": "300",
"GOOGLE_CLOUD_PROJECT": "<your-gcp-project-id>",
"GOOGLE_CLOUD_PROJECT_ID": "<your-gcp-project-id>"
}
}
}
}Optional CLI Provider Overrides (Any Host)
CONTEXT_RECON_RERANK_PROVIDER="auto"(orgemini,claude,codex)CONTEXT_RECON_GEMINI_COMMAND="gemini"CONTEXT_RECON_GEMINI_ARGS="--model gemini-2.5-pro"CONTEXT_RECON_CLAUDE_COMMAND="claude"CONTEXT_RECON_CLAUDE_ARGS="--model claude-3-7-sonnet-20250219 --max-turns 1 --no-session-persistence --disable-slash-commands --tools \"\""CONTEXT_RECON_CLAUDE_PROMPT_MODE="arg"(orstdin)CONTEXT_RECON_CLAUDE_USAGE_SOURCE="auto"(orweb,oauth,off)CONTEXT_RECON_CLAUDE_COOKIE_SOURCE="auto"(ormanual,off)CONTEXT_RECON_CLAUDE_COOKIE_HEADER="sessionKey=..."CONTEXT_RECON_CODEX_COMMAND="codex"CONTEXT_RECON_CODEX_ARGS="-m codex-mini-latest"CONTEXT_RECON_CODEX_PROMPT_MODE="arg"(orstdin)CONTEXT_RECON_CODEX_USAGE_SOURCE="auto"(orweb,oauth,off)CONTEXT_RECON_CODEX_COOKIE_SOURCE="auto"(ormanual,off)CONTEXT_RECON_CODEX_COOKIE_HEADER="__Secure-next-auth.session-token=..."CONTEXT_RECON_BROWSER_COOKIE_ORDER="safari,chrome,brave,edge,chromium,firefox,opera"
*_ARGS accepts either a JSON array (e.g. ["--model","gemini-2.5-pro"]) or a shell-style string.
Defaults + config.yaml Examples
Defaults (when you do nothing):
Provider:
auto(first available:geminiβclaudeβcodex)Gemini model: whatever your Gemini CLI defaults to
Claude model:
claude-3-haiku-20240307(via args below)Codex model:
codex-mini-latest
Edit config.yaml to pin a provider/model without env vars:
reranker_provider: "claude"
claude_args:
- "--model"
- "claude-3-haiku-20240307"
- "--max-turns"
- "1"
- "--no-session-persistence"
- "--disable-slash-commands"
- "--tools"
- ""reranker_provider: "codex"
codex_args:
- "-m"
- "codex-mini-latest"reranker_provider: "gemini"
gemini_args:
- "--model"
- "gemini-2.5-pro"If the chosen provider CLI is missing, the server auto-falls back to the next available CLI in the order above.
Env vars always override config.yaml.
Claude adapter notes:
Adds
--output-format jsonand--json-schemaautomatically for structured output, and default args limit turns and tools for token efficiency.Usage sync follows the CodexBar-style web-cookie strategy; use
*_COOKIE_HEADERfor manual cookies.
Codex adapter notes:
Uses
codex execunder the hood.Adds
--output-schemaand--output-last-messageautomatically for structured JSON output.Defaults to
--sandbox read-onlyand--ask-for-approval neverunless you override those flags.Default model is set to
codex-mini-latestsince it is optimized for Codex CLI and the Codex launch default.Usage sync follows the CodexBar-style web dashboard cookie path; if cookies are unavailable, the dashboard will show usage as unavailable.
Token usage tracking:
Gemini uses CLI stats.
Claude/Codex attempt to read usage fields from CLI JSON when available; otherwise we estimate from prompt/output size.
π§ͺ Development
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest -qπ License
MIT (see LICENSE).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Token-efficient search for coding agents over public and private documentation.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides token-efficient code retrieval for coding agents by indexing repositories and enabling ranked snippet search, symbol outlines, and surgical line reads.8 npmMIT
- FlicenseBqualityCmaintenanceEnables coding agents to search locally indexed repositories with hybrid semantic and lexical retrieval, returning exact source citations with file paths and line ranges.4-
- FlicenseNot gradedqualityBmaintenanceEnables AI coding agents to interrogate a local repository deterministically for symbols, dependencies, call paths, routes, tests, and Git impact, returning verified structured evidence with exact line citations instead of requiring the whole codebase to be read.79 PyPI4-
- AlicenseNot gradedqualityBmaintenanceEnables agents to find code by describing its behaviour rather than guessing file names, returning ranked file:line snippets that cost far fewer tokens than grep-then-read. Also surfaces neighbouring implementations, callers and tests around a location you already know, indexing local paths or git URLs locally on CPU.804 npm1MIT