Skip to content

Anchor project-only patterns in .mcpbignore#4

Merged
mgoldsborough merged 1 commit intomainfrom
fix/mcpbignore-anchor-patterns
Apr 24, 2026
Merged

Anchor project-only patterns in .mcpbignore#4
mgoldsborough merged 1 commit intomainfrom
fix/mcpbignore-anchor-patterns

Conversation

@mgoldsborough
Copy link
Copy Markdown
Contributor

Summary

Unanchored gitignore patterns in .mcpbignore match anywhere in the tree, including inside vendored deps/ or node_modules/. mcpb pack then strips legitimate runtime files from bundled packages.

The trap fired on synapse-research 0.1.1 and openweathermap 0.4.0 — an unanchored conftest.py pattern stripped deps/beartype/_conf/conftest.py (a real runtime module), breaking the FastMCP import chain and crashing the MCP subprocess with MCP error -32000: Connection closed.

This PR anchors project-only patterns with a leading /, leaves cross-tree hygiene (__pycache__/, *.pyc, .DS_Store) unanchored, and drops the redundant conftest.py rule (already covered by /tests/).

No behavior change for the currently-published artifact — this is preventive. The next release from this repo will produce a bundle that keeps vendored deps intact.

Matches the canonical .mcpbignore shape in mcp-server-template-python and mcp-server-template-typescript.

Test plan

  • make bundle (or equivalent) and confirm no regressions in the packaged output
  • On next release, verify the published bundle still starts cleanly

Unanchored gitignore patterns (no leading `/`) in .mcpbignore match
anywhere in the tree — including inside vendored `deps/` (Python) or
`node_modules/` (Node). mcpb pack then strips legitimate runtime
files from bundled packages, which can break imports when the bundle
starts.

The trap fired on synapse-research 0.1.1 and openweathermap 0.4.0:
an unanchored `conftest.py` pattern stripped `deps/beartype/_conf/
conftest.py` (a real runtime module, not a pytest config), and the
bundle failed with `MCP error -32000: Connection closed`.

Fix: anchor project-only patterns with a leading `/`, keep
cross-tree hygiene (`__pycache__/`, `*.pyc`, `.DS_Store`)
unanchored, and drop the redundant `conftest.py` rule (pytest
configs already live under `/tests/`).

No behavior change for the currently-published artifact; this is
preventive — the next release will produce a bundle that keeps
vendored deps intact.
@mgoldsborough mgoldsborough merged commit 337f52e into main Apr 24, 2026
3 checks passed
@mgoldsborough mgoldsborough deleted the fix/mcpbignore-anchor-patterns branch April 24, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant