🔒 avenor mcp: scope-filtered tool registration via --scope - #193
Open
sdougbrown wants to merge 1 commit into
Open
🔒 avenor mcp: scope-filtered tool registration via --scope#193sdougbrown wants to merge 1 commit into
sdougbrown wants to merge 1 commit into
Conversation
supervisor scope (default) registers the full control surface; agent scope registers only read-only introspection tools (status/result/events and workflow_status/inspect/events). Orchestrate, admin, and workflow-control tools (spawn/shutdown/answer_permission/follow_up/workflow_wait, workflow_complete/gate) are simply not registered in agent scope, so an agent-scoped consumer can observe runs but never mutate or drive them — enforced at registration time, no permission dialogs. --scope wins over the AVENOR_MCP_SCOPE env var, which wins over the default. Trailer: sparky/deepseek-flash
Owner
Author
|
@umpire-bot review |
| idleTimeout := fs.Duration("idle-timeout", 30*time.Minute, "idle timeout before server exits") | ||
| addr := fs.String("addr", "127.0.0.1:3748", "address to listen on for HTTP transport") | ||
| authToken := fs.String("auth-token", "", "bearer token required for HTTP transport (defaults to MCP_AUTH_TOKEN)") | ||
| scope := fs.String("scope", "", "tool scope: \"supervisor\" (default) or \"agent\"") |
There was a problem hiding this comment.
Coverage gap: the new --scope flag and AVENOR_MCP_SCOPE env-var resolution in runMCP (mcp.go:21, 39-51) is not exercised by any test. runMCP's only caller is main.go:37, and no test sets the flag or the env var; the internal/mcpserver/scope_test.go tests cover server-side scope behavior, not the CLI wiring. Add a test that exercises runMCP with --scope and AVENOR_MCP_SCOPE set/unset to lock in flag-wins-over-env, env-wins-over-default, and invalid-value rejection.
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.
Adds a
--scopeflag to theavenor mcpserver so the registered tool surface depends on scope.Why: the supervisor-facing control server exposes orchestrate/admin tools (spawn, shutdown, answer_permission, workflow control). Any consumer that should only observe — not mutate or drive — needs those tools absent at registration time, not gated by a permission dialog.
What changed:
--scopeacceptssupervisor(default) oragent;--scopewins over theAVENOR_MCP_SCOPEenv var, which wins over the default.supervisorscope registers the full control surface (unchanged default behavior).agentscope registers only read-only introspection tools (status,result,events,workflow_status,workflow_inspect,workflow_events). Orchestrate/admin/workflow-control tools are simply not registered.Scope note (intentional): this build wires the scoping machinery and the flag. Child backends today are provisioned with
avenor-channel-tools(messaging) or a backend sidecar — they never receive theavenor mcpsupervisor server — so children already cannot reach spawn/shutdown/answer_permission by construction. Injecting a real agent-scopedavenor mcpserver into children is a separate, structural child-provisioning change and is deliberately out of scope here.Tests:
TestScopeAgentExcludesControlTools,TestScopeSupervisorRegistersAllTools, plus default-supervisor coverage ininternal/mcpserver/scope_test.go. Fullgo build ./...,go vet, andgo test ./...pass.