Skip to content

Anchor project-only patterns in .mcpbignore template#12

Merged
mgoldsborough merged 1 commit into
mainfrom
fix/mcpbignore-anchor-template
Jun 22, 2026
Merged

Anchor project-only patterns in .mcpbignore template#12
mgoldsborough merged 1 commit into
mainfrom
fix/mcpbignore-anchor-template

Conversation

@mgoldsborough

Copy link
Copy Markdown
Contributor

Summary

  • Unanchored gitignore patterns in `.mcpbignore` match anywhere in the tree, including inside vendored `deps/`. `mcpb pack` then strips legitimate runtime files from bundled packages, breaking imports at startup.
  • Discovered via `synapse-research`: `conftest.py` in `.mcpbignore` stripped `deps/beartype/_conf/conftest.py` (a real runtime module, not a pytest config), and the bundle failed with `MCP error -32000: Connection closed`. Fixed in `synapse-research@0.1.2`.
  • This template change anchors project-only patterns with leading `/` and drops `conftest.py` (redundant with `/tests/`; too greedy).

Test plan

  • Create a new Python MCP server from this template
  • Run `make bundle` and confirm `deps/` modules with names like `conftest.py` are retained

Unanchored gitignore patterns (no leading `/`) match anywhere in the
tree — including inside `deps/`. Patterns like `tests/`, `docs/`, or
`conftest.py` end up stripping legitimate runtime files from vendored
dependencies, breaking imports when the bundle starts.

Split the template into two sections:
  1. Strip anywhere (`__pycache__`, `*.pyc`, `.DS_Store`) — safe
     cross-tree hygiene.
  2. Project-only (anchored with `/`) — patterns that must only match
     at the project root.

Also drops `conftest.py` (redundant with `/tests/`, and collides with
legitimate runtime modules like `beartype._conf.conftest`).
@mgoldsborough mgoldsborough merged commit c4c16cf into main Jun 22, 2026
3 of 4 checks passed
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