@rigour-labs/mcp 6.6.1 → 6.6.3

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.
@@ -12,7 +12,7 @@ export type ToolGroup = keyof typeof TOOL_GROUPS;
12
12
  export declare const GOVERNANCE_TOOLS: readonly ["rigour_agent_register", "rigour_agent_deregister", "rigour_checkpoint", "rigour_handoff", "rigour_handoff_accept", "rigour_hooks_check", "rigour_hooks_init", "rigour_run", "rigour_run_supervised"];
13
13
  /** Tool names for a RIGOUR_MCP_TOOLS value; core is always included, unknown groups are ignored. */
14
14
  export declare function advertisedToolNames(spec?: string | undefined): Set<string>;
15
- export declare function getAdvertisedToolDefinitions(spec?: string): ({
15
+ export declare function getAdvertisedToolDefinitions(spec?: string | undefined, cwd?: string): ({
16
16
  name: string;
17
17
  description: string;
18
18
  inputSchema: {
@@ -4,9 +4,14 @@
4
4
  * Every advertised tool costs every agent session its definition in context
5
5
  * and one more choice to get wrong, so the default is the core loop a single
6
6
  * agent needs. Other groups are opt-in through RIGOUR_MCP_TOOLS in the MCP
7
- * client's config, e.g. "governance,telemetry" or "full". Tools outside the
7
+ * client's config, e.g. "governance,telemetry" or "full". A repository whose
8
+ * rigour.yml turns on agent teams or checkpoints gets the governance group too,
9
+ * since its gates expect agents to register and check in. Tools outside the
8
10
  * advertised set stay callable; they are just not listed.
9
11
  */
12
+ import fs from 'fs';
13
+ import path from 'path';
14
+ import yaml from 'yaml';
10
15
  import { TOOL_DEFINITIONS } from './tools/definitions.js';
11
16
  export const TOOL_GROUPS = {
12
17
  /** Load memory, scope context, avoid reinvention, gate and review the change, learn. */
@@ -54,7 +59,17 @@ export function advertisedToolNames(spec = process.env.RIGOUR_MCP_TOOLS) {
54
59
  const groups = requested.includes('full') ? Object.keys(TOOL_GROUPS) : ['core', ...requested];
55
60
  return new Set(groups.filter((g) => g in TOOL_GROUPS).flatMap(g => [...TOOL_GROUPS[g]]));
56
61
  }
57
- export function getAdvertisedToolDefinitions(spec) {
58
- const names = advertisedToolNames(spec);
62
+ /** The repository's rigour.yml enables a gate that needs the governance tools (agent_team, checkpoint). */
63
+ function repoNeedsGovernance(cwd) {
64
+ try {
65
+ const gates = yaml.parse(fs.readFileSync(path.join(cwd, 'rigour.yml'), 'utf8'))?.gates ?? {};
66
+ return gates.agent_team?.enabled === true || gates.checkpoint?.enabled === true;
67
+ }
68
+ catch {
69
+ return false;
70
+ }
71
+ }
72
+ export function getAdvertisedToolDefinitions(spec = process.env.RIGOUR_MCP_TOOLS, cwd = process.env.RIGOUR_CWD || process.cwd()) {
73
+ const names = advertisedToolNames([spec, repoNeedsGovernance(cwd) ? 'governance' : ''].filter(Boolean).join(','));
59
74
  return TOOL_DEFINITIONS.filter(t => names.has(t.name));
60
75
  }
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ // The `rigour-mcp` server: apply the profile for the repository it serves (RIGOUR_CWD, else where it
3
+ // started) before the rest of Rigour loads; each call is then checked against it (index.ts).
4
+ import { applyProfile } from '@rigour-labs/core/profile';
5
+ applyProfile(process.env.RIGOUR_CWD || process.cwd());
6
+ await import('./index.js');
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { randomUUID } from "crypto";
16
16
  import { GateRunner, countUsage, flushDailyUsage } from "@rigour-labs/core";
17
17
  // Utils
18
18
  import { loadConfig, loadMcpSettings, logStudioEvent, resolveCwd } from './utils/config.js';
19
+ import { profileMismatch } from '@rigour-labs/core/profile';
19
20
  import { bindServer } from './utils/notifications.js';
20
21
  import { getMcpVersion } from './utils/package-version.js';
21
22
  import { buildMcpResultMeta, buildStudioImpact } from './utils/impact-receipt.js';
@@ -87,6 +88,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
87
88
  const { name, arguments: args } = request.params;
88
89
  const cwd = resolveCwd(args);
89
90
  const requestId = randomUUID();
91
+ const foreign = profileMismatch(cwd);
92
+ if (foreign)
93
+ return { content: [{ type: "text", text: `ERROR: ${foreign}` }], isError: true };
90
94
  try {
91
95
  await logStudioEvent(cwd, { type: "tool_call", requestId, tool: name, arguments: args });
92
96
  try {
@@ -39,6 +39,7 @@ export async function handleReview(config, cwd, args) {
39
39
  advisory_count: result.advisory.length,
40
40
  muted_count: result.muted,
41
41
  excluded_outside_changed_lines: result.excludedOutsideChangedLines,
42
+ preexisting_not_reported: result.preexisting,
42
43
  unlocated_failures: result.unlocated,
43
44
  gate_errors: result.gateErrors,
44
45
  ...qualityReceipt(config, cwd, diff),
@@ -234,6 +234,23 @@ export declare function loadConfig(cwd: string): Promise<{
234
234
  enabled: boolean;
235
235
  registry?: string | undefined;
236
236
  };
237
+ unused_exports: {
238
+ enabled: boolean;
239
+ allow: string[];
240
+ };
241
+ query_patterns: {
242
+ enabled: boolean;
243
+ };
244
+ optional_params: {
245
+ enabled: boolean;
246
+ };
247
+ duplicate_functions: {
248
+ enabled: boolean;
249
+ };
250
+ orphan_files: {
251
+ enabled: boolean;
252
+ allow: string[];
253
+ };
237
254
  migration_order: {
238
255
  enabled: boolean;
239
256
  dirs: string[];
@@ -282,6 +299,14 @@ export declare function loadConfig(cwd: string): Promise<{
282
299
  };
283
300
  review: {
284
301
  include_heuristics: boolean;
302
+ show_preexisting: boolean;
303
+ reviewer: {
304
+ enabled: boolean;
305
+ timeout_ms: number;
306
+ command: string;
307
+ model?: string | undefined;
308
+ };
309
+ github_account?: string | undefined;
285
310
  };
286
311
  planned: string[];
287
312
  preset?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigour-labs/mcp",
3
- "version": "6.6.1",
3
+ "version": "6.6.3",
4
4
  "description": "MCP server + live dashboard for AI code governance — OWASP LLM Top 10 (10/10), real-time MCP App UI, 25+ security patterns, memory and lessons recalled by meaning, hallucinated import detection, multi-agent governance. Works with Claude, Cursor, VS Code, ChatGPT, Goose, Windsurf. Industry presets for HIPAA, SOC2, FedRAMP.",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -50,7 +50,7 @@
50
50
  "README.md"
51
51
  ],
52
52
  "bin": {
53
- "rigour-mcp": "dist/index.js"
53
+ "rigour-mcp": "dist/bin.js"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",
@@ -65,7 +65,7 @@
65
65
  "execa": "^8.0.1",
66
66
  "fs-extra": "^11.4.0",
67
67
  "yaml": "^2.8.2",
68
- "@rigour-labs/core": "6.6.1"
68
+ "@rigour-labs/core": "6.6.3"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/node": "^25.0.3",