Skip to content

Let /mcp disable and /mcp remove take a name with * that applies to every server it fits - #4227

Merged
bbondy merged 2 commits into
brave:mainfrom
netzenbot:fix-mcp-wildcard-names
Nov 15, 2026
Merged

bbondy merged 2 commits into
brave:mainfrom
netzenbot:fix-mcp-wildcard-names

Conversation

@netzenbot

@netzenbot netzenbot commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #4225

User impact: /mcp remove brave-tabs* removes every server whose name starts with brave-tabs, and /mcp disable brave-* turns off every server whose name starts with brave-.

Decisions to confirm

  1. /mcp remove and /mcp disable take a name with * so one command applies to every matching server #4225: a * stands for any run of characters, anywhere in the word, and a word with a * and a character no alias has is refused. Instead: a prefix-only * at the end. Why: the issue's example is a prefix, and a general rule costs the same code and also covers *-read. Commit: Let /mcp disable and /mcp remove take a name with * that applies to every server it fits. To reverse: restrict is_alias_pattern and alias_matches in crates/config/src/mcp.rs.
  2. /mcp remove and /mcp disable take a name with * so one command applies to every matching server #4225: remove matches the aliases the session holds, the settings request and the state directory declares, and disable matches the ones the session holds and the settings request. Instead: only what the session holds. Why: remove <alias> works on a declaration that no session holds, so a pattern does too. Commit: same. To reverse: drop the declared aliases from remove_matching.
  3. /mcp remove and /mcp disable take a name with * so one command applies to every matching server #4225: matched aliases are handled in alphabetical order and a failure for one does not stop the rest. Instead: stop at the first failure. Why: each removal is independent, and the failure is said. Commit: same. To reverse: return from the loop in remove_matching on a failed removal.

The problem

#4225 /mcp remove and /mcp disable take one alias. Removing brave-tabs-manage and brave-tabs-read takes two commands, and a person with several servers under one prefix types one command for each.

Reproduce

  1. Start the terminal client in a directory whose settings request brave-tabs-manage, brave-tabs-read and brave-page-read.
  2. Type /mcp remove brave-tabs*.

Before this change the word brave-tabs* is refused as a word that is no alias. After it, both brave-tabs- servers are disabled and removed and brave-page-read keeps running. cargo test -p bravebot-tui mcp_command covers it.

The fix

#4225. /mcp disable and /mcp remove accept a word made of alias characters and at least one *. Each alias it fits is handled as if it had been typed alone, in alphabetical order, and a pattern that fits nothing says so and changes nothing. The pattern is never passed to the program. SERVERS-19 states it, and the website page, the changelog and the catalog (en-US and fr) describe it.

Test plan

  • BRAVEBOT_ALLOW_UNCONFIGURED_BUILD=1 cargo test -p bravebot-tui mcp_command --locked: passed
  • BRAVEBOT_ALLOW_UNCONFIGURED_BUILD=1 cargo test -p bravebot-config pattern --locked: passed
  • BRAVEBOT_ALLOW_UNCONFIGURED_BUILD=1 cargo clippy -p bravebot-config -p bravebot-tui --all-targets --locked -- -D warnings: passed
  • python3 contrib/check-lint-increase.py: failed on the first commit (one new clippy::string_slice site in alias_matches), passed after the second commit
  • a_pattern_names_the_aliases_whose_spelling_fits_around_its_stars: rejects a match that ignores the text after the last *; demonstrated by replacing the end check with || true, which fails it. The demonstration ran before the second commit, which changed the matcher's middle-text step and not the end check
  • a_pattern_has_a_star_and_only_the_characters_of_an_alias: rejects treating --help, ../* or a word with a space as a pattern; reasoned only
  • removing_by_a_pattern_removes_each_server_it_names_and_no_other and a_pattern_removal_that_fails_for_one_server_still_removes_the_others: reject a removal that reaches brave-page-read or stops at the first failure; reasoned only
  • disabling_by_a_pattern_turns_off_each_server_it_names_and_no_other: rejects a disable that touches a server the pattern does not fit; reasoned only
  • make check-affected: ran on the first commit only and stopped at the same lint check as CI. It was not run again on the head. CI covers the head.
  • CI: 30 passed, 0 failed on the head
    Docker gates skipped: host-only

…very server it fits (SERVERS-19)

A `*` in the argument of `/mcp disable` or `/mcp remove` stands for any run of characters, so `/mcp remove brave-tabs*` removes brave-tabs-manage and brave-tabs-read, and `/mcp disable brave-*` turns off every server whose name starts with `brave-`.

The pattern is matched against the aliases the session runs, the settings request and, for remove, the state directory declares. Each alias it names is handled as if it had been typed alone, in alphabetical order, through the same two program calls as before, and a failure for one is said and does not stop the others. A pattern that fits nothing says so and changes nothing. A word with a `*` and a character no alias has is not a pattern. The pattern is never passed to the program.

bravebot_config::mcp::is_alias_pattern and alias_matches hold the grammar and the match. SERVERS-19 states the behaviour and names the tests, the website page and the changelog describe it, and the catalog has the no-match sentence and the longer usage and hint lines, with the French translations.

Closes brave#4225
@netzenbot netzenbot self-assigned this Nov 15, 2026
The CI step that holds clippy::string_slice to the base failed: the matcher added a site in crates/config/src/mcp.rs by slicing `rest` after a `find`. `split_once` takes the text after the first occurrence of the part without slicing, so the count is back to the base's and the matching is unchanged.

Part of brave#4225
@bbondy
bbondy added this pull request to the merge queue Nov 15, 2026
Merged via the queue into brave:main with commit e9ef845 Nov 15, 2026
31 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.

/mcp remove and /mcp disable take a name with * so one command applies to every matching server

3 participants