Skip to content

fix(vikingdb-memory): stop printing to stdout in the stdio MCP server - #448

Open
pcbeingused333 wants to merge 1 commit into
volcengine:mainfrom
pcbeingused333:c0865-vikingdb-memory-stdout
Open

pcbeingused333 wants to merge 1 commit into
volcengine:mainfrom
pcbeingused333:c0865-vikingdb-memory-stdout

Conversation

@pcbeingused333

Copy link
Copy Markdown

Fixes the stdout pollution in the VikingDB memory MCP server (no issue filed).

Cause. add_memories and search_memory call print() for service responses and errors. The server defaults to the stdio transport, where stdout carries the JSON-RPC stream, so every tool call writes non-protocol text into it and can break the client's parsing.

Fix. Replace the print() calls with the module logger (the existing logging.basicConfig writes to stderr): responses at info, errors at error.

Test. tests/test_stdout_clean.py calls both tools (success and failure paths, with the service stubbed offline) and asserts nothing reaches stdout. It fails on main and passes with the change.

Not changed: MEMORY_REGION is read into the config but never passed to VikingDBMemoryService; its default (cn-north-1) differs from the service's own default (cn-beijing), so wiring it would change behavior and is left for the maintainers.


This change was prepared with the assistance of an AI coding tool (Claude Code).

The tools used print() for responses and errors. With the default stdio
transport, stdout carries the JSON-RPC stream, so any print corrupts the
protocol. Use the module logger (stderr) instead, and add a regression test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Start review

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.

1 participant