Describe the bug
The @modelcontextprotocol/server-filesystem MCP server accepts and successfully handles tools/list before the client completes the required MCP lifecycle handshake (initialize → notifications/initialized). The server returns a normal JSON-RPC result instead of rejecting the request as out-of-order.
This breaks the expected MCP session state machine: compliant clients assume that only initialize is valid until the handshake completes. Allowing other methods early can mask misconfigured clients, weaken assumptions used by security tooling, and make session-scoped state (capabilities, auth context, subscriptions) harder to reason about.
Environment
OS: Linux (Proxmox VE host)
MCP server build: ships with current Cursor Desktop (Node-based, secure-filesystem-server v0.2.0, per server log line "serverInfo":{"name":"secure-filesystem-server","version":"0.2.0"})
To Reproduce
Start the filesystem MCP server with a valid allowed directory, e.g.:
npx -y @modelcontextprotocol/server-filesystem /tmp
Do not send initialize or notifications/initialized.
Send a JSON-RPC request for tools/list over stdio, e.g.:
{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}
Observe the response.
Expected behavior
Before the MCP handshake completes, the server should:
- Reject all methods except
initialize (and any explicitly documented pre-init exceptions, if the spec allows them).
- Return a structured JSON-RPC error (e.g. invalid request / server not initialized), not a successful
result.
- Optionally log a clear diagnostic on stderr indicating that the client violated lifecycle ordering.
After a valid initialize + notifications/initialized sequence, tools/list should succeed as usual.
Actual behaviour
Without any prior initialize call, tools/list is executed successfully and the server returns a JSON-RPC response containing result (tool enumeration), as if the session were already initialized.
Describe the bug
The
@modelcontextprotocol/server-filesystemMCP server accepts and successfully handlestools/listbefore the client completes the required MCP lifecycle handshake (initialize→notifications/initialized). The server returns a normal JSON-RPC result instead of rejecting the request as out-of-order.This breaks the expected MCP session state machine: compliant clients assume that only
initializeis valid until the handshake completes. Allowing other methods early can mask misconfigured clients, weaken assumptions used by security tooling, and make session-scoped state (capabilities, auth context, subscriptions) harder to reason about.Environment
OS: Linux (Proxmox VE host)
MCP server build: ships with current Cursor Desktop (Node-based,
secure-filesystem-server v0.2.0, per server log line"serverInfo":{"name":"secure-filesystem-server","version":"0.2.0"})To Reproduce
Start the filesystem MCP server with a valid allowed directory, e.g.:
Do not send initialize or notifications/initialized.
Send a JSON-RPC request for tools/list over stdio, e.g.:
{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}Observe the response.
Expected behavior
Before the MCP handshake completes, the server should:
initialize(and any explicitly documented pre-init exceptions, if the spec allows them).result.After a valid
initialize+notifications/initializedsequence,tools/listshould succeed as usual.Actual behaviour
Without any prior initialize call, tools/list is executed successfully and the server returns a JSON-RPC response containing result (tool enumeration), as if the session were already initialized.