You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Investigate Multi-Server Tool Namespacing for MCP Client
24
25
@@ -32,10 +33,96 @@ The goal is to determine how the `Neo.ai.mcp.client.Client` should expose tools
32
33
3.**Implement Namespacing (Proposal):** Based on findings, refactor `Neo.ai.mcp.client.Client` or create a higher-level `Neo.ai.Agent` class that aggregates tools into `this.tools.<serverName>.<toolName>`.
33
34
4.**Update Client Config:** Ensure `ai/mcp/client/config.mjs` supports the multi-server setup.
34
35
36
+
## Comments
37
+
38
+
### @tobiu - 2025-11-29 23:31
39
+
40
+
**Input from Gemini 2.5:**
41
+
42
+
> ✦ I have conducted the **Multi-Server Experiment**.
43
+
>
44
+
> ### Findings
45
+
> ***Collision Confirmed:** All three servers (`github-workflow`, `knowledge-base`, `memory-core`) expose a `healthcheck` tool.
46
+
> ***Partial Collision:**`knowledge-base` and `memory-core` both expose `start_database` and `stop_database` tools.
47
+
> ***Current Behavior:** The `Neo.ai.mcp.client.Client` creates dynamic proxies on `this.tools`. If we were to merge these into a single object (e.g., in an Agent class), these collisions would be problematic.
48
+
>
49
+
> ### Proposed Solution: Server Namespacing
50
+
> As suggested in the ticket, we should namespace tools by server.
> 2. Actually, the `Client` represents a *single* connection. The namespacing should happen at the **Agent** level (or a new `ClientManager` class).
55
+
> 3. Since `Neo.ai.Agent` is not yet implemented, I propose refactoring `Client` to support an optional `namespace` config. If provided, tools are mounted at `client.tools[namespace]`. If not, they remain at `client.tools` (backward compatibility).
56
+
>
57
+
> **Correction:**
58
+
> Wait, `Neo.ai.mcp.client.Client` connects to **one** server.
59
+
> So `client.tools`*is* effectively namespaced by the client instance itself.
60
+
>
61
+
> In `test-multi-server.mjs`:
62
+
> ```javascript
63
+
>constghClient=...;
64
+
>constkbClient=...;
65
+
>
66
+
>ghClient.tools.healthcheck(); // GitHub health
67
+
>kbClient.tools.healthcheck(); // KB health
68
+
>```
69
+
>
70
+
> The collision only happens if we try to merge them.
71
+
>
72
+
> **Refined Proposal:**
73
+
> We don't need to change `Client.mjs` to namespace tools *internally*.
74
+
> Instead, the future `Neo.ai.Agent` should likely hold a map of clients:
> This seems cleaner than `this.tools.githubWorkflow.healthcheck`.
90
+
>
91
+
> **However**, for the "Agent OS" vision, we often want a unified toolbox.
92
+
> If we *do* want a unified toolbox, we can implement a `ToolAggregator` that handles collisions by prefixing.
93
+
>
94
+
> **Decision:**
95
+
> I will verify if `config.mjs` needs updates. It currently supports the map.
96
+
> I will conclude the investigation with the recommendation: **Keep Client simple. Handle aggregation in Agent/Manager.**
97
+
>
98
+
> For this ticket, I will clean up the test script and close it, as the "investigation" is complete and the "namespacing" is best handled by the consumer (Agent) rather than forcing it into the low-level Client.
99
+
>
100
+
> Wait, the ticket says: *"Implement Namespacing (Proposal): ... refactor Client or create Agent ... aggregates tools"*.
101
+
>
102
+
> I will write a simple `Neo.ai.Agent` MVP class now to demonstrate this aggregation pattern, as it is the natural next step and fulfills the "Implement" part of the ticket via the "higher-level class" option.
103
+
104
+
### @tobiu - 2025-11-29 23:44
105
+
106
+
**Input from Gemini 2.5:**
107
+
108
+
> ✦ I have completed the investigation and implementation for multi-server tool namespacing.
109
+
>
110
+
> ### Deliverables Completed
111
+
> 1. **Multi-Server Experiment & Analysis:** Confirmed tool name collisions and determined that namespacing is necessary.
112
+
> 2. **Implemented Namespacing:** Created the `Neo.ai.Agent` base class (`ai/Agent.mjs`) which:
> * Aggregates tools into a structured `this.tools.<serverName>.<toolName>` namespace, converting server names to camelCase for ergonomic access.
115
+
> 3. **Updated Demo Agent:** Refactored `ai/agents/mcp-demo-agent.mjs` to instantiate and use `Neo.ai.Agent`, demonstrating connections to multiple servers and usage of the namespaced tools.
116
+
> 4. **Clean-up:** Deleted the temporary `ai/mcp/client/test-multi-server.mjs` script.
117
+
>
118
+
> This establishes a clear and scalable architecture for agents to interact with multiple MCP servers. (Note: The observed `memory-core` output schema validation error is a bug in the `memory-core` server itself, unrelated to this client namespacing work).
119
+
35
120
## Activity Log
36
121
37
122
- 2025-11-29 @tobiu assigned to @tobiu
38
123
- 2025-11-29 @tobiu added the `enhancement` label
39
124
- 2025-11-29 @tobiu added the `ai` label
40
125
- 2025-11-29 @tobiu added the `refactoring` label
126
+
- 2025-11-29 @tobiu referenced in commit `82d9904` - "Feat: Implement Multi-Server Tool Namespacing for MCP Client #7941"
# Feat: Enable External Configuration and Generic Runner for MCP Client CLI
24
+
25
+
To align the MCP Client CLI with the server-side runner architecture, this task will enhance `ai/mcp/client/mcp-stdio.mjs` to support loading external configuration files via a `-c` option and remove unnecessary environment setup specific to direct Node.js execution.
26
+
27
+
### Deliverables
28
+
1.**Refactor `ai/mcp/client/mcp-stdio.mjs`:**
29
+
* Remove `#!/usr/bin/env node` shebang.
30
+
* Remove `dotenv` import and usage.
31
+
* Add a Commander option `-c, --config <path>` for specifying an external client configuration file.
32
+
* Integrate `ClientConfig.load(options.config)` to load and merge external configurations.
33
+
* Make `--server <name>` option optional (default action TBD, perhaps list available servers or require it for specific commands).
34
+
2.**Update Documentation:** Ensure JSDoc and comments reflect the new usage.
0 commit comments