---
name: "Project scaffold does not write .mcp.json to project root"
---

# Bug 208: Project scaffold does not write .mcp.json to project root

## Description

When a new project is opened/scaffolded, `.mcp.json` is not written to the project root. The `write_mcp_json()` function (worktree.rs:6) is only called during worktree creation, not during `scaffold_story_kit()` (io/fs.rs:464) or `open_project()` (io/fs.rs:503). This means claude-pty spawned with `--permission-prompt-tool mcp__storkit__prompt_permission` immediately fails because the MCP tool isn't available.

Additionally, there is no way for the user to trigger scaffolding from the CLI — `find_story_kit_root()` in main.rs falls through without scaffolding if `.story_kit/` doesn't exist yet, so the only path is via the UI file chooser.

## How to Reproduce

1. Create an empty directory or navigate to a project without `.story_kit/`
2. Run `storkit`
3. Open the project via the UI file chooser
4. Try to chat using the claude-code provider

## Actual Result

Claude Code exits immediately with: `Error: MCP tool mcp__storkit__prompt_permission (passed via --permission-prompt-tool) not found. Available MCP tools: none`

## Expected Result

`.mcp.json` is written to the project root during scaffolding/open, so claude-code can connect to the storkit MCP server.

## Acceptance Criteria

- [ ] write_mcp_json() is called as part of open_project() or scaffold_story_kit() to write .mcp.json to the project root
- [ ] claude-code provider works on first use in a newly scaffolded project
