MCP server corrupts stdio stream with console.log output
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
Research direction
Start by searching the four affected files—src/embeddings.ts, src/indexer.ts, src/conversations.ts, and src/index.ts—for the listed console.log occurrences. Replace the debug output as specified, then exercise the MCP stdio path and verify stdout contains only JSON-RPC messages while debug output goes to stderr.
Written by the indexing model from the issue text.
Description
Bug
The MCP server uses console.log() for debug output in several source files. Since MCP servers communicate with the host over stdio JSON-RPC, any non-JSON output on stdout corrupts the protocol stream.
This manifests as a parse error in Claude Code:
Unexpected identifier Indexer
How it happens
Normal MCP stdio traffic looks like this:
Host → Server:
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_memory","arguments":{"query":"console log fix"}}}
Server → Host (expected):
{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"..."}]}}
But with console.log calls in the code, what actually arrives on stdout is:
[Indexer] Starting full index rebuild...
[Indexer] Parsing journal...
[Indexer] Indexing 18 items...
{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"..."}]}}
The host reads line by line and tries to JSON.parse each one. The first line it sees is [Indexer] Starting full index rebuild... — not valid JSON — so the parser throws:
Unexpected identifier 'Indexer'
The actual response that follows never gets processed correctly because the stream is now out of sync.
Affected files
src/embeddings.ts(1 occurrence)src/indexer.ts(9 occurrences)src/conversations.ts(10 occurrences)src/index.ts(2 occurrences)
Fix
Replace all console.log( with console.error( in these files. stderr is not part of the MCP stdio pipe and is safe for debug output.
This issue was identified and filed with the help of Claude Code.
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 6
- Avg merge
- 1h 32m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ascorbic/macrodata
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Support Cursor Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in ascorbic/macrodata
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100