Every document filename now mirrors its lifecycle state with a status suffix (e.g., .draft.md, .wip.md, .accepted.md). No more bare .md for tracked document types. Also renamed all from_str methods to parse to avoid FromStr trait confusion, introduced StagingDeploymentParams struct, and fixed all 19 clippy warnings across the codebase. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 KiB
Spike: MCP Project Detection
| Status | In Progress |
| Date | 2026-01-26 |
| Time Box | 30 minutes |
Question
Why does the Blue MCP server fail to detect the project directory, and what's the correct solution?
Investigation
Current Behavior
- Claude Code starts Blue MCP server via
blue mcp - Server starts with unknown working directory
- First tool call without
cwdparam fails: "Blue not detected in this directory" - Tool call with explicit
cwdworks
Root Cause Analysis
Hypothesis 1: Process working directory
- MCP servers are child processes of Claude Code
- Working directory may be Claude Code's install location, not project
Hypothesis 2: MCP protocol provides workspace info
- MCP spec has
rootscapability for filesystem boundaries - Claude Code may send roots during initialize or via
roots/list
Hypothesis 3: Environment variables
- Claude Code sets
CLAUDECODE=1,CLAUDE_CODE_SSE_PORT,CLAUDE_CODE_ENTRYPOINT - No project path variable observed
MCP Protocol Research
Per MCP Specification:
- Roots - Servers can request roots from clients
- Initialize params - May contain client capabilities but not workspace path
- No standard workspace field - Unlike LSP's
rootUri/workspaceFolders
Attempted Fixes
| Attempt | Result |
|---|---|
Fall back to current_dir() |
Failed - wrong directory |
Parse roots from initialize |
Unknown - needs testing |
| Walk up directory tree | Implemented but untested |
Key Finding
The MCP protocol does not provide a standard way for servers to know the user's project directory. This is a gap compared to LSP.
Options Discovered
- Require
cwdin every tool call - Current workaround, verbose - Walk up directory tree - Find
.blue/from process cwd - Use MCP roots - Request roots from client, use first root
- Wrapper script - Shell wrapper that sets cwd before starting server
- Config file - Store project path in
~/.blue/projects.json
Alignment Dialogue Result
6 experts, 98% convergence on Option 1: C → B → fail
| Round | Result |
|---|---|
| R1 | B (3), C (2), Combined (1) |
| R2 | Option 1 (3), Option 2 (2), Option 3 (1) |
| R3 | Option 1 unanimous |
Consensus: MCP roots first → Walk tree fallback → Fail with guidance
The current code already implements this. The remaining issue is that:
- Claude Code may not send roots during initialize
- Process cwd starts outside project tree (e.g., $HOME)
Conclusion
Root cause: Claude Code starts MCP servers from a non-project directory and doesn't send MCP roots.
Solution: The C → B fallback chain is correct. Need to verify Claude Code sends roots, or ensure walk-tree can find project from wherever the process starts.
Recommended next step: Draft RFC to formalize the detection algorithm and add better error messaging.