Skip to content

mcp: match multi-part starlark extensions in repository scanner - #4911

Open
a-palamarchuk wants to merge 1 commit into
redpanda-data:mainfrom
a-palamarchuk:mcp-scanner-starlark-extensions
Open

a-palamarchuk wants to merge 1 commit into
redpanda-data:mainfrom
a-palamarchuk:mcp-scanner-starlark-extensions

Conversation

@a-palamarchuk

Copy link
Copy Markdown

What

The MCP repository scanner (used by mcp-server, mcp-server lint and dry-run)
lists .star.py and starlark as Starlark resource extensions, but matches them
against filepath.Ext. That function returns only the final extension (.py for
tool.star.py) and always includes the leading dot, so neither entry could ever
match. Files using those extensions were silently skipped and only .star files
were loaded.

This switches the matcher to suffix comparison and corrects starlark to
.starlark.

Reproduce (before this change)

A repository with resources/a.star, resources/b.star.py and
resources/c.starlark, each defining one mcp_tool(...):

$ redpanda-connect mcp-server ./repo   # tools/list
["from_star"]                           # b.star.py and c.starlark ignored, no warning

After: ["from_star", "from_star_py", "from_starlark"], and both new tools execute.

Tests

  • New TestScannerStarlarkExtensions (fails on main, passes here). It also covers
    negative cases so the suffix match can't over-reach: a plain plain.py, a file
    named notstarlark, and starlark.txt are still ignored.
  • Existing TestScannerHappy / TestScannerRoot still pass, covering .yml/.yaml
    matching for templates, resources and o11y config.
  • go test -race -shuffle=on ./internal/mcp/..., the in-process MCP integration
    tests (-run '^TestIntegrationMCP'), and ./internal/cli/ all pass.
    golangci-lint run and golangci-lint fmt --diff are clean.

Notes

  • Behaviour change: .star.py / .starlark files that were previously ignored in
    resources/ will now be evaluated, so an invalid one would now fail startup the
    same way an invalid .star file already does.
  • Out of scope: dry-run returns "resource type 'starlark' is not supported yet"
    for Starlark files. That was already true for .star; this change only makes the
    other two extensions behave consistently with it.

The MCP repository scanner lists ".star.py" and "starlark" as Starlark
resource extensions, but it compared them against filepath.Ext, which only
returns the final extension (".py" for "tool.star.py") and always includes
the leading dot. Neither entry could ever match, so those files were
silently skipped and only ".star" files were loaded.

Match on suffix instead, and fix "starlark" to ".starlark".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Oct 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

2 participants