Skip to content

Conversation

@ayakut16
Copy link
Contributor

@ayakut16 ayakut16 commented Mar 28, 2025

Description

Mock server doesn't work with the mcptools cli, e.g. mcp shell mcp mock tool mock-test "description" throws an error:

Error connecting to MCP server: command error: exit status 1, stderr: Added tool: mock-test - description
Starting mock MCP server with 1 tool(s), 0 prompt(s), and 0 resource(s)
Use Ctrl+C to exit
Mock server started, waiting for requests...
Waiting for request...
Received request: tools/list (ID: 1)
Sending response
Waiting for request...
Error decoding request: EOF
Error running mock server: error decoding request: EOF

In order to fix this, I modified the EOF handling in the Start() method to return nil instead of an error when EOF is encountered

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Run mcp shell ./bin/mcp mock tool mock-test "maybe-description" to make sure this fixes the issue described above.
Also added local configuration to claude code to ensure it still works:

"mock-test-local": {
  "command": "/path/to/mcptools/bin/mcp",
  "args": [
    "mock",
    "tool",
    "say_hi",
    "\"says hi\""
  ]
}

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own 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 in downstream modules

@f f merged commit 6a4476f into f:master Mar 28, 2025
2 checks passed
@f
Copy link
Owner

f commented Mar 28, 2025

Thank you this is great!

@ayakut16 ayakut16 deleted the bugfix/mock branch March 29, 2025 02:01
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.

2 participants