@grafema/mcp 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +28 -0
- package/dist/handlers.d.ts.map +1 -1
- package/dist/handlers.js +5 -4
- package/package.json +3 -3
- package/src/handlers.ts +5 -4
package/README.md
CHANGED
|
@@ -77,6 +77,34 @@ trace_data_flow({ from: "req.body", file: "api/users.js" })
|
|
|
77
77
|
check_invariant("violation(X) :- node(X, 'CALL'), attr(X, 'name', 'eval')")
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
## Configuration
|
|
81
|
+
|
|
82
|
+
### GitHub Token (for bug reporting)
|
|
83
|
+
|
|
84
|
+
The `report_issue` tool can automatically create GitHub issues if `GITHUB_TOKEN` is set.
|
|
85
|
+
|
|
86
|
+
**Option 1: In `.mcp.json`**
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"grafema": {
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": ["@grafema/mcp", "--project", "."],
|
|
93
|
+
"env": {
|
|
94
|
+
"GITHUB_TOKEN": "ghp_your_token_here"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Option 2: Environment variable**
|
|
102
|
+
```bash
|
|
103
|
+
export GITHUB_TOKEN=ghp_your_token_here
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
To create a token: https://github.com/settings/tokens/new (needs `repo` scope for public repos, or `public_repo` for public only).
|
|
107
|
+
|
|
80
108
|
## License
|
|
81
109
|
|
|
82
110
|
Apache-2.0
|
package/dist/handlers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,OAAO,KAAK,EACV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IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAoBxF;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,UAAU,CAAC,CAYnE;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,CAe1D;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAwB9E;AAID;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CA6D1F;AAED;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,UAAU,CAAC,CAyChE;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CAwG1F;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CA8B1F;AAID,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAalF;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,CAwE5F;AAID,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,OAAO,YAAY,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAkEvG"}
|
package/dist/handlers.js
CHANGED
|
@@ -688,7 +688,9 @@ Rule: violation(X) :- node(X, "CALL"), attr(X, "name", "eval").
|
|
|
688
688
|
// === BUG REPORTING ===
|
|
689
689
|
export async function handleReportIssue(args) {
|
|
690
690
|
const { title, description, context, labels = ['bug'] } = args;
|
|
691
|
-
|
|
691
|
+
// Use user's token if provided, otherwise fall back to project's issue-only token
|
|
692
|
+
const GRAFEMA_ISSUE_TOKEN = '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';
|
|
693
|
+
const githubToken = process.env.GITHUB_TOKEN || GRAFEMA_ISSUE_TOKEN;
|
|
692
694
|
const repo = 'Disentinel/grafema';
|
|
693
695
|
// Build issue body
|
|
694
696
|
const body = `## Description
|
|
@@ -739,9 +741,8 @@ ${context ? `## Context\n\`\`\`\n${context}\n\`\`\`\n` : ''}
|
|
|
739
741
|
const encodedBody = encodeURIComponent(body);
|
|
740
742
|
const encodedLabels = encodeURIComponent(labels.join(','));
|
|
741
743
|
const directUrl = `${issueUrl}?title=${encodedTitle}&body=${encodedBody}&labels=${encodedLabels}`;
|
|
742
|
-
return textResult(`⚠️
|
|
744
|
+
return textResult(`⚠️ Failed to create issue automatically. Please create it manually:\n\n` +
|
|
743
745
|
`**Quick link** (may truncate long descriptions):\n${directUrl}\n\n` +
|
|
744
746
|
`**Or copy this template to** ${issueUrl}:\n\n` +
|
|
745
|
-
`---\n**Title:** ${title}\n\n${body}\n
|
|
746
|
-
`To enable automatic issue creation, set GITHUB_TOKEN environment variable.`);
|
|
747
|
+
`---\n**Title:** ${title}\n\n${body}\n---`);
|
|
747
748
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafema/mcp",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
4
|
"description": "MCP server for Grafema code analysis toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/server.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
40
40
|
"ajv": "^8.17.1",
|
|
41
|
-
"@grafema/core": "0.1.0-alpha.
|
|
42
|
-
"@grafema/types": "0.1.0-alpha.
|
|
41
|
+
"@grafema/core": "0.1.0-alpha.5",
|
|
42
|
+
"@grafema/types": "0.1.0-alpha.5"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.8",
|
package/src/handlers.ts
CHANGED
|
@@ -852,7 +852,9 @@ Rule: violation(X) :- node(X, "CALL"), attr(X, "name", "eval").
|
|
|
852
852
|
|
|
853
853
|
export async function handleReportIssue(args: import('./types.js').ReportIssueArgs): Promise<ToolResult> {
|
|
854
854
|
const { title, description, context, labels = ['bug'] } = args;
|
|
855
|
-
|
|
855
|
+
// Use user's token if provided, otherwise fall back to project's issue-only token
|
|
856
|
+
const GRAFEMA_ISSUE_TOKEN = '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';
|
|
857
|
+
const githubToken = process.env.GITHUB_TOKEN || GRAFEMA_ISSUE_TOKEN;
|
|
856
858
|
const repo = 'Disentinel/grafema';
|
|
857
859
|
|
|
858
860
|
// Build issue body
|
|
@@ -909,10 +911,9 @@ ${context ? `## Context\n\`\`\`\n${context}\n\`\`\`\n` : ''}
|
|
|
909
911
|
const directUrl = `${issueUrl}?title=${encodedTitle}&body=${encodedBody}&labels=${encodedLabels}`;
|
|
910
912
|
|
|
911
913
|
return textResult(
|
|
912
|
-
`⚠️
|
|
914
|
+
`⚠️ Failed to create issue automatically. Please create it manually:\n\n` +
|
|
913
915
|
`**Quick link** (may truncate long descriptions):\n${directUrl}\n\n` +
|
|
914
916
|
`**Or copy this template to** ${issueUrl}:\n\n` +
|
|
915
|
-
`---\n**Title:** ${title}\n\n${body}\n
|
|
916
|
-
`To enable automatic issue creation, set GITHUB_TOKEN environment variable.`
|
|
917
|
+
`---\n**Title:** ${title}\n\n${body}\n---`
|
|
917
918
|
);
|
|
918
919
|
}
|