Issue
The MCP server encountered multiple critical initialization errors when attempting to start in Claude Code. Key issues included missing dependencies, malformed environment configurations, and incorrect entry point usage, preventing the server from functioning properly.
Culprit
- Missing Dependencies: The project lacked required packages for tree-sitter, which were necessary for AST-aware code chunking in the RAG pipeline.
- Environment File Errors: The
.envfile contained JSON arrays that were incompatible with bash sourcing, causing syntax errors. Additionally, field names used double underscores instead of the single underscores expected by the configuration parser. - Incorrect Configuration: The
.mcp.jsonconfiguration attempted to use bash to source the malformed.envfile and incorrectly referenced a non-existent entry point (run_server.py) that did not match the actual implementation insrc/server.py. - Wrong Server Entry Point: The
run_server.pyfile attempted to import non-existent classes, while the actual server implementation was correctly defined insrc/server.py.
Solution
The issues were resolved through the following steps:
- Dependency Resolution: Missing tree-sitter packages were added to the project dependencies, ensuring all required tools for AST-aware chunking were available.
- Environment Configuration Fix: A properly formatted
.env.mcpfile was created, using single underscores and simple values instead of JSON arrays. This ensured compatibility with the configuration parser. - MCP Configuration Update: The
.mcp.jsonfile was modified to use Poetry directly for execution, eliminating the need to source the environment file and ensuring correct module imports. - Correct Entry Point Usage: The server initialization was updated to use the actual entry point in
src/server.py, which included the correct server implementation.
These changes resolved the initialization errors, allowing the MCP server to start successfully and connect to ChromaDB, enabling hybrid search functionality and access to the indexed Bloomberg articles.