Skip to main content

PocketDex MCP

tests license python Glama M8ven Score

A tiny local code index for AI agents, served over MCP. One Python file, no dependencies, no background server, no vectors — just SQLite FTS5.

Ask an agent "where are badge rules calculated?" and it gets a file path, a line range, and a short highlighted snippet instead of opening five files.

PocketDex terminal demo

Why

An agent exploring a repo opens file after file, and every file costs context. PocketDex indexes the folder once, then answers search with the passage the agent needs.

Measured on a 34-file Flask app:

Query Result size app.py alone
parse_amount_cents ~120 tokens ~4,442 tokens
badge rules ~69 tokens ~4,442 tokens
sqlite connection ~285 tokens ~4,442 tokens

Index time: 0.06 s. Index size: ~0.5 MB. Query latency: 8–29 ms. (Token counts are characters / 4, an approximation.)

Why it is different

PocketDex MCP Shared code index grep / rg
Dependencies None (stdlib only) Service + client None
Setup One file, no install Install + run server None
Storage One DB per project Often one shared index None
Results Ranked passages + lines Ranked passages Raw matching lines
Context cost Low Low Low, but no ranking
Best at 20–500 files Large repos / corpora One known symbol

The important design choice is isolation. Each project gets its own database inside PocketDex's folder:

PocketDex/
├── pocketdex.py
├── data/projects/
│   ├── my-app-3f2a1b9c.db
│   └── other-api-7d1e0c44.db
├── tests/
└── ARCHITECTURE.md
  • Nothing is written into the project being indexed.
  • Two projects never share a database, so results cannot leak across them.
  • Deleting a .db file removes that project's index completely.
  • There is no central registry that can drift out of sync.

Override the location with --data-dir or POCKETDEX_DATA. Run from a clone, data stays in data/projects/ (gitignored). Installed from PyPI, it uses ~/.local/share/pocketdex/projects/, so upgrading or clearing the uv cache never touches your index.

rg is still the right tool for one known symbol. PocketDex is for exploring an unfamiliar repo without paying for whole files.

Install

The package is on PyPI. Run it without a permanent install:

uvx pocketdex-mcp --help
uvx pocketdex-mcp index ~/Projects/my-app
uvx pocketdex-mcp serve

Or install it once:

pip install pocketdex-mcp
pocketdex --help

uvx caches the package, so subsequent runs are instant. If your MCP client does not inherit your shell PATH, use the absolute path to uvx in the config below.

Prefer a clone? It is one file with no dependencies:

git clone https://github.com/sujalkumar1029-gif/pocketdex-mcp.git
cd pocketdex-mcp
python3 pocketdex.py --help

Requirements: Python 3.10+ and SQLite built with FTS5 (standard in CPython builds).

Docker

Build the stdio server into a small image:

docker build -t pocketdex-mcp .
docker run --rm -i pocketdex-mcp

The index lives under /app/data inside the container. To keep it between runs, use a named volume:

docker run --rm -i -v pocketdex-data:/app/data pocketdex-mcp

Quick start

# index or refresh a project (incremental)
python3 pocketdex.py index ~/Projects/my-app

# search
python3 pocketdex.py search "parse_amount_cents"
python3 pocketdex.py search "badge rules" --limit 5
python3 pocketdex.py search "connect" --path-prefix src/db

# inspect every project's separate index
python3 pocketdex.py stats

# MCP server (what the agent runs)
python3 pocketdex.py serve

search without --project uses the most recently indexed project. Pass --project ~/Projects/other when several are indexed.

MCP configuration

Add this to your MCP client's config (for example ~/.gemini/config/mcp_config.json for Antigravity):

{
  "mcpServers": {
    "pocketdex": {
      "command": "uvx",
      "args": ["pocketdex-mcp", "serve"]
    }
  }
}

If you run from a clone instead, use "command": "python3" and "args": ["/absolute/path/to/pocketdex.py", "serve"].

Tools exposed:

Tool Purpose
index_project Index or refresh one folder into its own DB. Incremental.
search Keyword/identifier search in one project, with snippets.
stats Every indexed project, its DB path, file/chunk counts, size.

Reproduce the numbers

python3 benchmark.py ~/Projects/my-app

It indexes the folder, prints index time and database size, then measures the approximate token cost of a few queries against the total source size.

How it works

  • Walks the folder, skipping .git, node_modules, .venv, dist, build output, lockfiles, hidden folders, files over 512 KB, and binaries.
  • Splits files into 40-line chunks with 12 lines of overlap.
  • Stores chunks in SQLite FTS5 with _ as a token character, so parse_amount_cents stays one searchable token.
  • BM25 ranking, at most two results per file, snippets capped at 12 tokens of context.
  • Re-indexing compares mtime_ns and size; unchanged files are skipped.

ARCHITECTURE.md explains the data model, indexing pipeline, ranking, MCP lifecycle, failure modes, and extension points.

Limits (on purpose)

  • No embeddings / vector search. Keyword + prefix matching only. Code search is dominated by exact identifiers.
  • No regex tool. Add one only if a real need appears.
  • Small-to-medium projects. A 20–500 file range is the target; a multi-GB monorepo belongs on a dedicated search service.
  • No file watching. Call index_project after large edits; unchanged files are cheap to skip.
  • Plaintext index. Treat the data folder with the same care as the source it indexes.

Tests

python3 -m pip install pytest
python3 -m pytest -q

11 tests: indexing, ignored dirs, binary skip, incremental re-index, deletion, path filters, stats, per-project isolation, latest-project selection, and a real MCP stdio handshake (initialize → tools/list → tools/call).

Status

Early (0.x). The MCP contract and CLI are stable; internals may change. Issues and pull requests are welcome.

If PocketDex saves you tokens, a star helps other agent builders find it.

License

MIT — see LICENSE.

Metadata

Release files for pocketdex-mcp 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pocketdex-mcp 0.2.2
File Size Uploaded Provenance Actions
pocketdex_mcp-0.2.2.tar.gz 18.7 kB With provenance Details for pocketdex_mcp-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pocketdex-mcp 0.2.2
File Interpreter ABI Platform Actions
pocketdex_mcp-0.2.2-py3-none-any.whl Python 3 none any Details for pocketdex_mcp-0.2.2-py3-none-any.whl

Total release size: 32.4 kB

Release files / pocketdex_mcp-0.2.2.tar.gz

Download URL pocketdex_mcp-0.2.2.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6ef6388d57df127b75cf1e15e3bc7b770759d5f40ee770b1d2c7189ff50d5bd3
BLAKE2b-256 checksum
How to use checksums
de7cbf0665590e8ccc1ec30d1ae4d79f01b603dc69c47c948dd120c2c94bc716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pocketdex_mcp-0.2.2-py3-none-any.whl

Download URL pocketdex_mcp-0.2.2-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8fb7d51dd4eed63312098bde0913098c819b5a268d6af606a50526616e46ec9
BLAKE2b-256 checksum
How to use checksums
d13ece77777b2219afffad0f51d7709897a4813c1ae087f0e8962d8e65ade3f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for pocketdex-mcp 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pocketdex_mcp-0.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page