zopkit-bug-resolution-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/index.js +87 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# bug-resolution MCP server
|
|
2
|
+
|
|
3
|
+
A single-tool MCP server so Claude Code (or Cursor, or any other MCP client)
|
|
4
|
+
can report back how it fixed a Zopkit bug report as a native tool call,
|
|
5
|
+
instead of hand-rolling a curl command. It's a thin wrapper around
|
|
6
|
+
`POST /api/admin/bug-reports/resolution/:id` — see
|
|
7
|
+
`backend/src/features/bug-reports/README.md` for what that endpoint
|
|
8
|
+
actually does server-side.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
1. **Get a key.** In the company-admin panel → Bug Reports → **API Keys**
|
|
13
|
+
(full `bug-reports` staff access only), generate one and copy it — it's
|
|
14
|
+
shown exactly once.
|
|
15
|
+
|
|
16
|
+
2. **Register the server:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cd deploy/mcp/bug-resolution
|
|
20
|
+
npm install
|
|
21
|
+
claude mcp add bug-resolution \
|
|
22
|
+
--env BUG_REPORT_API_KEY=<the key you copied> \
|
|
23
|
+
-- node "$(pwd)/index.js"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
By default it talks to production (`https://api.zopkit.com`). Point it
|
|
27
|
+
elsewhere (e.g. a local dev backend) with an extra
|
|
28
|
+
`--env BUG_REPORT_API_BASE_URL=http://localhost:3000`.
|
|
29
|
+
|
|
30
|
+
3. Restart Claude Code and approve `bug-resolution` when prompted.
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
Once registered, ask Claude Code (or whichever tool you fixed the bug with)
|
|
35
|
+
to call `submit_bug_resolution` with the bug report's id (a UUID — from
|
|
36
|
+
whoever asked you to fix it, or the report's admin-panel URL) and a Markdown
|
|
37
|
+
writeup. It sets the report's resolution notes to that writeup and moves its
|
|
38
|
+
status straight to `resolved`.
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
|
|
42
|
+
- Not part of the pnpm workspace (`pnpm-workspace.yaml`) or the deployed
|
|
43
|
+
backend image — a standalone dev tool, installed with plain `npm install`.
|
|
44
|
+
- The key is per-developer and individually revocable from the same API Keys
|
|
45
|
+
panel — revoking one never affects any other person's key.
|
|
46
|
+
- This server only exposes the one write it needs. It can't list, search, or
|
|
47
|
+
read bug reports — the person/tool using it needs the report's id already.
|
package/index.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// bug-resolution MCP server — a single tool wrapping
|
|
3
|
+
// POST /api/admin/bug-reports/resolution/:id (see backend/src/features/
|
|
4
|
+
// bug-reports/README.md) so a developer's Claude Code / Cursor session can
|
|
5
|
+
// report back how it fixed a bug as a native tool call instead of hand-
|
|
6
|
+
// rolling a curl command. Thin wrapper: all the actual logic (auth, the
|
|
7
|
+
// resolutionNotes/status write) lives server-side: this just forwards
|
|
8
|
+
// {bugReportId, markdown} as the HTTP call the README already documents.
|
|
9
|
+
//
|
|
10
|
+
// Setup: see README.md in this directory.
|
|
11
|
+
|
|
12
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
13
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
|
|
16
|
+
const API_KEY = process.env.BUG_REPORT_API_KEY;
|
|
17
|
+
const BASE_URL = (process.env.BUG_REPORT_API_BASE_URL || 'https://api.zopkit.com').replace(/\/$/, '');
|
|
18
|
+
|
|
19
|
+
if (!API_KEY) {
|
|
20
|
+
console.error('[bug-resolution-mcp] BUG_REPORT_API_KEY is not set — every call will fail. ' +
|
|
21
|
+
'Generate one from the company-admin panel (Bug Reports → API Keys) and set it when registering this server.');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const server = new McpServer({ name: 'zopkit-bug-resolution', version: '1.0.0' });
|
|
25
|
+
|
|
26
|
+
server.registerTool(
|
|
27
|
+
'submit_bug_resolution',
|
|
28
|
+
{
|
|
29
|
+
title: 'Submit bug resolution',
|
|
30
|
+
description:
|
|
31
|
+
"Report how a Zopkit bug report was fixed. Sets the report's resolution notes to the given " +
|
|
32
|
+
"Markdown writeup and moves its status straight to 'resolved'. Use the bug report's id " +
|
|
33
|
+
'(a UUID, given to you by whoever asked you to fix it, or visible in its admin-panel URL).',
|
|
34
|
+
inputSchema: {
|
|
35
|
+
bugReportId: z.string().min(1).describe("The bug report's id (UUID)."),
|
|
36
|
+
markdown: z
|
|
37
|
+
.string()
|
|
38
|
+
.min(1)
|
|
39
|
+
.describe(
|
|
40
|
+
'The resolution writeup, as Markdown — root cause, the fix, files touched, ' +
|
|
41
|
+
'verification steps, links to the commit/PR. No length limit; be as thorough as warranted.'
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
async ({ bugReportId, markdown }) => {
|
|
46
|
+
if (!API_KEY) {
|
|
47
|
+
return {
|
|
48
|
+
isError: true,
|
|
49
|
+
content: [{ type: 'text', text: 'BUG_REPORT_API_KEY is not set on this MCP server — see README.md.' }],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let res;
|
|
54
|
+
try {
|
|
55
|
+
res = await fetch(`${BASE_URL}/api/admin/bug-reports/resolution/${encodeURIComponent(bugReportId)}`, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: { 'Content-Type': 'application/json', 'X-API-Key': API_KEY },
|
|
58
|
+
body: JSON.stringify({ markdown }),
|
|
59
|
+
});
|
|
60
|
+
} catch (err) {
|
|
61
|
+
return {
|
|
62
|
+
isError: true,
|
|
63
|
+
content: [{ type: 'text', text: `Could not reach ${BASE_URL}: ${err instanceof Error ? err.message : String(err)}` }],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const body = await res.json().catch(() => null);
|
|
68
|
+
|
|
69
|
+
if (!res.ok) {
|
|
70
|
+
const message = body?.message || body?.error || `HTTP ${res.status}`;
|
|
71
|
+
return { isError: true, content: [{ type: 'text', text: `Failed to submit resolution: ${message}` }] };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const report = body?.data;
|
|
75
|
+
return {
|
|
76
|
+
content: [{
|
|
77
|
+
type: 'text',
|
|
78
|
+
text: report
|
|
79
|
+
? `Resolution submitted. "${report.title}" is now ${report.status}.`
|
|
80
|
+
: 'Resolution submitted.',
|
|
81
|
+
}],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const transport = new StdioServerTransport();
|
|
87
|
+
await server.connect(transport);
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zopkit-bug-resolution-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MCP server: submit how a bug report was fixed to Zopkit wrapper's POST /admin/bug-reports/resolution/:id. Requires a BUG_REPORT_API_KEY (generated in the company-admin panel) — see README.md.",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"bin": {
|
|
12
|
+
"zopkit-bug-resolution-mcp": "index.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"start": "node index.js"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
23
|
+
"zod": "^3.24.0"
|
|
24
|
+
}
|
|
25
|
+
}
|