Repository navigation
Fix feature import from expand chat: pin mcp<2 and report MCP-created features - #273
zwanski-start wants to merge 3 commits into
Conversation
) mcp is only a transitive dependency of claude-agent-sdk, so fresh installs now resolve mcp 2.x, where FastMCP was removed. feature_mcp.py then fails on import, the features MCP server never starts, and chat sessions cannot create features (the model falls back to inventing CLI commands). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The expand session never emitted features_created after switching to MCP feature creation, so the chat showed no confirmation, the session count stayed at 0, and the kanban board was never refreshed on close. Track feature_create/feature_create_bulk tool calls and their results and emit features_created with the new IDs. feature_create_bulk now also returns feature_ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…toForgeAI#72) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔍 QA report: ✅ PassedTester: Barbara (cubefarm agent, in a fresh session) · Round: 1 · Author: Dennis Confirmed the root cause: a fresh install from master resolves mcp 2.3.0, and in that venv feature_mcp.py fails on import (
🧪 Commands run
No browser screenshots were taken in this round. Posted by cubefarm · merges automatically once GitHub's checks pass |
Partial integration: takes parse_created_features, the tool-result loop in expand_chat_session.py (features_created is now incremented and emitted to the UI), feature_ids in feature_create_bulk, the expand-project.md failure guidance and test_expand_chat_session.py. Drops the PR's requirements*.txt hunks (my-features already pins mcp<2). Adds a test that feature_create_bulk returns the created IDs in input order. Integrates AutoForgeAI#273 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeH26pcsqoxPb3CDs8g1VN
In a real Expand chat the feature_create_bulk result arrives as {"result": "{\"created\": 2, ...}"}: FastMCP wraps a tool's string return value. parse_created_features (AutoForgeAI#273) looked for 'created' at the top level, logged 'created no features' and emitted no features_created event, so the UI never showed 'Created N new features'. The PR's tests only used unwrapped payloads.
The wrapper is now unwrapped before parsing. Verified in the browser: an Expand chat that creates a feature shows 'Created 1 new feature!' and the '1 added' badge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeH26pcsqoxPb3CDs8g1VN
…Project chat Adaptations: EXPAND_TOOLS_PROMPT goes into the --system-prompt-file prompt together with my-features' NO_SHELL_PROMPT_NOTE; the PR's tests are merged into the existing test_expand_chat_session.py (from AutoForgeAI#273) and read the prompt from the file and stub find_claude_cli. Integrates AutoForgeAI#270 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeH26pcsqoxPb3CDs8g1VN
Closes #72
Root cause
The model wasn't making a bad call — it had nothing to call. When feature creation through MCP fails, the model invents a fallback, like
npx claude-spec feature_import .... That package doesn't exist, which is why npm returns a 404. This PR covers three issues:mcpis only a transitive dependency ofclaude-agent-sdk(mcp>=1.19.0, no upper bound), so new installs now resolve mcp 2.x. mcp 2.x removedmcp.server.fastmcp.FastMCP, somcp_server/feature_mcp.pycrashes on import withModuleNotFoundError: No module named 'mcp.server.fastmcp', and nofeature_*tools are available to any session (expand chat, initializer, or coding agent). I hit this myself in a freshly built venv (mcp 2.3.0). Fix: pinmcp>=1.19.0,<2.0.0inrequirements.txtandrequirements-prod.txt. Becauserequirements-prod.txtchanged, the npm CLI's requirements-hash marker also changes, so existing~/.autoforge/venvinstalls reinstall and pick up the pin.features_createdWebSocket event. As a result, the chat showed no "Created N features" confirmation,featuresCreatedstayed at 0, andExpandProjectModalnever calledonFeaturesAdded(), so the kanban board didn't refresh. Even successful imports looked like failures. Fix:ExpandChatSession._query_claudenow tracksfeature_create/feature_create_bulktool calls and their results, and emitsfeatures_createdwith the new IDs, names and categories.feature_create_bulknow also returnsfeature_ids. This only adds a key, so existing callers are unaffected.expand-project.mdnow says the MCP tools are the only way to import features. It tells the model never to suggest CLI or npm commands, never to write a JSON file as a workaround, and to quote the tool's error back to the user instead.Verification
test_expand_chat_session.py(6 tests): result parsing for bulk and single creation, error and garbage results, and a streamed tool-use → tool-result sequence emittingfeatures_created. Failed or unrelated tool calls are ignored.python -m mcp_server.feature_mcpover stdio with mcp 1.30.0, calledfeature_create_bulk, and fed its actual result into the parser. It returned the correct IDs, names and categories.ruff check .,python test_security.py,pytest test_client.py test_dependency_resolver.pyall pass. mypy reports only pre-existing errors.Not verified / assumptions
features_created.mcp<2rather than portingfeature_mcp.pyto the mcp 2.xMCPServerAPI. Porting is a larger change and can be done as a follow-up.🤖 Generated with Claude Code