Skip to main content
Glama

flash-context

CI PyPI version Python versions License

A lightweight, model-agnostic repository search tool for AI agents. Find relevant code, documentation, and configuration through exact lookups or model-guided search, and retrieve compact snippets with validated file-line citations. Available as a Python CLI and Model Context Protocol (MCP) server.

CLI and MCP share a read-only core with path safety and resource limits. Exact lookups can resolve locally; broader queries delegate search and reading to a utility model through an OpenAI-compatible endpoint. Validation checks paths and source ranges; semantic relevance remains the model's judgment. See safety and evidence validation for details and limitations.

Inspired by FastContext, a now-withdrawn paper on separating repository exploration from task solving, using specialized models to return focused file-line evidence while reducing the coding agent's context and token overhead.

Quickstart

Requires Python 3.13+, uv, and an OpenAI-compatible model endpoint with tool calling support.

uv tool install flash-context
export FLASH_CONTEXT_BASE_URL=http://localhost:1234/v1
export FLASH_CONTEXT_MODEL=your-model

flash-context search --repo . --query "Find the request validation logic"

Replace the endpoint and model with your settings. Set FLASH_CONTEXT_API_KEY if authentication is required. Installed commands use environment variables; source checkouts also support project-root config.yaml and .env.

Default output is repository-relative citations:

src/api/validation.py:42-88

Use --no-citation for prose, --format json for results with snippets, or --max-turns N to override the 12-turn default. Exact path and unique symbol lookups can resolve locally without an endpoint. See the CLI contract for options, output schemas, and exit codes.

For example, --query 'httpx/_client.py' returns a bounded file preview, while --query 'BaseTransport' returns its definition if unique within a complete Python source/stub scan. Local successes report turns_used: 0 in JSON.

Use --query 'httpx/_client.py#BaseClient._redirect_method' to resolve a parsed definition locally. A leaf name such as httpx/_client.py#_redirect_method works when unique in that file. Unresolved anchors fall back to model-guided search.

Warnings go to stderr in both output formats. An empty result after scan-budget exhaustion exits 6 while preserving stdout; a complete empty search exits 0. For large repositories, see scan-budget tuning.

Models select symbol or line anchors; the controller resolves bounded syntax regions and returns structural precision metadata. See the shared contract for evidence rules and limits.

Related MCP server: RepoGrammar

MCP

uvx --from 'flash-context[mcp]' flash-context mcp --transport stdio

Exposes search_repository(query, repo_root?, max_turns?, citation?). See MCP integration for editor configuration and source launches.

Documentation

License

Apache License 2.0.

Available Tools

1 tool
explore_repositoryD

Inputs: query (required), repo_root, max_turns, citation. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    D1.7/5.0

    Scored across 1 tool

    Disambiguation5/5

    Only one tool exists, so there is no possibility of ambiguity between tools.

    Naming Consistency5/5

    With a single tool, naming consistency is inherently perfect; no pattern deviations exist.

    Tool Count2/5

    A single tool is far too few for a server presumably focused on repository context, suggesting an underdeveloped or trivial surface.

    Completeness1/5

    A single generic 'explore' tool without any specialized operations (e.g., get commits, list branches) is severely incomplete for repository exploration.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides autonomous codebase exploration through a plan-execute-reflect-report pipeline, generating onboarding reports with file:line references. Exposes both a high-level investigation tool and low-level read-only file access tools via MCP.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Local, read-only MCP server for coding agents. Indexes repeated implementations in your repository (FastAPI routes, pytest fixtures, Pydantic and SQLAlchemy models) and returns source-backed examples with a bounded read plan, or a typed UNKNOWN when evidence is insufficient. No LLM or network calls.
      1
      13 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables people and AI agents to query local code repositories as graphs through stdio MCP tools for project listing, search, dependency tracing, impact analysis, bridge detection, node inspection, bounded code reading, and optional LSP definition/reference lookups.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Local-first code context CLI + MCP server: discover, index, and search repos; generate task-aware context packs, code maps, agent harnesses, and PR-review/merge-readiness gates for coding agents and reviewers.
      14
      476 npm
      3
      MIT