Repository navigation
feat(mcp): mount a default agent's requested server without grants - #25802
Closed
vnlebaoduy wants to merge 1 commit into
Closed
vnlebaoduy wants to merge 1 commit into
vnlebaoduy wants to merge 1 commit into
Conversation
buluoray
force-pushed
the
feat/request-server-25157
branch
from
October 29, 2026 17:37
b405629 to
cc3a9c3
Compare
buluoray
force-pushed
the
feat/request-server-25157
branch
7 times, most recently
from
October 30, 2026 01:43
b82bf00 to
82d3dc0
Compare
vnlebaoduy
force-pushed
the
feat/mount-only-server-requests
branch
from
October 30, 2026 02:17
3612a3d to
607c011
Compare
buluoray
force-pushed
the
feat/request-server-25157
branch
from
October 30, 2026 02:41
82d3dc0 to
d489c40
Compare
vnlebaoduy
force-pushed
the
feat/mount-only-server-requests
branch
from
October 30, 2026 04:00
607c011 to
ce2958c
Compare
buluoray
force-pushed
the
feat/request-server-25157
branch
from
October 30, 2026 04:15
d489c40 to
4d0e594
Compare
buluoray
force-pushed
the
feat/request-server-25157
branch
2 times, most recently
from
October 30, 2026 05:45
b2dc484 to
6d643d5
Compare
A request_server card refused the default agent and the worker, because the MCP page's add also approves every tool of the server and a mid-chat card must not be a second path to that grant. Record a mount-only addition on the default template instead. The rebuild merges its entry into mcpServers and adds the @server ref to tools, writes no allowedTools grant, and keeps that disposition while the server is also on the MCP page. The worker mirrors the default spec, so one record reaches both. Fixes kirodotdev#25771
vnlebaoduy
force-pushed
the
feat/mount-only-server-requests
branch
from
October 30, 2026 06:24
ce2958c to
7ace0c7
Compare
5 tasks done
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem / Motivation
Goal: the default
kirocrewagent and thekirocrew-workercan get an MCP server fromrequest_servermid-chat, mounted with no tool approval.Both were refused
409 use_mcp_page: their servers come from the MCP page, and the MCP page's add also approves every tool of the server (sync_shared_server_refswrites@serverintoallowedTools). A card for "add this server" would therefore have granted more than it said. The result was that the agent with the widest reach — the default agent every chat starts on — could not ask for the one thing the feature exists for.Why it matters
A session running on the default agent is the most common place to discover a missing server. Refusing there leaves the MCP page as the only route, which is the full-grant route, and forces the user to leave the conversation to add it. A mount-only card closes the gap without widening trust: the server runs, every call still asks.
Not a goal
autoApproveorallowedTools, and the record refuses both.template.mcp_servercard already exists; this changes what it records for two templates.What changed (motivation → approach → change)
Symptom: a default-agent request answered
409 use_mcp_pageand raised no card.Cause: the handler refused every template in
DEFAULT_TEMPLATES, and the additions record refused them too, because a normal addition would be granted on the next rebuild.Change:
template_mcp_additionsgains amount_onlydisposition on an addition. The default agent accepts an addition only with it (and the worker accepts none: a worker record would never merge); a hand-edited default entry without the flag is skipped on read, so the record cannot become a grant path by accident.mount_only: true; the card's apply step carries it, and the owner-only step records it.spec_rebuildmerges the default template's recorded additions before resolving MCP servers, so the entry is resolved like any other.sync_shared_server_refsgains amount_onlyset and withholds the grant for those names through its existing governance-withhold path: the@serverref stays intoolsand is stripped fromallowedTools, so the server is mounted and every call asks.docs/architecture/mcp.md, the feature-map row and the record's module doc state the new shape.Backwards compatibility
Compatible:
mount_onlyis an optional field on a record entry; an existing record without it keeps its current meaning, and only the default template requires it (it previously accepted no additions at all, so no stored record changes meaning). A normal addition to the default is still refused, and the worker still records nothing. The MCP page,allowedToolsgrants, and every other template are unchanged. Removes nothing.Tests
test/test_template_server_request.py: akirocrewand akirocrew-workerrequest now raise a card withparams.mount_only, the apply step carries it, the record lands onkirocrewwithmount_only=True, and the worker is named in the card's reach. Existing conductor and third-party flows are unchanged.test/test_template_mcp_additions.py: a mount-only default addition round-trips,mount_only_namesreports it, reach includes the worker, and the merge mounts without granting; a default addition without the flag, a worker addition, and a hand-edited default entry are all refused or skipped.test/test_secret_uri_launch_paths.py:sync_shared_server_refs(mount_only=...)keeps@serverintools, removes it (and per-tool grants) fromallowedTools, and leaves ordinary servers granting as before.test/test_agent_mcp_merge.py: a fullinstall_agentrebuild writes the recorded server intokirocrew.jsonwith its@servermount and noallowedToolsentry.test/test_template_server_request.py+test_template_mcp_additions.py+test_agent_mcp_merge.py+test_secret_uri_launch_paths.pypass 168/168; the change-card suites pass 183/183 with one deselected (the inherited failure below).test_agent_install.py+test_worker_agent.py+test_mcp_hot_reload.pypass 215/215. black, isort, flake8, mypy on the changed modules andscripts/docs-lint.shpass.Proof: PROVEN test/test_template_server_request.py::test_a_default_or_worker_request_raises_a_mount_only_card, test/test_template_mcp_additions.py::test_a_default_mount_only_addition_round_trips_and_reaches_the_worker (head 3612a3d)
Manual verification
The card and the record are exercised end to end through the real routes and the real card engine in
test_template_server_request.py;test_agent_mcp_merge.pydrives the real installer and reads the emittedkirocrew.json. No UI component changed, so there is no screenshot.Related Issues
Fixes #25771. Stacked on #25180 (
feat/request-server-25157): merge #25180 first, then retarget this PR tomain.The base branch currently fails
test/test_change_cards.py::test_every_hooked_route_is_a_real_registered_route: #25180 registers the twomcp-additionsroutes throughapp.router.add_routein a loop, while that test only matchesadd_delete("...")/add_post("..."). The failure is inherited, not introduced here; this diff does not touch route registration or that test.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.