Commit d13f3a4
committed
fix: Resolve MCP server stdout pollution causing Claude Desktop connection failure
When Claude Desktop launches the MCP server via `python -m mcp_arangodb_async`,
the __main__.py module was printing diagnostic messages to stdout (lines 45, 49, 52),
violating the MCP protocol's requirement for JSON-only stdout communication.
This caused "Unexpected token" JSON parsing errors in Claude Desktop.
Changes:
- Add server mode detection in __main__.py (defaults to server when no args)
- Delegate to entry.py:main() for MCP server operation (no stdout output)
- Preserve CLI diagnostic functionality via explicit 'health' command
- Add 'server' command and '--server' flag for explicit server mode
The fix ensures __main__.py only prints to stdout in CLI diagnostic mode,
while MCP server mode uses entry.py's proper stderr-only logging configuration.
Fixes: MCP server connection error "Unexpected token 'C', "Connected "..."1 parent 9b071b2 commit d13f3a4
File tree
4 files changed
+26
-7
lines changed- mcp_arangodb_async
4 files changed
+26
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
31 | 47 | | |
| 48 | + | |
32 | 49 | | |
33 | 50 | | |
34 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
0 commit comments