diff --git a/mcp/bun.lock b/mcp/bun.lock index 675865b..e2cd013 100644 --- a/mcp/bun.lock +++ b/mcp/bun.lock @@ -5,7 +5,7 @@ "": { "name": "@paca-ai/bdd-plugin-mcp", "dependencies": { - "@paca-ai/plugin-sdk-mcp": "^0.1.0", + "@paca-ai/plugin-sdk-mcp": "^0.2.0", }, "devDependencies": { "typescript": "^5.8.3", @@ -70,7 +70,7 @@ "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.29.0", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ=="], - "@paca-ai/plugin-sdk-mcp": ["@paca-ai/plugin-sdk-mcp@0.1.0", "", { "peerDependencies": { "@modelcontextprotocol/sdk": ">=0.6.0" } }, "sha512-TOFdpdeY7boVRH6EgOhiMj6a0Q6+77nJ2M2Bh7awmN63S2JHA/8sxyK9V8fK0j94mBmnpnoS2SBI52a0valoaQ=="], + "@paca-ai/plugin-sdk-mcp": ["@paca-ai/plugin-sdk-mcp@0.2.0", "", { "peerDependencies": { "@modelcontextprotocol/sdk": ">=0.6.0" } }, "sha512-wpZqKLmfoO98OO2xRfCtrXzfRzJX06yr48LCfu+dE2p1kpNUyWHvp1XkTPOLHTBBOuebMwSDcuZT94u+egv4uA=="], "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.60.3", "", { "os": "android", "cpu": "arm" }, "sha512-x35CNW/ANXG3hE/EZpRU8MXX1JDN86hBb2wMGAtltkz7pc6cxgjpy1OMMfDosOQ+2hWqIkag/fGok1Yady9nGw=="], diff --git a/mcp/package.json b/mcp/package.json index 5a52e19..e48de1c 100644 --- a/mcp/package.json +++ b/mcp/package.json @@ -9,7 +9,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@paca-ai/plugin-sdk-mcp": "^0.1.0" + "@paca-ai/plugin-sdk-mcp": "^0.2.0" }, "devDependencies": { "typescript": "^5.8.3", diff --git a/mcp/src/index.ts b/mcp/src/index.ts index ad83428..51ad069 100644 --- a/mcp/src/index.ts +++ b/mcp/src/index.ts @@ -302,6 +302,34 @@ const entry: PluginMCPEntry = { return errorResult(`Tool ${name} failed: ${message}`); } }, + + async getToolContext( + toolId: string, + args: Record, + context: PluginMCPContext, + ) { + if (toolId !== "get_task") return null; + const { projectId, taskId } = args as { projectId: string; taskId: string }; + + const api = new PluginAPIClient(context); + try { + const scenarios = await api.pluginGet( + `projects/${projectId}/tasks/${taskId}/bdd-scenarios`, + ); + if (scenarios.length === 0) return null; + + const lines = [ + "## BDD Scenarios", + "", + ...scenarios.map((s) => `- ${s.title}`), + ]; + return lines.join("\n"); + } catch { + // Best-effort enrichment — a transient failure here should not + // break the get_task response for the AI client. + return null; + } + }, }; export default entry; diff --git a/plugin.json b/plugin.json index 19ca19d..4e006b2 100644 --- a/plugin.json +++ b/plugin.json @@ -2,8 +2,8 @@ "id": "com.paca.bdd", "displayName": "BDD Scenarios", "description": "Adds Given/When/Then BDD acceptance criteria to tasks.", - "version": "0.3.2", - "minCoreVersion": "v0.11.2", + "version": "0.3.3", + "minCoreVersion": "v0.12.2", "permissions": ["db.read", "db.write", "events.subscribe"], "backend": { "eventSubscriptions": ["task.deleted"], @@ -86,7 +86,8 @@ ] }, "mcp": { - "remoteEntryUrl": "/plugins-mcp/com.paca.bdd/mcp.js" + "remoteEntryUrl": "/plugins-mcp/com.paca.bdd/mcp.js", + "toolContextHooks": ["get_task"] }, "skills": { "baseUrl": "/plugins-skills/com.paca.bdd",