Skip to content

feat(mcp): add repository list/add/rename/remove tools#3766

Open
Ankitsinghsisodya wants to merge 1 commit into
knative:mainfrom
Ankitsinghsisodya:feat/mcp-repository-tools
Open

feat(mcp): add repository list/add/rename/remove tools#3766
Ankitsinghsisodya wants to merge 1 commit into
knative:mainfrom
Ankitsinghsisodya:feat/mcp-repository-tools

Conversation

@Ankitsinghsisodya
Copy link
Copy Markdown
Contributor

Changes

  • Add repository_list MCP tool to list installed template repositories
  • Add repository_add MCP tool to install a repository by name and URL
  • Add repository_rename MCP tool to rename an installed repository
  • Add repository_remove MCP tool to remove an installed repository from local disk
  • Register all four tools and their help resources in the MCP server
  • Add full test coverage for happy path, readonly guards, and error propagation

/kind enhancement


Summary

This PR exposes func repository subcommands as MCP tools, closing the gap between the CLI surface and the MCP tool surface for template repository management.

Previously, an agent could call create with a --repository flag pointing to a remote URL, but had no way to persistently install, list, rename, or remove template repositories. With these tools, an agent can now manage the full lifecycle of local template repositories before scaffolding new functions.

Tools Added

Implemented in pkg/mcp/tools_repository.go:

Tool CLI equivalent Readonly safe
repository_list func repository list Yes
repository_add func repository add <name> <url> No — blocked in readonly mode
repository_rename func repository rename <old> <new> No — blocked in readonly mode
repository_remove func repository remove <name> No — blocked in readonly mode

All write tools (add, rename, remove) return an error when the server is in readonly mode (i.e. FUNC_ENABLE_MCP_WRITE is not set), consistent with delete and deploy.

Tests

Added pkg/mcp/tools_repository_test.go with 11 test cases:

  • Happy path for each tool (subcommand and positional args verified)
  • --verbose flag is forwarded when set
  • Readonly guard correctly blocks add, rename, remove
  • Executor errors are propagated as MCP error results for all tools
go test -v ./pkg/mcp/...

All existing tests continue to pass.


Release Note

Added MCP tools `repository_list`, `repository_add`, `repository_rename`, and `repository_remove` to manage installed template repositories from an agent context.

This commit introduces new tools for managing template repositories, including listing, adding, renaming, and removing repositories. Each tool is accompanied by a handler in the MCP server and relevant input/output structures. Additionally, comprehensive tests have been added to ensure the correct functionality of these tools, including error handling and readonly mode checks.
Copilot AI review requested due to automatic review settings May 16, 2026 15:25
@knative-prow knative-prow Bot added the kind/enhancement Feature additions or improvements to existing label May 16, 2026
@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos May 16, 2026 15:25
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ankitsinghsisodya
Once this PR has been reviewed and has the lgtm label, please assign jrangelramos for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added size/XL 🤖 PR changes 500-999 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels May 16, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 16, 2026

Hi @Ankitsinghsisodya. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.21%. Comparing base (2bbf9fe) to head (eeb129c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3766      +/-   ##
==========================================
+ Coverage   57.06%   57.21%   +0.14%     
==========================================
  Files         181      182       +1     
  Lines       21145    21214      +69     
==========================================
+ Hits        12067    12138      +71     
+ Misses       7855     7853       -2     
  Partials     1223     1223              
Flag Coverage Δ
e2e 35.81% <0.00%> (-0.11%) ⬇️
e2e go 31.33% <0.00%> (-0.13%) ⬇️
e2e node 27.13% <0.00%> (-0.12%) ⬇️
e2e python 31.70% <0.00%> (-0.13%) ⬇️
e2e quarkus 27.25% <0.00%> (-0.12%) ⬇️
e2e rust 26.66% <0.00%> (-0.11%) ⬇️
e2e springboot 25.18% <0.00%> (-0.11%) ⬇️
e2e typescript 27.24% <0.00%> (-0.12%) ⬇️
e2e-config-ci 28.18% <0.00%> (-0.12%) ⬇️
integration 17.28% <0.00%> (-0.10%) ⬇️
unit macos-14 45.26% <100.00%> (+0.20%) ⬆️
unit macos-latest 45.26% <100.00%> (+0.20%) ⬆️
unit ubuntu-24.04-arm 45.49% <100.00%> (+0.17%) ⬆️
unit ubuntu-latest 46.21% <100.00%> (+0.20%) ⬆️
unit windows-latest 45.30% <100.00%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Feature additions or improvements to existing needs-ok-to-test 🤖 Needs an org member to approve testing size/XL 🤖 PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant