Commit baf2bd9
fix: Fix MCP server STDIO output issues (#38)
* fix: Suppress logging output in stdio mode to prevent MCP protocol interference
In stdio mode, the MCP protocol uses stdin/stdout for JSON-RPC communication.
Any logging output to stdout/stderr breaks the protocol, causing errors in MCP clients.
This fix:
- Detects transport mode (stdio/sse/streamable-http) early in startup
- Configures Python's logging system based on mode:
* stdio mode: Sets level to CRITICAL (suppresses INFO/DEBUG logs)
* sse/http modes: Sets level to INFO (enables debugging logs)
- Suppresses httpx library HTTP request logging in stdio mode
- Suppresses MCP SDK's internal logging in stdio mode
Resolves issues where MCP clients see logging output as protocol errors.
* chore: Update uv.lock with package metadata
Updated lockfile after running uv sync for local testing.
Adds revision number and package upload timestamps.
* feat: Add pytest to pre-commit hooks for faster feedback
Adds pytest to pre-commit hooks to catch test failures before commit.
Benefits:
- Early bug detection (before pushing to CI)
- Fast test suite (195 tests in ~7s)
- Total pre-commit time: ~10s (acceptable for workflow)
- Same test coverage as CI, but earlier in dev cycle
The test suite uses mocking and has no external dependencies,
making it fast enough for pre-commit without disrupting flow.
* perf: Exclude slow integration tests from pre-commit hooks
Optimize pre-commit workflow by skipping 2 integration tests that
account for 53% of test execution time (2.5s out of 4.7s).
Changes:
- Pre-commit: 193 unit tests in 2s (was 195 tests in 4.7s)
- Total pre-commit time: 8.8s (was 10.6s) - 17% faster
- Integration tests still run in CI for comprehensive coverage
Impact:
- Faster developer workflow
- Maintains test quality (integration tests in CI)
- Tests marked with @pytest.mark.integration are skipped
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f1465ac commit baf2bd9
3 files changed
+712
-681
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
53 | 75 | | |
54 | 76 | | |
55 | 77 | | |
| |||
0 commit comments