Skip to content

[per-component-executor] - MCP mcp-server-entity resolution scoped to the bound executor #1439

Description

@JoshuaRowePhantom

MCP mcp-server-entity resolution scoped to the bound executor

Part of design: #1432 — per-component-executor-binding
Design document: https://github.com/JoshuaRowePhantom/Phantom.Workspaces/blob/design/docs/design/per-component-executor-binding.md

Scope

When a tool id is mcp-server-entity, evaluate the search prefixes (machine profile → ${USER}/mcp-serversdefaults/mcp-servers) against the bound executor's profile/user context instead of the resolving instance's.

Files

The mcp-server-entity resolution code — Phantom.Workspaces/McpServerEntityToolResourceFactory.cs (the IToolResourceFactory that implements the documented prefix search).

Detailed design

Requirement 8 — Entity resolution scoped to bound executor. mcp-server-entity resource resolution MUST resolve in the context of the tool's bound executor (search order: machine profile → ${USER}/mcp-serversdefaults/mcp-servers), not the resolving instance.

Verified starting state (evidence). McpServerEntityToolResourceFactory(IDataAccessLayer dataAccessLayer, IReadOnlyList<EntityName> searchPrefixes) (Phantom.Workspaces/McpServerEntityToolResourceFactory.cs:21-113) already searches an ordered list of prefixesResolveToolResourceAsync iterates this.searchPrefixes, appends the resource name to each prefix, and returns the first match (:45-67, TryGetMcpServerConfigAsync at :69-96). So "highest priority first" is already the contract; this issue makes the prefix list itself reflect the BOUND executor's machine, so the remote machine's profile prefix is FIRST.

Cohesion seam — the remote MCP host handler (from #1438) MUST use this scoped resolver

The production remote MCP host handler added in #1438 (RemoteMcpHostHandler.OpenAsync, registered on the production McpTransportListener in WorkspacesTransportComposition) resolves the MCP tool config on the remote host by calling McpServerEntityToolResourceFactory(IDataAccessLayer, IReadOnlyList<EntityName> searchPrefixes) with the bound executor's machine prefix FIRST — search order: machine profile → ${USER}/mcp-serversdefaults/mcp-servers. This item owns constructing that scoped searchPrefixes list (bound machine first) and threading the bound-executor context into resolution so the lookup uses the bound executor's profile/user context, not the resolving instance's.

#1438#1439 touchpoint (make explicit)

This is a two-way touchpoint, not a change to the dependency direction:

Gap addressed: G5 — MCP mcp-server-entity resolution is not scoped to the bound executor's profile→user→defaults context.

Data flow (Commit 7):
12. When a tool's id is mcp-server-entity, the search prefixes (machine profile → ${USER}/mcp-serversdefaults/mcp-servers) are evaluated against the bound executor's profile/user context, not the resolving instance's — including when resolution happens inside #1438's remote host handler.

Tests

McpServerEntityBoundExecutorResolutionTests (Phantom.Workspaces.Llm.Core.Tests)

Testing strategy — MCP entity resolution scoped to bound executor: Resolves against the bound executor's machine profile first, then ${USER}/mcp-servers, then defaults/mcp-servers; correct fallback order; uses the bound executor's context, not the resolving instance's; and the remote-host-handler path (#1438) exercises the same machine-prefix-first ordering. → McpServerEntityBoundExecutorResolutionTests.

Dependencies

Depends on: #1438 — Per-tool MCP execution over transport + production remote MCP host (provides the RemoteMcpHostHandler / production McpTransportListener shell this scoped resolver is consumed by).

Touchpoint with #1438#1438's remote host handler CONSUMES this item's scoped McpServerEntityToolResourceFactory (machine prefix first). Two-way seam; dependency direction unchanged.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions