---
name: "Refactor Matrix bot to use Claude Code provider instead of direct Anthropic API"
---

# Story 183: Refactor Matrix bot to use Claude Code provider instead of direct Anthropic API

## User Story

As a developer, I want the Matrix bot to use the same Claude Code subprocess provider as the web UI chat, so that tool access, billing, and session management are consistent across both interfaces.

## Acceptance Criteria

- [ ] Replace direct Anthropic API calls in bot.rs with the ClaudeCodeProvider from server/src/llm/providers/claude_code.rs
- [ ] Remove hardcoded mcp_tool_schemas() function — Claude Code manages its own tools
- [ ] Bot uses the same MCP tool permission model as the web UI (initially auto-approve for all Story Kit MCP tools)
- [ ] Remove the reqwest-based call_mcp_tool() HTTP self-call — Claude Code calls MCP tools natively
- [ ] Bot no longer requires a separate Anthropic API key path — uses Claude Code billing
- [ ] Existing bot.toml configuration (homeserver, username, password, room_id, enabled) still works

## Out of Scope

- TBD
