feat: register ask_chatgpt MCP tool

This commit is contained in:
2026-06-12 12:09:08 +01:00
parent 20bef8a1fb
commit d3aefa5bb8
4 changed files with 123 additions and 4 deletions
+22 -1
View File
@@ -57,9 +57,30 @@ Total: 139 orchestration-only tests, all passing.
Minimal MCP stdio server in `src/server.js`. MCP initialize handshake succeeds. No tools registered yet.
### Task 5.2 - Register ask_chatgpt MCP tool ✅
`ask_chatgpt` is now registered as an MCP tool on the server (`src/server.js`).
**Registration details:**
- Uses shared `baseInputSchema` (question required + context, constraints, expectedOutput, projectSummary, taskSummary, relevantFiles, logs optional).
- All 3 external deps injected: `loadConfig`, `createOpenAIClient`, `sendOpenAIResponse`.
- Returns structured MCP tool result: `{ content: [{ type: "text", text }], isError, warnings }`.
**Smoke test results (all passing):**
- initialize → server returns `chatgpt-mcp` v0.1.0 ✅
- tools/list → exposes `ask_chatgpt` with correct schema ✅
- tools/call (happy path, mocked OpenAI) → `{ content: [...], isError: false }` with answer ✅
- tools/call (minimal input `{ question: "hi" }`) → works ✅
- tools/call (full input, all 10 schema fields) → handled correctly ✅
- tools/call (missing OPENAI_API_KEY) → structured MCP error `"Error: Configuration error: OPENAI_API_KEY is missing."`
- tools/call (invalid API key) → structured MCP error `"OpenAI API error (OpenAIAuthError): 401"`
- All 523 unit tests pass across 18 test files ✅
**Production code (`src/server.js`):** ~39 lines, single `ask_chatgpt` tool registered with MCP via Stdio transport.
## Next Pending
### Task 5.2 - Register ask_chatgpt MCP tool
### Task 5.3 - Register remaining MCP tools (review_plan, review_code, debug_issue, architecture_review)
## General Rules