sage-governance 1.0.0 → 1.0.1

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/AGENTS.MD CHANGED
@@ -312,7 +312,7 @@ When the request involves cloud infrastructure, API integrations, or
312
312
  deployment configs, the Security Agent also checks:
313
313
 
314
314
  - Environment variable handling (secrets must never be in code)
315
- - AI provider credential hygiene (ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.)
315
+ - AI provider credential hygiene (OPENAI_API_KEY, etc.)
316
316
  - Database connection string exposure
317
317
  - Cloud misconfiguration patterns (public S3 buckets, open ports)
318
318
  - GDPR data processor agreement gaps (third-party API calls with PII)
package/README.md CHANGED
@@ -84,7 +84,7 @@ Deterministic (no LLM) full-spectrum code scanner.
84
84
 
85
85
  | Severity | Category | Examples |
86
86
  |----------|----------|---------|
87
- | P0 | Secret exposure | Hardcoded API keys, Anthropic/OpenAI keys, DB passwords |
87
+ | P0 | Secret exposure | Hardcoded API keys, OpenAI keys, DB passwords |
88
88
  | P0 | Critical PII | SSN, biometrics, medical data, GDPR Article 9 special categories |
89
89
  | P1 | Sensitive PII | Geolocation, passport numbers, date of birth |
90
90
  | P1 | Protected attribute direct use | `race`, `sex`, `age` as model features |
@@ -128,64 +128,144 @@ Developer asks coding agent to create classifier.py
128
128
 
129
129
  ---
130
130
 
131
- ## Installation
131
+ ## Installation & Quick Start
132
132
 
133
- ### Quick Start (recommended)
133
+ ### 1. Global Installation (recommended)
134
+
135
+ Install SAGE globally via npm:
134
136
 
135
137
  ```bash
136
138
  npm install -g sage-governance
137
139
  ```
138
140
 
139
- This installs the `sage` CLI command globally. The Node.js wrapper automatically resolves `python3`, `python`, or `py` in that order.
141
+ This installs the `sage` CLI command globally.
142
+
143
+ ### 2. Python Dependencies
140
144
 
141
- ### Manual / Development
145
+ Install the required Python packages:
142
146
 
143
147
  ```bash
144
- git clone https://github.com/[your-org]/sage-governance
145
- cd sage-governance
148
+ pip install -r $(npm root -g)/sage-governance/requirements.txt
149
+ ```
150
+
151
+ *(Alternatively, run `pip install mcp openai pydantic fairlearn diffprivlib pandas scikit-learn`)*
152
+
153
+ ---
154
+
155
+ ## Configuring SAGE in AI Clients
156
+
157
+ Since SAGE is an MCP server, you must add it to the MCP configuration of your AI coding environment. Ensure the environment has access to your `OPENAI_API_KEY`.
146
158
 
147
- # Python dependencies
148
- pip install mcp anthropic pydantic fairlearn diffprivlib
159
+ ### 1. Cursor
149
160
 
150
- # Set your LLM provider key
151
- export ANTHROPIC_API_KEY=sk-ant-...
161
+ To enable SAGE in Cursor, you can configure it globally or on a per-project basis.
152
162
 
153
- # Optional: override model
154
- export SAGE_LLM_MODEL=claude-sonnet-4-6
163
+ #### Option A: Project-level Configuration (recommended)
164
+ Create a `.cursor/mcp.json` file in your project root with the following content:
165
+
166
+ ```json
167
+ {
168
+ "mcpServers": {
169
+ "sage-governance": {
170
+ "command": "sage",
171
+ "args": [],
172
+ "type": "stdio",
173
+ "env": {
174
+ "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
175
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
176
+ }
177
+ }
178
+ }
179
+ }
155
180
  ```
156
181
 
157
- ### Run SAGE as MCP Server
182
+ #### Option B: Global Settings
183
+ 1. Go to **Cursor Settings** -> **Features** -> **MCP**.
184
+ 2. Click **+ Add New MCP Server**.
185
+ 3. Configure the fields:
186
+ - **Name**: `sage-governance`
187
+ - **Type**: `command`
188
+ - **Command**: `sage`
189
+ - **Args**: (leave empty)
190
+ 4. Click **Save**.
158
191
 
159
- ```bash
160
- # Via CLI (after npm install -g)
161
- sage
192
+ ---
162
193
 
163
- # Directly via Python
164
- python sage/mcp_server.py
194
+ ### 2. OpenCode
195
+
196
+ Add the following configuration to `opencode.json` in your project root directory:
197
+
198
+ ```json
199
+ {
200
+ "mcp": {
201
+ "sage-governance": {
202
+ "type": "local",
203
+ "command": ["sage"],
204
+ "enabled": true,
205
+ "environment": {
206
+ "OPENAI_API_KEY": "(env:OPENAI_API_KEY)",
207
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
208
+ }
209
+ }
210
+ }
211
+ }
165
212
  ```
166
213
 
167
214
  ---
168
215
 
169
- ## OpenCode Configuration (`opencode.json`)
216
+ ### 3. Claude Desktop
217
+
218
+ Add SAGE to your global Claude Desktop configuration file:
219
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
220
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
221
+
222
+ Add this entry under the `mcpServers` object:
170
223
 
171
224
  ```json
172
225
  {
173
- "$schema": "https://opencode.ai/config.schema.json",
174
226
  "mcpServers": {
175
227
  "sage-governance": {
176
- "type": "local",
177
228
  "command": "sage",
178
229
  "args": [],
179
230
  "env": {
180
- "ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY}",
181
- "SAGE_LLM_MODEL": "claude-sonnet-4-6"
231
+ "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
232
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
182
233
  }
183
234
  }
184
235
  }
185
236
  }
186
237
  ```
187
238
 
188
- For Cline, Claude Code, or Continue, use the equivalent MCP server configuration for stdio transport.
239
+ ---
240
+
241
+ ### 4. Claude Code
242
+
243
+ Run this single command in your terminal to automatically register SAGE with Claude Code:
244
+
245
+ ```bash
246
+ claude mcp add sage-governance sage -- sage
247
+ ```
248
+
249
+ ---
250
+
251
+ ### 5. VS Code (Cline / Continue)
252
+
253
+ Add the server to your Cline/Continue MCP configuration settings JSON:
254
+
255
+ ```json
256
+ {
257
+ "mcpServers": {
258
+ "sage-governance": {
259
+ "command": "sage",
260
+ "args": [],
261
+ "env": {
262
+ "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
263
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
264
+ }
265
+ }
266
+ }
267
+ }
268
+ ```
189
269
 
190
270
  ---
191
271
 
@@ -299,7 +379,7 @@ When base rates differ across groups, Demographic Parity, Equalized Odds, and Pr
299
379
  | George | Ethics & regulatory policy files, project management |
300
380
  | Jeremy | Data science validation, security pipeline, presentation |
301
381
 
302
- **Built with:** FastMCP · Python · Pydantic · Fairlearn · Anthropic API
382
+ **Built with:** FastMCP · Python · Pydantic · Fairlearn · OpenAI API
303
383
  **Built by:** Oluwagbemisola, Prajwal, Roshan, Jeremy, George
304
384
  **License:** MIT
305
385
 
@@ -316,4 +396,4 @@ When base rates differ across groups, Demographic Parity, Equalized Odds, and Pr
316
396
  - ProPublica (2016). "Machine Bias." COMPAS audit.
317
397
  - Ali et al. (2019). "Discrimination through Optimization." ACM FAccT.
318
398
  - Beunec Technologies Inc Agentic Annotation Protocol - github.com/beunec
319
- - Anthropic Model Context Protocol — modelcontextprotocol.io
399
+ - Model Context Protocol — modelcontextprotocol.io
package/bin/sage.js CHANGED
@@ -40,6 +40,17 @@ if (!pythonExe) {
40
40
  process.exit(1);
41
41
  }
42
42
 
43
+ // Check if running interactively or if help/setup/config argument is passed
44
+ const isTTY = process.stdin.isTTY || process.stdout.isTTY;
45
+ const hasHelpOrSetup = process.argv.some(arg =>
46
+ ['--help', '-h', 'help', 'setup', '--setup', 'config', '--config'].includes(arg.toLowerCase())
47
+ );
48
+
49
+ if (isTTY || hasHelpOrSetup) {
50
+ printSetupGuide();
51
+ process.exit(0);
52
+ }
53
+
43
54
  const child = spawn(pythonExe, [MCP_SERVER_PATH, ...process.argv.slice(2)], {
44
55
  stdio: 'inherit',
45
56
  env: process.env
@@ -53,3 +64,109 @@ child.on('error', (err) => {
53
64
  child.on('exit', (code) => {
54
65
  process.exit(code);
55
66
  });
67
+
68
+ function printSetupGuide() {
69
+ console.log(`
70
+ \x1b[1;36m╔══════════════════════════════════════════════════════════════════════════╗\x1b[0m
71
+ \x1b[1;36m║ SAGE — Supervisory Agentic Governance Engine ║\x1b[0m
72
+ \x1b[1;36m║ Model Context Protocol (MCP) Server Setup & Configuration Guide ║\x1b[0m
73
+ \x1b[1;36m╚══════════════════════════════════════════════════════════════════════════╝\x1b[0m
74
+
75
+ SAGE is designed to run as an MCP server inside your favorite AI coding environment.
76
+ Since you ran SAGE in an interactive terminal, here is how to configure it.
77
+
78
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
79
+ \x1b[1;32m1. CURSOR CONFIGURATION\x1b[0m
80
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
81
+ Go to: \x1b[1mCursor Settings -> Features -> MCP -> Add New MCP Server\x1b[0m
82
+
83
+ • \x1b[1mName:\x1b[0m sage-governance
84
+ • \x1b[1mType:\x1b[0m command
85
+ • \x1b[1mCommand:\x1b[0m sage
86
+ • \x1b[1mArgs:\x1b[0m (leave empty)
87
+
88
+ Alternatively, add the following to \x1b[34m.cursor/mcp.json\x1b[0m in your project:
89
+
90
+ \x1b[32m{
91
+ "mcpServers": {
92
+ "sage-governance": {
93
+ "command": "sage",
94
+ "args": [],
95
+ "type": "stdio",
96
+ "env": {
97
+ "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
98
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
99
+ }
100
+ }
101
+ }
102
+ }\x1b[0m
103
+
104
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
105
+ \x1b[1;32m2. OPENCODE CONFIGURATION\x1b[0m
106
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
107
+ Add the following to \x1b[34mopencode.json\x1b[0m in your project root directory:
108
+
109
+ \x1b[32m{
110
+ "mcp": {
111
+ "sage-governance": {
112
+ "type": "local",
113
+ "command": ["sage"],
114
+ "enabled": true,
115
+ "environment": {
116
+ "OPENAI_API_KEY": "(env:OPENAI_API_KEY)",
117
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
118
+ }
119
+ }
120
+ }
121
+ }\x1b[0m
122
+
123
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
124
+ \x1b[1;32m3. CLAUDE DESKTOP CONFIGURATION\x1b[0m
125
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
126
+ Add the following to your global Claude Desktop configuration:
127
+ Path: \x1b[34m~/Library/Application Support/Claude/claude_desktop_config.json\x1b[0m
128
+
129
+ \x1b[32m{
130
+ "mcpServers": {
131
+ "sage-governance": {
132
+ "command": "sage",
133
+ "args": [],
134
+ "env": {
135
+ "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
136
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
137
+ }
138
+ }
139
+ }
140
+ }\x1b[0m
141
+
142
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
143
+ \x1b[1;32m4. CLAUDE CODE CONFIGURATION\x1b[0m
144
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
145
+ Run the following command in your terminal:
146
+
147
+ \x1b[1;35mclaude mcp add sage-governance sage -- sage\x1b[0m
148
+
149
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
150
+ \x1b[1;32m5. VS CODE (CLINE / CONTINUE) CONFIGURATION\x1b[0m
151
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
152
+ Add the following to your Cline/Continue MCP settings json file:
153
+
154
+ \x1b[32m{
155
+ "mcpServers": {
156
+ "sage-governance": {
157
+ "command": "sage",
158
+ "args": [],
159
+ "env": {
160
+ "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
161
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
162
+ }
163
+ }
164
+ }
165
+ }\x1b[0m
166
+
167
+ \x1b[1;33m────────────────────────────────────────────────────────────────────────────\x1b[0m
168
+ \x1b[1mNOTE:\x1b[0m Make sure you have python dependencies installed:
169
+ \x1b[35mpip install mcp openai pydantic fairlearn diffprivlib pandas scikit-learn\x1b[0m
170
+ `);
171
+ }
172
+
package/kimicode.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "_note": "Kimi Code MCP configuration. Copy this file or add the sage-governance block to your Kimi Code MCP server settings.",
3
+ "_docs": "https://kimi.moonshot.cn",
4
+ "_compatible_with": "Kimi Code",
5
+ "mcpServers": {
6
+ "sage-governance": {
7
+ "command": "sage",
8
+ "args": [],
9
+ "type": "stdio",
10
+ "env": {
11
+ "OPENAI_API_KEY": "${OPENAI_API_KEY}",
12
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
13
+ }
14
+ }
15
+ }
16
+ }
package/opencode.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
- "$schema": "https://opencode.ai/config.schema.json",
3
- "model": "anthropic/claude-sonnet-4-6",
4
- "mcpServers": {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "model": "openai/gpt-4o-mini",
4
+ "mcp": {
5
5
  "sage-governance": {
6
6
  "type": "local",
7
- "command": "sage",
8
- "args": [],
9
- "env": {
10
- "OPENAI_API_KEY": "${OPENAI_API_KEY}",
7
+ "command": ["sage"],
8
+ "enabled": true,
9
+ "environment": {
10
+ "OPENAI_API_KEY": "(env:OPENAI_API_KEY)",
11
11
  "SAGE_LLM_MODEL": "gpt-4o-mini"
12
12
  }
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sage-governance",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Supervisory Agentic Governance Engine — Open-source MCP governance layer for agentic coding systems. Intercepts, evaluates, and audits AI coding prompts for EU AI Act, GDPR, and fairness compliance.",
5
5
  "main": "bin/sage.js",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "start": "node bin/sage.js",
11
- "_prepublishOnly": "find . -path './.git' -prune -o -name '__pycache__' -type d -print -exec rm -rf {} + 2>/dev/null; echo 'pycache cleaned'",
11
+ "prepublishOnly": "find . -path './.git' -prune -o -name '__pycache__' -type d -print -exec rm -rf {} + 2>/dev/null; echo 'pycache cleaned'",
12
12
  "postinstall": "node -e \"console.log('\\n[SAGE] Python deps required — run: pip install -r requirements.txt\\n')\""
13
13
  },
14
14
  "files": [
@@ -23,7 +23,10 @@
23
23
  "opencode.json",
24
24
  "claude.json",
25
25
  "cursor.json",
26
- "codex.json"
26
+ "codex.json",
27
+ "windsurf.json",
28
+ "trae.json",
29
+ "kimicode.json"
27
30
  ],
28
31
  "keywords": [
29
32
  "mcp",
@@ -80,7 +80,7 @@ class SecurityReport:
80
80
  # (regex, description, severity)
81
81
  _SECRET_PATTERNS: list[tuple[str, str, Severity]] = [
82
82
  # AI provider keys
83
- (r"sk-ant-[A-Za-z0-9\-_]{40,}", "Anthropic API key hardcoded", "P0"),
83
+ (r"sk-ant-[A-Za-z0-9\-_]{40,}", "AI Provider API key hardcoded", "P0"),
84
84
  (r"sk-[A-Za-z0-9]{48}", "OpenAI API key hardcoded", "P0"),
85
85
  (r"AIza[0-9A-Za-z\-_]{35}", "Google API key hardcoded", "P0"),
86
86
  # Generic credentials
package/trae.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "_note": "Trae MCP configuration. Copy this file or add the sage-governance block to your Trae MCP server settings.",
3
+ "_docs": "https://trae.sh",
4
+ "_compatible_with": "Trae",
5
+ "mcpServers": {
6
+ "sage-governance": {
7
+ "command": "sage",
8
+ "args": [],
9
+ "type": "stdio",
10
+ "env": {
11
+ "OPENAI_API_KEY": "${OPENAI_API_KEY}",
12
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
13
+ }
14
+ }
15
+ }
16
+ }
package/windsurf.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "_note": "Windsurf MCP configuration. Copy this file or add the sage-governance block to ~/.codeium/windsurf/mcp_config.json",
3
+ "_docs": "https://codeium.com/windsurf",
4
+ "_compatible_with": "Windsurf",
5
+ "mcpServers": {
6
+ "sage-governance": {
7
+ "command": "sage",
8
+ "args": [],
9
+ "env": {
10
+ "OPENAI_API_KEY": "${OPENAI_API_KEY}",
11
+ "SAGE_LLM_MODEL": "gpt-4o-mini"
12
+ }
13
+ }
14
+ }
15
+ }