|
| 1 | +# Copilot Instructions — McpServerManager (RequestTracker) |
| 2 | + |
| 3 | +## ⚠️ PRIORITY ORDER — NON-NEGOTIABLE ⚠️ |
| 4 | + |
| 5 | +**Speed is never more important than following workspace procedures.** |
| 6 | + |
| 7 | +Before doing ANY work on ANY user request, you MUST complete these steps in order: |
| 8 | + |
| 9 | +1. **Read `AGENTS-README-FIRST.yaml`** in the repo root for the current API key and endpoints |
| 10 | +2. **GET `/health`** to verify the MCP server is running |
| 11 | +3. **POST `/mcp/sessionlog`** with your session entry — do NOT proceed until this succeeds |
| 12 | +4. **GET `/mcp/sessionlog?limit=5`** to review recent session history for context |
| 13 | +5. **GET `/mcp/todo`** to check current tasks |
| 14 | +6. **THEN** begin working on the user's request |
| 15 | + |
| 16 | +On EVERY subsequent user message: |
| 17 | +1. POST an updated session log entry BEFORE starting work |
| 18 | +2. Complete the user's request |
| 19 | +3. POST the final session log with results, actions taken, and files modified |
| 20 | + |
| 21 | +**If you skip any of these steps, STOP and go back and do them before continuing.** |
| 22 | +Session logging is not optional, not deferred, and not secondary to the task. |
| 23 | + |
| 24 | +## Auth Architecture |
| 25 | + |
| 26 | +- **JWT and API key are mutually exclusive.** Once a Bearer token is set on `McpClientBase`, |
| 27 | + API key writes are ignored and the client permanently requires the JWT. |
| 28 | +- API keys are for **agents only** (no JWT capability). |
| 29 | +- When a Bearer header is present, the server ignores API keys entirely for both |
| 30 | + auth AND workspace resolution. |
| 31 | +- `McpClientBase.RequireBearerToken` prevents silent fallback once JWT is configured. |
| 32 | + |
| 33 | +## Build Commands |
| 34 | + |
| 35 | +```powershell |
| 36 | +# Build desktop app |
| 37 | +dotnet build src\McpServerManager.Desktop\McpServerManager.Desktop.csproj |
| 38 | +
|
| 39 | +# Build entire solution (requires android workload for Android project) |
| 40 | +dotnet build McpServerManager.slnx |
| 41 | +
|
| 42 | +# Deploy to Android device (Motorola Edge) |
| 43 | +dotnet build src\McpServerManager.Android\McpServerManager.Android.csproj -t:Install -f net9.0-android -c Debug -p:AdbTarget="-s ZD222QH58Q" |
| 44 | +
|
| 45 | +# Redeploy MCP Windows service (MUST use this script, never raw dotnet publish) |
| 46 | +gsudo powershell -ExecutionPolicy Bypass -File lib\McpServer\scripts\Update-McpService.ps1 |
| 47 | +``` |
| 48 | + |
| 49 | +## Architecture |
| 50 | + |
| 51 | +**McpServerManager** is an Avalonia cross-platform app (Desktop + Android) that connects |
| 52 | +to an MCP Context Server for workspace management, TODO tracking, session logging, and |
| 53 | +voice interaction. |
| 54 | + |
| 55 | +- **McpServerManager.Core** — Shared library (net9.0): ViewModels, Services, Models |
| 56 | +- **McpServerManager.Desktop** — Windows desktop app (WinExe, net9.0) |
| 57 | +- **McpServerManager.Android** — Android app (net9.0-android) |
| 58 | +- **lib/McpServer** — Git submodule (develop branch): the MCP server + client library |
| 59 | + |
| 60 | +## Key Conventions |
| 61 | + |
| 62 | +- Connection persistence: Android uses `SharedPreferences`, Desktop uses |
| 63 | + `%LOCALAPPDATA%\McpServerManager\connection.json` |
| 64 | +- Every successful connection saves host/port — no conditional persistence flags |
| 65 | +- Single-port model: all 6 workspaces share port 7147, resolved via `X-Workspace-Path` header |
| 66 | +- FluentAvaloniaUI for navigation, AvaloniaEdit for text editing |
| 67 | +- All services accept bearer token parameter and propagate it to `McpClientBase` |
| 68 | + |
| 69 | +## MCP Service Deployment |
| 70 | + |
| 71 | +**ALWAYS** use `lib\McpServer\scripts\Update-McpService.ps1` via gsudo. |
| 72 | +Never use raw `dotnet publish`. The script archives config/data, publishes, |
| 73 | +and restores preserved files. Verify all 6 workspaces are healthy after deploy. |
0 commit comments