mcp‑server‑llamacloud 0.1.1 prints non‑JSON logs to stdout → Claude Desktop “Unexpected token … is not valid JSON” #2

Closed
opened 2026-02-16 02:17:29 -05:00 by yindo · 1 comment
Owner

Originally created by @Odysseus-deep on GitHub (May 2, 2025).

When starting @llamaindex/mcp-server-llamacloud@0.1.1, the server writes two plain‑text lines (“Created …”, “Starting MCP …”) to stdout before the first JSON‑RPC message. Claude Desktop expects a pure JSON stream and immediately throws Unexpected token parse errors, then disconnects.

Versions
mcp‑server‑llamacloud: 0.1.1 (latest on npm)
Node.js: v18.19.1
OS: macOS 14.4 (Apple Silicon)
Claude Desktop: 1.0.9

Steps to reproduce
Run the server exactly as Claude Desktop does:

LLAMA_CLOUD_PROJECT_NAME=Default \ LLAMA_CLOUD_API_KEY=llx-***redacted*** \ npx -y @llamaindex/mcp-server-llamacloud@0.1.1 \ --index Castoretpollux-talents-a --description "premiere base de CV" \ --index Castoretpollux-talents-b --description "Deuxieme base de CV"
Observe the first two lines printed to stdout:

Created index tool for tool-a Starting MCP server…
Claude Desktop immediately shows
Unexpected token 'C', "Created in"... is not valid JSON
and the connection drops

Actual behaviour
Two non‑JSON log lines are emitted on stdout.

Claude fails to parse them, raises an error, and disconnects.

Expected behaviour
All log lines should go to stderr.

stdout should contain only valid JSON‑RPC objects so that Claude (or any MCP client) can parse the stream.

Minimal log (stdout)
Created index tool for Castoretpollux-talents-a Starting MCP server… {"jsonrpc":"2.0","method":"mcp-bootstrap","params":{ … } }
Environment
node -v # v18.19.1 npm view @llamaindex/mcp-server-llamacloud version # 0.1.1 uname -a # Darwin arm64 23.4.0
Suggested fix
Move the two informational console.log statements to process.stderr (or remove them) so that stdout remains a valid JSON‑RPC channel.

Happy to open a PR if that helps.

Originally created by @Odysseus-deep on GitHub (May 2, 2025). When starting @llamaindex/mcp-server-llamacloud@0.1.1, the server writes two plain‑text lines (“Created …”, “Starting MCP …”) to stdout before the first JSON‑RPC message. Claude Desktop expects a pure JSON stream and immediately throws Unexpected token parse errors, then disconnects. **Versions** mcp‑server‑llamacloud: 0.1.1 (latest on npm) Node.js: v18.19.1 OS: macOS 14.4 (Apple Silicon) Claude Desktop: 1.0.9 **Steps to reproduce** Run the server exactly as Claude Desktop does: `LLAMA_CLOUD_PROJECT_NAME=Default \ LLAMA_CLOUD_API_KEY=llx-***redacted*** \ npx -y @llamaindex/mcp-server-llamacloud@0.1.1 \ --index Castoretpollux-talents-a --description "premiere base de CV" \ --index Castoretpollux-talents-b --description "Deuxieme base de CV" ` Observe the first two lines printed to stdout: `Created index tool for tool-a Starting MCP server… ` **Claude Desktop immediately shows** Unexpected token 'C', "Created in"... is not valid JSON and the connection drops **Actual behaviour** Two non‑JSON log lines are emitted on stdout. Claude fails to parse them, raises an error, and disconnects. **Expected behaviour** All log lines should go to stderr. stdout should contain only valid JSON‑RPC objects so that Claude (or any MCP client) can parse the stream. **Minimal log (stdout)** `Created index tool for Castoretpollux-talents-a Starting MCP server… {"jsonrpc":"2.0","method":"mcp-bootstrap","params":{ … } } ` **Environment** `node -v # v18.19.1 npm view @llamaindex/mcp-server-llamacloud version # 0.1.1 uname -a # Darwin arm64 23.4.0 ` Suggested fix Move the two informational console.log statements to process.stderr (or remove them) so that stdout remains a valid JSON‑RPC channel. Happy to open a PR if that helps.
yindo closed this issue 2026-02-16 02:17:29 -05:00
Author
Owner

@marcusschiesser commented on GitHub (May 6, 2025):

Great catch @Odysseus-deep thanks for finding this - want to send a PR?

@marcusschiesser commented on GitHub (May 6, 2025): Great catch @Odysseus-deep thanks for finding this - want to send a PR?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/mcp-server-llamacloud#2