@mushi-mushi/mcp 0.1.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/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +194 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kenji Sakuramoto
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @mushi-mushi/mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server that exposes Mushi Mushi reports to coding agents.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
MUSHI_API_KEY=key_xxx MUSHI_PROJECT_ID=proj_xxx npx @mushi-mushi/mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Tools
|
|
12
|
+
|
|
13
|
+
- `get_recent_reports` — fetch latest reports with optional filters
|
|
14
|
+
- `get_report_detail` — full report with console/network logs
|
|
15
|
+
- `search_reports` — keyword and semantic search
|
|
16
|
+
|
|
17
|
+
### Resources
|
|
18
|
+
|
|
19
|
+
- `project://settings` — current project configuration
|
|
20
|
+
- `project://stats` — report counts and trends
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
MIT
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { createLogger } from "@mushi-mushi/core";
|
|
8
|
+
var log = createLogger({ scope: "mushi:mcp", level: "info" });
|
|
9
|
+
var API_ENDPOINT = process.env.MUSHI_API_ENDPOINT ?? "https://api.mushimushi.dev";
|
|
10
|
+
var API_KEY = process.env.MUSHI_API_KEY ?? "";
|
|
11
|
+
var PROJECT_ID = process.env.MUSHI_PROJECT_ID ?? "";
|
|
12
|
+
async function apiCall(path, options) {
|
|
13
|
+
const res = await fetch(`${API_ENDPOINT}/api${path}`, {
|
|
14
|
+
...options,
|
|
15
|
+
headers: {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
"X-Mushi-Api-Key": API_KEY,
|
|
18
|
+
"X-Mushi-Project": PROJECT_ID,
|
|
19
|
+
...options?.headers ?? {}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (!res.ok) {
|
|
23
|
+
throw new Error(`Mushi API error: ${res.status} ${await res.text()}`);
|
|
24
|
+
}
|
|
25
|
+
return res.json();
|
|
26
|
+
}
|
|
27
|
+
var server = new McpServer({
|
|
28
|
+
name: "mushi-mushi",
|
|
29
|
+
version: "0.0.1"
|
|
30
|
+
});
|
|
31
|
+
server.tool(
|
|
32
|
+
"get_recent_reports",
|
|
33
|
+
"List recent bug reports with optional filters",
|
|
34
|
+
{
|
|
35
|
+
status: z.string().optional().describe("Filter by status: new, classified, grouped, fixing, fixed, dismissed"),
|
|
36
|
+
category: z.string().optional().describe("Filter by category: bug, slow, visual, confusing, other"),
|
|
37
|
+
severity: z.string().optional().describe("Filter by severity: critical, high, medium, low"),
|
|
38
|
+
limit: z.number().optional().describe("Max reports to return (default 20, max 100)")
|
|
39
|
+
},
|
|
40
|
+
async (args) => {
|
|
41
|
+
const params = new URLSearchParams();
|
|
42
|
+
if (args.status) params.set("status", args.status);
|
|
43
|
+
if (args.category) params.set("category", args.category);
|
|
44
|
+
if (args.severity) params.set("severity", args.severity);
|
|
45
|
+
params.set("limit", String(args.limit ?? 20));
|
|
46
|
+
const data = await apiCall(`/v1/admin/reports?${params}`);
|
|
47
|
+
return {
|
|
48
|
+
content: [{ type: "text", text: JSON.stringify(data.data, null, 2) }]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
server.tool(
|
|
53
|
+
"get_report_detail",
|
|
54
|
+
"Get full details for a single bug report including classification, logs, and environment",
|
|
55
|
+
{
|
|
56
|
+
reportId: z.string().describe("The report UUID")
|
|
57
|
+
},
|
|
58
|
+
async (args) => {
|
|
59
|
+
const data = await apiCall(`/v1/admin/reports/${args.reportId}`);
|
|
60
|
+
return {
|
|
61
|
+
content: [{ type: "text", text: JSON.stringify(data.data, null, 2) }]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
server.tool(
|
|
66
|
+
"search_reports",
|
|
67
|
+
"Search reports by keyword in description or summary",
|
|
68
|
+
{
|
|
69
|
+
query: z.string().describe("Search query text"),
|
|
70
|
+
limit: z.number().optional().describe("Max results (default 10)")
|
|
71
|
+
},
|
|
72
|
+
async (args) => {
|
|
73
|
+
const data = await apiCall(`/v1/admin/reports?limit=${args.limit ?? 10}`);
|
|
74
|
+
const q = args.query.toLowerCase();
|
|
75
|
+
const filtered = data.data.reports.filter((r) => {
|
|
76
|
+
const desc = (r.description ?? "").toLowerCase();
|
|
77
|
+
const summary = (r.summary ?? "").toLowerCase();
|
|
78
|
+
return desc.includes(q) || summary.includes(q);
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
content: [{ type: "text", text: JSON.stringify({ results: filtered, total: filtered.length }, null, 2) }]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
server.tool(
|
|
86
|
+
"get_fix_context",
|
|
87
|
+
"Get all context an agent needs to fix a bug: report, classification, repro steps, relevant code, graph context",
|
|
88
|
+
{
|
|
89
|
+
reportId: z.string().describe("The report UUID to fix")
|
|
90
|
+
},
|
|
91
|
+
async (args) => {
|
|
92
|
+
const report = await apiCall(`/v1/admin/reports/${args.reportId}`);
|
|
93
|
+
return {
|
|
94
|
+
content: [{
|
|
95
|
+
type: "text",
|
|
96
|
+
text: JSON.stringify({
|
|
97
|
+
report: report.data,
|
|
98
|
+
reproductionSteps: report.data.reproduction_steps ?? [],
|
|
99
|
+
component: report.data.component,
|
|
100
|
+
rootCause: report.data.stage2_analysis?.rootCause,
|
|
101
|
+
bugOntologyTags: report.data.bug_ontology_tags
|
|
102
|
+
}, null, 2)
|
|
103
|
+
}]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
server.tool(
|
|
108
|
+
"submit_fix_result",
|
|
109
|
+
"Agent reports fix outcome \u2014 branch, PR URL, files changed",
|
|
110
|
+
{
|
|
111
|
+
reportId: z.string().describe("The report UUID"),
|
|
112
|
+
branch: z.string().describe("Git branch name"),
|
|
113
|
+
prUrl: z.string().optional().describe("GitHub PR URL"),
|
|
114
|
+
filesChanged: z.array(z.string()).describe("Files modified"),
|
|
115
|
+
linesChanged: z.number().describe("Total lines changed"),
|
|
116
|
+
summary: z.string().describe("Fix summary")
|
|
117
|
+
},
|
|
118
|
+
async (args) => {
|
|
119
|
+
const data = await apiCall("/v1/admin/fixes", {
|
|
120
|
+
method: "POST",
|
|
121
|
+
body: JSON.stringify({ reportId: args.reportId, agent: "mcp" })
|
|
122
|
+
});
|
|
123
|
+
await apiCall(`/v1/admin/fixes/${data.data.fixId}`, {
|
|
124
|
+
method: "PATCH",
|
|
125
|
+
body: JSON.stringify({
|
|
126
|
+
status: "completed",
|
|
127
|
+
branch: args.branch,
|
|
128
|
+
pr_url: args.prUrl,
|
|
129
|
+
files_changed: args.filesChanged,
|
|
130
|
+
lines_changed: args.linesChanged,
|
|
131
|
+
summary: args.summary,
|
|
132
|
+
completed_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
content: [{ type: "text", text: JSON.stringify({ ok: true, fixId: data.data.fixId }) }]
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
server.tool(
|
|
141
|
+
"get_similar_bugs",
|
|
142
|
+
"Find related bugs via knowledge graph or keyword search",
|
|
143
|
+
{
|
|
144
|
+
query: z.string().describe("Component name, page, or bug description"),
|
|
145
|
+
limit: z.number().optional().describe("Max results (default 5)")
|
|
146
|
+
},
|
|
147
|
+
async (args) => {
|
|
148
|
+
const data = await apiCall(`/v1/admin/reports?limit=${args.limit ?? 5}`);
|
|
149
|
+
const q = args.query.toLowerCase();
|
|
150
|
+
const similar = data.data.reports.filter((r) => {
|
|
151
|
+
const text = `${r.summary ?? ""} ${r.component ?? ""} ${r.description ?? ""}`.toLowerCase();
|
|
152
|
+
return text.includes(q);
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
content: [{ type: "text", text: JSON.stringify({ similar, total: similar.length }, null, 2) }]
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
server.tool(
|
|
160
|
+
"get_blast_radius",
|
|
161
|
+
"Graph traversal showing affected areas for a given bug group",
|
|
162
|
+
{
|
|
163
|
+
nodeId: z.string().describe("Graph node UUID")
|
|
164
|
+
},
|
|
165
|
+
async (args) => {
|
|
166
|
+
const data = await apiCall(`/v1/admin/graph/blast-radius/${args.nodeId}`);
|
|
167
|
+
return {
|
|
168
|
+
content: [{ type: "text", text: JSON.stringify(data.data, null, 2) }]
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
server.resource(
|
|
173
|
+
"project_stats",
|
|
174
|
+
"project://stats",
|
|
175
|
+
{ description: "Report counts, category breakdown, severity distribution" },
|
|
176
|
+
async () => {
|
|
177
|
+
const data = await apiCall("/v1/admin/stats");
|
|
178
|
+
return {
|
|
179
|
+
contents: [{ uri: "project://stats", mimeType: "application/json", text: JSON.stringify(data.data, null, 2) }]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
async function main() {
|
|
184
|
+
if (!API_KEY) {
|
|
185
|
+
log.fatal("MUSHI_API_KEY environment variable is required");
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
const transport = new StdioServerTransport();
|
|
189
|
+
await server.connect(transport);
|
|
190
|
+
}
|
|
191
|
+
main().catch((err) => {
|
|
192
|
+
log.fatal("MCP server crashed", { err: String(err) });
|
|
193
|
+
process.exit(1);
|
|
194
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mushi-mushi/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "MCP server exposing Mushi Mushi reports to coding agents",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"bin": {
|
|
16
|
+
"mushi-mcp": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"dev": "tsup --watch",
|
|
26
|
+
"lint": "eslint src/",
|
|
27
|
+
"test": "echo 'no tests yet'",
|
|
28
|
+
"typecheck": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
32
|
+
"@mushi-mushi/core": "workspace:*",
|
|
33
|
+
"zod": "^3.24.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@mushi-mushi/eslint-config": "workspace:*",
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"eslint": "^9.39.4",
|
|
39
|
+
"tsup": "^8.4.0",
|
|
40
|
+
"typescript": "^5.7.3"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/kensaurus/mushi-mushi.git",
|
|
45
|
+
"directory": "packages/mcp"
|
|
46
|
+
},
|
|
47
|
+
"author": "Kenji Sakuramoto",
|
|
48
|
+
"homepage": "https://github.com/kensaurus/mushi-mushi/tree/main/packages/mcp#readme",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/kensaurus/mushi-mushi/issues"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"sideEffects": false,
|
|
56
|
+
"keywords": [
|
|
57
|
+
"mushi-mushi",
|
|
58
|
+
"bug-reporting",
|
|
59
|
+
"sdk"
|
|
60
|
+
]
|
|
61
|
+
}
|