Skip to content

fix(cli): initialize MCP before listing servers in test/exec/remove commands - #246

Closed
murdore with Copilot wants to merge 2 commits into
releasefrom
copilot/fix-mcp-test-server-count
Closed

murdore with Copilot wants to merge 2 commits into
releasefrom
copilot/fix-mcp-test-server-count

Conversation

Copilot AI commented Nov 22, 2025 •

Copy link
Copy Markdown
Contributor

Pull Request

Description

mcp test, mcp exec, and mcp remove commands report 0 servers while mcp list correctly loads servers from .mcp-config.json. Root cause: listMCPServers() doesn't trigger MCP initialization. Only executeList() calls getMCPStatus() which internally invokes initializeMCP() to load the config file.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🧹 Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test coverage improvement
  • 🔧 Build/CI configuration change

Related Issues

  • Fixes #(issue number from problem statement)

Changes Made

  • Added await sdk.getMCPStatus() before sdk.listMCPServers() in executeTest() (line 705)
  • Added await sdk.getMCPStatus() before sdk.listMCPServers() in executeExec() (lines 820-821)
  • Added await sdk.getMCPStatus() before sdk.listMCPServers() in executeRemove() (lines 946-947)

Before:

const sdk = new NeuroLink();
let serversToTest = await sdk.listMCPServers(); // Returns [] - MCP not initialized

After:

const sdk = new NeuroLink();
await sdk.getMCPStatus(); // Triggers initializeMCP() -> loads .mcp-config.json
let serversToTest = await sdk.listMCPServers(); // Returns configured servers

AI Provider Impact

  • OpenAI
  • Anthropic
  • Google AI/Vertex
  • AWS Bedrock
  • Azure OpenAI
  • Hugging Face
  • Ollama
  • Mistral
  • All providers
  • No provider-specific changes

Component Impact

  • CLI
  • SDK
  • MCP Integration
  • Streaming
  • Tool Calling
  • Configuration
  • Documentation
  • Tests

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • E2E tests added/updated
  • Manual testing performed
  • All existing tests pass

Test Environment

  • OS: Linux
  • Node.js version: 20.x
  • Package manager: pnpm 10.x

Performance Impact

  • No performance impact
  • Performance improvement
  • Minor performance impact (acceptable)
  • Significant performance impact (needs discussion)

Breaking Changes

None. Behavioral fix makes commands consistent with mcp list.

Screenshots/Demo

N/A

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

No test infrastructure exists for CLI commands. Comments added inline to document initialization requirement. CodeQL scan: 0 alerts. Code review: no issues.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.54/linux64/chrome-linux64.zip
    • Triggering command: /usr/local/bin/node node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Bug: 'mcp test' reports 0 servers while 'mcp list' correctly finds servers</issue_title>
<issue_description>### Problem

When running the neurolink CLI, the mcp list command and mcp test command give contradictory results.

mcp list correctly finds and connects to all servers in the .mcp-config.json file, but mcp test incorrectly reports "0 servers."

Steps to Reproduce

  1. Have a valid .mcp-config.json file with multiple servers (e.g., filesystem, slack, jira).
  2. Run pnpm dlx @juspay/neurolink mcp list.
  3. Observe the correct output: ✔ Found 3 MCP servers (or similar).
  4. Run pnpm dlx @juspay/neurolink mcp test.

Expected Behavior

mcp test should find and test the same 3 servers that mcp list found.

Current Behavior

mcp test reports:

✔ Testing 0 servers
🎉 All 0 servers connected successfully</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai

coderabbitai Bot commented Nov 22, 2025

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Fix 'mcp test' to report correct server count fix(cli): initialize MCP before listing servers in test/exec/remove commands Nov 22, 2025
Copilot AI requested a review from murdore November 22, 2025 15:30
@murdore

murdore commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Closing as part of project audit (2026-03-29). This PR contains useful patterns documented in the audit report, but is too stale or conflicting to merge directly. The valuable ideas will be applied manually where appropriate. See docs/project-audit-2026-03-29.md.

@murdore murdore closed this Mar 29, 2026
@murdore
murdore deleted the copilot/fix-mcp-test-server-count branch March 29, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: 'mcp test' reports 0 servers while 'mcp list' correctly finds servers

2 participants