@rigour-labs/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/LICENSE +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +134 -0
- package/dist/smoke.test.d.ts +1 -0
- package/dist/smoke.test.js +8 -0
- package/package.json +26 -0
- package/src/index.ts +146 -0
- package/src/smoke.test.ts +7 -0
- package/tsconfig.json +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rigour Contributors
|
|
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/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
7
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
8
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const yaml_1 = __importDefault(require("yaml"));
|
|
12
|
+
const core_1 = require("@rigour-labs/core");
|
|
13
|
+
const server = new index_js_1.Server({
|
|
14
|
+
name: "rigour-mcp",
|
|
15
|
+
version: "1.0.0",
|
|
16
|
+
}, {
|
|
17
|
+
capabilities: {
|
|
18
|
+
tools: {},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
async function loadConfig(cwd) {
|
|
22
|
+
const configPath = path_1.default.join(cwd, "rigour.yml");
|
|
23
|
+
if (!(await fs_extra_1.default.pathExists(configPath))) {
|
|
24
|
+
throw new Error("Rigour configuration (rigour.yml) not found. The agent must run `rigour init` first to establish engineering standards.");
|
|
25
|
+
}
|
|
26
|
+
const configContent = await fs_extra_1.default.readFile(configPath, "utf-8");
|
|
27
|
+
return core_1.ConfigSchema.parse(yaml_1.default.parse(configContent));
|
|
28
|
+
}
|
|
29
|
+
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
30
|
+
return {
|
|
31
|
+
tools: [
|
|
32
|
+
{
|
|
33
|
+
name: "rigour_check_status",
|
|
34
|
+
description: "Checks the current project state against Rigour engineering gates. Returns PASS/FAIL and a summary of active gates.",
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
cwd: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Absolute path to the project root.",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
required: ["cwd"],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "rigour_get_fix_packet",
|
|
48
|
+
description: "Retrieves a prioritized 'Fix Packet' containing actionable engineering instructions to resolve quality gate failures. Use this to iteratively improve your solution.",
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
cwd: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Absolute path to the project root.",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
required: ["cwd"],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
64
|
+
const { name, arguments: args } = request.params;
|
|
65
|
+
const cwd = args?.cwd || process.cwd();
|
|
66
|
+
try {
|
|
67
|
+
const config = await loadConfig(cwd);
|
|
68
|
+
const runner = new core_1.GateRunner(config);
|
|
69
|
+
const report = await runner.run(cwd);
|
|
70
|
+
switch (name) {
|
|
71
|
+
case "rigour_check_status":
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: "text",
|
|
76
|
+
text: `RIGOUR AUDIT RESULT: ${report.status}\n\nSummary:\n${Object.entries(report.summary).map(([k, v]) => `- ${k}: ${v}`).join("\n")}`,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
case "rigour_get_fix_packet":
|
|
81
|
+
if (report.status === "PASS") {
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: "ALL QUALITY GATES PASSED. The current state meets the required engineering standards.",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const packet = report.failures.map((f, i) => {
|
|
92
|
+
let text = `FIX TASK ${i + 1}: [${f.id.toUpperCase()}] ${f.title}\n`;
|
|
93
|
+
text += ` - CONTEXT: ${f.details}\n`;
|
|
94
|
+
if (f.files && f.files.length > 0) {
|
|
95
|
+
text += ` - TARGET FILES: ${f.files.join(", ")}\n`;
|
|
96
|
+
}
|
|
97
|
+
if (f.hint) {
|
|
98
|
+
text += ` - REFACTORING GUIDANCE: ${f.hint}\n`;
|
|
99
|
+
}
|
|
100
|
+
return text;
|
|
101
|
+
}).join("\n---\n");
|
|
102
|
+
return {
|
|
103
|
+
content: [
|
|
104
|
+
{
|
|
105
|
+
type: "text",
|
|
106
|
+
text: `ENGINEERING REFINEMENT REQUIRED:\n\nThe project state violated ${report.failures.length} quality gates. You MUST address these failures before declaring the task complete:\n\n${packet}`,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
};
|
|
110
|
+
default:
|
|
111
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return {
|
|
116
|
+
content: [
|
|
117
|
+
{
|
|
118
|
+
type: "text",
|
|
119
|
+
text: `RIGOUR ERROR: ${error.message}`,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
isError: true,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
async function main() {
|
|
127
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
128
|
+
await server.connect(transport);
|
|
129
|
+
console.error("Rigour MCP server v1.0.0 running on stdio");
|
|
130
|
+
}
|
|
131
|
+
main().catch((error) => {
|
|
132
|
+
console.error("Fatal error in Rigour MCP server:", error);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
(0, vitest_1.describe)('MCP Smoke Test', () => {
|
|
5
|
+
(0, vitest_1.it)('should pass', async () => {
|
|
6
|
+
(0, vitest_1.expect)(true).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rigour-labs/mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/erashu212/rigour"
|
|
7
|
+
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"provenance": true
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@modelcontextprotocol/sdk": "^0.6.0",
|
|
14
|
+
"fs-extra": "^11.2.0",
|
|
15
|
+
"yaml": "^2.8.2",
|
|
16
|
+
"@rigour-labs/core": "1.0.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^25.0.3"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"start": "node dist/index.js",
|
|
24
|
+
"test": "vitest run"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import {
|
|
4
|
+
CallToolRequestSchema,
|
|
5
|
+
ListToolsRequestSchema,
|
|
6
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
import fs from "fs-extra";
|
|
8
|
+
import path from "path";
|
|
9
|
+
import yaml from "yaml";
|
|
10
|
+
import { GateRunner, ConfigSchema, Report } from "@rigour-labs/core";
|
|
11
|
+
|
|
12
|
+
const server = new Server(
|
|
13
|
+
{
|
|
14
|
+
name: "rigour-mcp",
|
|
15
|
+
version: "1.0.0",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
capabilities: {
|
|
19
|
+
tools: {},
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
async function loadConfig(cwd: string) {
|
|
25
|
+
const configPath = path.join(cwd, "rigour.yml");
|
|
26
|
+
if (!(await fs.pathExists(configPath))) {
|
|
27
|
+
throw new Error("Rigour configuration (rigour.yml) not found. The agent must run `rigour init` first to establish engineering standards.");
|
|
28
|
+
}
|
|
29
|
+
const configContent = await fs.readFile(configPath, "utf-8");
|
|
30
|
+
return ConfigSchema.parse(yaml.parse(configContent));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
34
|
+
return {
|
|
35
|
+
tools: [
|
|
36
|
+
{
|
|
37
|
+
name: "rigour_check_status",
|
|
38
|
+
description: "Checks the current project state against Rigour engineering gates. Returns PASS/FAIL and a summary of active gates.",
|
|
39
|
+
inputSchema: {
|
|
40
|
+
type: "object",
|
|
41
|
+
properties: {
|
|
42
|
+
cwd: {
|
|
43
|
+
type: "string",
|
|
44
|
+
description: "Absolute path to the project root.",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
required: ["cwd"],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "rigour_get_fix_packet",
|
|
52
|
+
description: "Retrieves a prioritized 'Fix Packet' containing actionable engineering instructions to resolve quality gate failures. Use this to iteratively improve your solution.",
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: "object",
|
|
55
|
+
properties: {
|
|
56
|
+
cwd: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Absolute path to the project root.",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ["cwd"],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
69
|
+
const { name, arguments: args } = request.params;
|
|
70
|
+
const cwd = (args as any)?.cwd || process.cwd();
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const config = await loadConfig(cwd);
|
|
74
|
+
const runner = new GateRunner(config);
|
|
75
|
+
const report = await runner.run(cwd);
|
|
76
|
+
|
|
77
|
+
switch (name) {
|
|
78
|
+
case "rigour_check_status":
|
|
79
|
+
return {
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
type: "text",
|
|
83
|
+
text: `RIGOUR AUDIT RESULT: ${report.status}\n\nSummary:\n${Object.entries(report.summary).map(([k, v]) => `- ${k}: ${v}`).join("\n")}`,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
case "rigour_get_fix_packet":
|
|
89
|
+
if (report.status === "PASS") {
|
|
90
|
+
return {
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: "text",
|
|
94
|
+
text: "ALL QUALITY GATES PASSED. The current state meets the required engineering standards.",
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const packet = report.failures.map((f, i) => {
|
|
101
|
+
let text = `FIX TASK ${i + 1}: [${f.id.toUpperCase()}] ${f.title}\n`;
|
|
102
|
+
text += ` - CONTEXT: ${f.details}\n`;
|
|
103
|
+
if (f.files && f.files.length > 0) {
|
|
104
|
+
text += ` - TARGET FILES: ${f.files.join(", ")}\n`;
|
|
105
|
+
}
|
|
106
|
+
if (f.hint) {
|
|
107
|
+
text += ` - REFACTORING GUIDANCE: ${f.hint}\n`;
|
|
108
|
+
}
|
|
109
|
+
return text;
|
|
110
|
+
}).join("\n---\n");
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: "text",
|
|
116
|
+
text: `ENGINEERING REFINEMENT REQUIRED:\n\nThe project state violated ${report.failures.length} quality gates. You MUST address these failures before declaring the task complete:\n\n${packet}`,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
default:
|
|
122
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
123
|
+
}
|
|
124
|
+
} catch (error: any) {
|
|
125
|
+
return {
|
|
126
|
+
content: [
|
|
127
|
+
{
|
|
128
|
+
type: "text",
|
|
129
|
+
text: `RIGOUR ERROR: ${error.message}`,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
isError: true,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
async function main() {
|
|
138
|
+
const transport = new StdioServerTransport();
|
|
139
|
+
await server.connect(transport);
|
|
140
|
+
console.error("Rigour MCP server v1.0.0 running on stdio");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
main().catch((error) => {
|
|
144
|
+
console.error("Fatal error in Rigour MCP server:", error);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
});
|