Describe the bug
When using an MCP client to call the @modelcontextprotocol/server-filesystem server, a parameter validation error occurs. The server incorrectly expects a name field in the params object, but according to the MCP protocol, name should be at the top level of the call object.
To Reproduce
Steps to reproduce the behavior:
- Install required packages:
npm install @mcpilotx/sdk-core
- Create reproduction script
reproduce-bug.js:
const { MCPClient, createMCPConfig } = require('@mcpilotx/sdk-core');
async function reproduceBug() {
const config = createMCPConfig('stdio', {
command: 'npx',
args: ['@modelcontextprotocol/server-filesystem', '.'],
autoConnect: false,
timeout: 10000
});
const client = new MCPClient(config);
await client.connect();
try {
const result = await client.callTool('read_text_file', {
path: './package.json'
});
console.log('Success:', result);
} catch (error) {
console.log('Error message:', error.message);
console.log('Full error:', error);
}
await client.disconnect();
}
reproduceBug();
- Run the script:
- Observe the error output.
Expected behavior
According to the MCP protocol specification, the correct structure for a tool call request should be:
{
"jsonrpc": "2.0",
"id": "1",
"method": "tools/call",
"params": {
"call": {
"name": "read_text_file",
"arguments": {
"path": "./package.json"
}
}
}
}
The name field should be in the params.call object, not directly in the params object.
Logs
Running the reproduction script produces the following error:
Error message: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"params",
"name"
],
"message": "Invalid input: expected string, received undefined"
}
]
The error message shows that the server is validating params.name, which indicates the server expects the name field to be directly in the params object, not in params.call.
Additional context
- MCP Protocol Reference: According to the Model Context Protocol specification, the
params object of a tool call request should contain a call field, and the call field contains name and arguments
- Impact Scope: This bug affects all tool calls to
@modelcontextprotocol/server-filesystem using standard MCP clients
- Workaround: Currently no workaround is available as this is a server-side validation logic issue
- Test Environment:
- Node.js version: v22.17.1
@modelcontextprotocol/server-filesystem version: Unknown (npx doesn't show version with --version flag)
- Operating System: macOS
- MCP Client:
@mcpilotx/sdk-core 0.3.3
- Note: The server successfully connects and lists 14 available tools, but all tool calls fail with the same validation error
Suggested Fix
Fix the server-side parameter validation logic to correctly parse MCP protocol request structure:
- Validate
params.call.name instead of params.name
- Ensure compliance with MCP protocol specification
Describe the bug
When using an MCP client to call the
@modelcontextprotocol/server-filesystemserver, a parameter validation error occurs. The server incorrectly expects anamefield in theparamsobject, but according to the MCP protocol,nameshould be at the top level of thecallobject.To Reproduce
Steps to reproduce the behavior:
reproduce-bug.js:Expected behavior
According to the MCP protocol specification, the correct structure for a tool call request should be:
{ "jsonrpc": "2.0", "id": "1", "method": "tools/call", "params": { "call": { "name": "read_text_file", "arguments": { "path": "./package.json" } } } }The
namefield should be in theparams.callobject, not directly in theparamsobject.Logs
Running the reproduction script produces the following error:
The error message shows that the server is validating
params.name, which indicates the server expects thenamefield to be directly in theparamsobject, not inparams.call.Additional context
paramsobject of a tool call request should contain acallfield, and thecallfield containsnameandarguments@modelcontextprotocol/server-filesystemusing standard MCP clients@modelcontextprotocol/server-filesystemversion: Unknown (npx doesn't show version with --version flag)@mcpilotx/sdk-core0.3.3Suggested Fix
Fix the server-side parameter validation logic to correctly parse MCP protocol request structure:
params.call.nameinstead ofparams.name