Prefect tasks and flows for keeping jcodemunch-mcp code indexes fresh across many repositories.
Project description
prefect-jcodemunch
Prefect 3.x tasks and flows for keeping jcodemunch-mcp code indexes fresh across many repositories.
jcodemunch-mcp is a token-efficient MCP server that gives AI agents structural access to source code (symbols, call hierarchies, dead-code detection, refactor blast radius). It lives locally per-machine. Once you maintain indexes for more than a handful of repos, keeping them fresh becomes the kind of recurring orchestration problem Prefect is built for.
This package wraps the jcodemunch-mcp CLI as Prefect Tasks and Flows so you can:
- Schedule periodic reindexing of every repo on a cron
- Index on push by triggering a flow from a webhook
- Chain indexing into larger pipelines (e.g. doc generation, CI gates, agent provisioning)
- React to staleness by querying which repos haven't been touched in N days and refreshing only those
Install
pip install prefect-jcodemunch
This pulls in prefect>=3.0 and jcodemunch-mcp>=1.81.0 automatically. The jcodemunch-mcp binary needs to be on PATH (the install above puts it there).
Quick example
Reindex every locally-indexed repo whose index is more than 7 days old:
from prefect_jcodemunch import keep_indexes_fresh
if __name__ == "__main__":
keep_indexes_fresh(older_than_days=7)
Deploy on a daily cron via Prefect Cloud:
prefect deploy examples/keep_indexes_fresh.py:keep_indexes_fresh \
--name daily-reindex \
--cron "0 4 * * *" \
--pool default-agent-pool
Tasks
| Task | What it wraps |
|---|---|
index_local_folder(path) |
jcodemunch-mcp index <path> |
index_github_repo(owner_repo) |
jcodemunch-mcp index <owner>/<repo> |
index_file(path) |
jcodemunch-mcp index-file <path> (single-file refresh) |
list_repos() |
MCP list_repos tool — returns [{source_root, indexed_at, ...}, …] |
reindex_stale_repos(older_than_days=N) |
list_repos → filter by age → index_local_folder per stale repo |
All Tasks accept cli_path= to override the binary location, and pass through to standard Prefect kwargs (retries, timeout, tags) at decoration time.
Flows
| Flow | Purpose |
|---|---|
keep_indexes_fresh(older_than_days=7) |
The standard "schedule me on a cron" flow — walks every locally-indexed repo, refreshes anything older than the threshold |
Compose with other Prefect blocks
Tasks emit standard Prefect logs and respect retry/timeout config, so the usual blocks plug in:
- Slack / Discord notifications on flow failure via
prefect-slack/prefect-community - GitHub event triggers via
prefect-github - Result persistence to S3 / GCS / local FS via standard result storage blocks
License
This wrapper package (prefect-jcodemunch) is MIT.
The wrapped tool, jcodemunch-mcp, is dual-licensed: free for non-commercial use (personal, academic, research) and paid for commercial use. Commercial license tiers and pricing at j.gravelle.us/jCodeMunch. Review the terms before deploying in a commercial workflow.
Issues / contributions
Issues and PRs welcome at https://github.com/jgravelle/prefect-jcodemunch.
For jcodemunch-mcp itself (CLI / index format / MCP tools), file at https://github.com/jgravelle/jcodemunch-mcp/issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prefect_jcodemunch-0.1.0.tar.gz.
File metadata
- Download URL: prefect_jcodemunch-0.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1eb36aa8020ac0e141ce581112f3efb3306c95a4dfe8a4cfcc84eebab6c6d0f
|
|
| MD5 |
f8449b5d6c64fed58cf8407653240477
|
|
| BLAKE2b-256 |
e2315a92e2cf66d1843a6f2bef4867cd42aedaecc124730fd361e80a926e41fa
|
File details
Details for the file prefect_jcodemunch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prefect_jcodemunch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db1a104ff55c96f00e6e8b14b1bf6234d3ea44e18124cfc111cca5cb6bc30ede
|
|
| MD5 |
d65cf4cccfca9b84cf11eb533f7bf76b
|
|
| BLAKE2b-256 |
6842e1930221cefc157f84ef0c8a88c585ebf093ba51075e7ef53d2f3fb38d23
|