Files
last30days-skill/mcp/README.md
Matt Van Horn a1afbce84c feat(mcp): embed Python engine and extract to user cache
U2 of the Claude Desktop .mcpb bundle plan.

- internal/engine/embed.go embeds the vendored Python tree at build time
  via //go:embed all:vendored. The engine package owns the embed because
  Go's directive cannot reach outside its own package directory; sync and
  gitignore paths are updated to match (internal/engine/vendored/ in
  place of mcp/vendored/).
- internal/engine/extract.go materializes the embed into
  <cache>/last30days-pp-mcp/<version>/ with a .version sentinel that
  short-circuits re-extraction. Atomic rename from a .tmp sibling means
  a partial extraction can never be mistaken for complete. Concurrent
  first-call extractions serialize behind a per-cache-dir sync.Once.
- EnsureUserCache honors a LAST30DAYS_CACHE_DIR env override for
  locked-down filesystems; the override is named in extract errors.
- internal/engine/extract_test.go covers happy path, sentinel skip,
  version bump, 10-goroutine race, empty-version rejection, unwritable
  cache parent, and the env override (7 tests, all passing).
- A tracked vendored/.gitkeep anchors the embed path so the directive
  matches even before scripts/sync-engine.sh runs.
2026-05-17 20:46:29 -07:00

1.8 KiB

last30days-pp-mcp

Go MCP server that wraps the last30days Python engine for Claude Desktop. Packaged as a .mcpb bundle (drag-drop install into Claude Desktop).

The MCP server exposes a single research tool that mirrors the /last30days <topic> slash command available in Claude Code. At runtime the binary extracts the vendored Python engine into a per-user cache and shells out to python3 to produce the synthesis input Claude renders.

Architecture

  • cmd/last30days-pp-mcp/ - server entry point
  • internal/engine/ - embed.FS of the Python engine + cache extractor + subprocess wrapper
  • internal/tools/ - MCP tool handlers (currently research)
  • internal/engine/vendored/ - mirror of skills/last30days/scripts/, generated by scripts/sync-engine.sh (gitignored). Lives inside the engine package because //go:embed cannot reach files outside its own package directory.
  • manifest.json - MCPB v0.3 manifest consumed by Claude Desktop and printing-press bundle

Local build

# Mirror the Python engine into vendored/.
bash scripts/sync-engine.sh

# Build for the current host.
go build -ldflags "-X main.Version=dev" -o build/last30days-pp-mcp ./cmd/last30days-pp-mcp

# Package as a .mcpb (requires the printing-press binary on PATH).
printing-press bundle . --skip-build --binary build/last30days-pp-mcp

The output .mcpb lands at build/last30days-pp-mcp-<os>-<arch>.mcpb. Drag it into Claude Desktop's Extensions panel to install.

Runtime requirements

End users need Python 3.12+ on PATH. The bundle ships the engine source but relies on the host interpreter.

Versioning

The MCPB manifest.json version is hand-bumped in the same PR that ships engine changes worth releasing. Release CI stamps the Go binary's main.Version from the tag.