@@ -42,8 +42,10 @@ Complete MCP client implementation with:
4242 - `client.go` - MCP HTTP client
4343 - `proxy.go` - MCP proxy with local tool support
4444 - `stub.go` - Stub server for offline testing
45-- `tools.go` - Tool definitions and helpers
46-- Tests for all components
45+- `tools.go` - Local tool implementations (credential management)
46+- `tools_test.go` - Unit tests for tool handlers
47+- `integration_test.go` - Full workflow tests with proxy
48+- Additional tests for all components
4749
4850 ### 2. Provider Package (`internal/provider/`)
4951 LLM provider abstraction with:
@@ -74,19 +76,22 @@ Configuration management with:
7476 - Tests
7577
7678 ### 4. Store Package (`internal/store/`)
77-SQLite persistence layer for conversation history:
79+SQLite persistence layer for conversation history and credentials:
7880 - Session management (create, resume, list)
7981 - Message storage with tool calls and reasoning
8082 - Multi-instance support (no locking conflicts)
8183 - WAL mode for concurrent access
84+- Session-scoped credential storage
8285
8386 **Database Schema:**
8487 - `sessions` - Conversation sessions with provider info
8588 - `messages` - Message history per session
89+- `session_credentials` - Game credentials per session (foreign key to sessions)
8690 - Stored at `~/.config/mysis/mysis.db`
8791
8892 **Files:**
8993 - `store.go` - Database operations and schema
94+- `credentials_test.go` - Credential storage tests
9095
9196 ### 5. Brand Assets
9297 - Logo files (SVG format)
@@ -134,8 +139,9 @@ This is a scaffold with reusable infrastructure. Implementation of application-s
134139 **Config Directory:** `~/.config/mysis/`
135140 - `config.toml` - Configuration file (optional, falls back to `./config.toml`)
136141 - `credentials.json` - API keys (mode 0600)
137-- `mysis.db` - SQLite database for conversation history
142+- `mysis.db` - SQLite database for conversation history and game credentials
138143 - `account-backup.md` - Backup of SpaceMolt test accounts
144+- `credentials-backup-*.sql` - Timestamped credential backups
139145
140146 **Session Management:**
141147 - Each CLI instance creates a unique session (UUID)
@@ -149,6 +155,43 @@ This is a scaffold with reusable infrastructure. Implementation of application-s
149155 - Full conversation history (user, assistant, tool messages)
150156 - Tool calls stored as JSON
151157 - Session metadata (provider, model, timestamps)
158+- Foreign key constraints enabled (CASCADE delete for credentials)
159+
160+**Credential Management:**
161+- Session-scoped credential storage via MCP tools
162+- Agent can save/retrieve game credentials without user re-entry
163+- Credentials isolated by session (Session A cannot access Session B's credentials)
164+- Automatic cleanup when session is deleted (CASCADE)
165+- Tools: `save_credentials`, `get_credentials`
166+- Registered automatically in CLI on startup
167+
168+## Local MCP Tools
169+
170+The project includes local MCP tools registered with the proxy and available to the agent:
171+
172+### Credential Management Tools
173+
174+**`save_credentials`** - Saves username and password for the current session.
175+- **Input:** `{ "username": "string", "password": "string" }`
176+- **Response:** Success message with username confirmation
177+- **Validation:** Both fields required (non-empty)
178+
179+**`get_credentials`** - Retrieves saved credentials for the current session.
180+- **Input:** Empty object `{}`
181+- **Response:** JSON with username/password, or message if none saved
182+- **Session isolation:** Each session can only access its own credentials
183+
184+**Implementation:**
185+- Defined in `internal/mcp/tools.go`
186+- Registered automatically in `internal/cli/cli.go` on startup
187+- Session ID injected via closure (never exposed to agent)
188+- Full test coverage in `tools_test.go` and `integration_test.go`
189+
190+**Backup/Restore:**
191+- `make backup-credentials` - Create timestamped SQL backup
192+- Restore: `sqlite3 ~/.config/mysis/mysis.db < backup-file.sql`
193+
194+See `documentation/architecture/CREDENTIAL_TOOLS.md` for detailed implementation.
152195
153196 ## Notes
154197
@@ -157,3 +200,4 @@ This is a scaffold with reusable infrastructure. Implementation of application-s
157200 - Provider configurations support both local (Ollama) and cloud (OpenCode Zen) models
158201 - The project maintains the retro-futuristic aesthetic from zoea-nova
159202 - Config directory changed from `~/.mysis` to `~/.config/mysis` (XDG Base Directory standard)
203+- Foreign key constraints enabled in SQLite for referential integrity