Frontmatter
| id | 7951 |
| title | Enhance MCP Client with Connection State and Env Validation |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Nov 30, 2025, 4:22 PM |
| updatedAt | Nov 30, 2025, 4:31 PM |
| githubUrl | https://github.com/neomjs/neo/issues/7951 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 7931 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Nov 30, 2025, 4:31 PM |
Enhance MCP Client with Connection State and Env Validation
tobiu added parent issue #7931 on Nov 30, 2025, 4:22 PM
tobiu assigned to @tobiu on Nov 30, 2025, 4:22 PM

tobiu
Nov 30, 2025, 4:31 PM
Input from Gemini 2.5 pro:
✦ I have successfully implemented connection state tracking and environment validation in
Neo.ai.mcp.client.Client.Changes
- Configuration: Updated
ai/mcp/client/config.mjsto includerequiredEnvfor our default servers (GH_TOKEN,GEMINI_API_KEY).- Client Enhancement:
- Added
connectedstate (boolean).- Added
requiredEnvconfig.- Updated
initAsyncto validaterequiredEnvagainstthis.env(andprocess.envfallback) before connection.- Updated
initAsyncto setconnected = trueon success.- Updated
closeto setconnected = false.- Updated
callToolandlistToolsto throw if!connected.Verification
Ran
mcp-demo-agent.mjs. It connected successfully, indicating the environment checks passed (my environment has the keys). The agent output confirms the clients are operational. I verified the new state properties in the debug log.I am ready to close this ticket.
tobiu closed this issue on Nov 30, 2025, 4:31 PM
Context
A recent architectural review suggested improvements to the
Neo.ai.mcp.client.Clientconfiguration and state management.Goal
Enhance the MCP Client with connection state tracking and environment variable validation to improve robustness and developer experience.
Requirements
connectedconfig toClient.mjs.trueafter successful connection ininitAsync. Set tofalseinclose.requiredEnvsupport toai/mcp/client/config.mjsandClient.mjs.ClientConfigschema (conceptually) to support arequiredEnv: String[]array in the server definition.Client.mjsinitAsync, check if the defined required environment variables exist in theenvobject (orprocess.env). Throw a descriptive error if any are missing before attempting to spawn the server process.Deliverables
ai/mcp/client/Client.mjs.ai/mcp/client/config.mjs(example/default config to include required envs for our servers, e.g.,GH_TOKEN).