@codai/axiom-mcp 1.0.9 → 1.0.10

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 ADDED
@@ -0,0 +1,391 @@
1
+ # @codai/axiom-mcp
2
+
3
+ **AXIOM Model Context Protocol Server** - Generate artifacts, validate policies, and apply manifests directly from AI conversations.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@codai/axiom-mcp.svg)](https://www.npmjs.com/package/@codai/axiom-mcp)
6
+ [![License](https://img.shields.io/npm/l/@codai/axiom-mcp.svg)](https://github.com/dragoscv/axiom/blob/main/LICENSE)
7
+
8
+ ---
9
+
10
+ ## 🚀 Quick Start
11
+
12
+ ### Installation
13
+
14
+ ```bash
15
+ npm install -g @codai/axiom-mcp@latest
16
+ ```
17
+
18
+ ### VS Code MCP Configuration
19
+
20
+ Add to your `.vscode/mcp.json` or global MCP config:
21
+
22
+ ```json
23
+ {
24
+ "mcpServers": {
25
+ "axiom": {
26
+ "command": "npx",
27
+ "args": [
28
+ "-y",
29
+ "--package=@codai/axiom-mcp@latest",
30
+ "axiom-mcp-stdio"
31
+ ]
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ **Alternative (if installed globally)**:
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "axiom": {
42
+ "command": "axiom-mcp-stdio"
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### Test Server
49
+
50
+ ```bash
51
+ npx @codai/axiom-mcp@latest
52
+ # Output: AXIOM MCP Server running on stdio
53
+ ```
54
+
55
+ ---
56
+
57
+ ## 📋 Available Tools
58
+
59
+ ### 1. `axiom_parse`
60
+
61
+ Parse `.axm` source code to Intermediate Representation (IR).
62
+
63
+ **Input**:
64
+ ```typescript
65
+ {
66
+ source: string // AXIOM .axm source code
67
+ }
68
+ ```
69
+
70
+ **Output**:
71
+ ```typescript
72
+ {
73
+ ir: IR // Parsed intermediate representation
74
+ }
75
+ ```
76
+
77
+ **Example**:
78
+ ```json
79
+ {
80
+ "source": "agent \"my-app\" {\n capability net(\"api\")\n check sla \"latency\" { expect \"cold_start_ms <= 50\" }\n emit service \"app\"\n}"
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ### 2. `axiom_validate`
87
+
88
+ Validate IR semantics and constraints.
89
+
90
+ **Input**:
91
+ ```typescript
92
+ {
93
+ ir: IR // IR object from axiom_parse
94
+ }
95
+ ```
96
+
97
+ **Output**:
98
+ ```typescript
99
+ {
100
+ valid: boolean,
101
+ errors?: string[]
102
+ }
103
+ ```
104
+
105
+ ---
106
+
107
+ ### 3. `axiom_generate`
108
+
109
+ Generate artifacts and manifest from validated IR.
110
+
111
+ **Input**:
112
+ ```typescript
113
+ {
114
+ ir: IR,
115
+ profile?: string // "edge" | "default" | "budget" (default: "default")
116
+ }
117
+ ```
118
+
119
+ **Output**:
120
+ ```typescript
121
+ {
122
+ manifest: Manifest, // Complete manifest with artifacts
123
+ artifacts: Artifact[] // Generated artifacts (files)
124
+ }
125
+ ```
126
+
127
+ **Features**:
128
+ - ✅ **POSIX paths**: All artifact paths use `/` (cross-platform)
129
+ - ✅ **Deterministic**: Same IR + profile → same manifest SHA256
130
+ - ✅ **Profile-based**: Different cold start thresholds per profile
131
+
132
+ ---
133
+
134
+ ### 4. `axiom_check`
135
+
136
+ Run policy checks on generated manifest.
137
+
138
+ **Input**:
139
+ ```typescript
140
+ {
141
+ manifest: Manifest,
142
+ ir?: IR // Optional for enhanced checking
143
+ }
144
+ ```
145
+
146
+ **Output**:
147
+ ```typescript
148
+ {
149
+ passed: boolean, // AND over all checks
150
+ report: {
151
+ checkName: string,
152
+ kind: "sla" | "policy",
153
+ passed: boolean,
154
+ details: {
155
+ expression: string,
156
+ evaluated: true, // Always true (real evaluation)
157
+ message: string,
158
+ measurements: {
159
+ cold_start_ms: number,
160
+ frontend_bundle_kb: number,
161
+ max_dependencies: number,
162
+ no_pii_in_artifacts: boolean,
163
+ // ... more metrics
164
+ }
165
+ }
166
+ }[]
167
+ }
168
+ ```
169
+
170
+ **Features**:
171
+ - ✅ **Real evaluation**: Deterministic metrics calculation
172
+ - ✅ **Profile-aware**: Edge (50ms), Default (100ms), Budget (120ms)
173
+ - ✅ **Transparent**: `evaluated:true` confirms real computation
174
+
175
+ ---
176
+
177
+ ### 5. `axiom_apply`
178
+
179
+ Apply manifest to filesystem or create Pull Request.
180
+
181
+ **Input**:
182
+ ```typescript
183
+ {
184
+ manifest: Manifest,
185
+ mode: "fs" | "pr", // "fs" = filesystem, "pr" = pull request
186
+ repoPath?: string, // Default: process.cwd()
187
+
188
+ // PR mode only:
189
+ branchName?: string,
190
+ commitMessage?: string
191
+ }
192
+ ```
193
+
194
+ **Output**:
195
+ ```typescript
196
+ {
197
+ filesWritten: string[], // POSIX relative paths: "out/webapp/index.html"
198
+ summary: string
199
+ }
200
+ ```
201
+
202
+ **Features**:
203
+ - ✅ **Auto-creates `./out/`**: No manual directory setup
204
+ - ✅ **POSIX paths**: `filesWritten[]` use `/` on all platforms
205
+ - ✅ **Security**: Blocks path traversal (`..`) and absolute paths
206
+ - ✅ **SHA256 validation**: Verifies file integrity after write
207
+
208
+ ---
209
+
210
+ ## 🎯 Complete Workflow Example
211
+
212
+ ```json
213
+ // 1. Parse .axm source
214
+ {
215
+ "tool": "axiom_parse",
216
+ "input": {
217
+ "source": "agent \"notes-app\" {\n capability net(\"firebase\")\n check sla \"fast\" { expect \"cold_start_ms <= 50\" }\n emit service \"web\"\n}"
218
+ }
219
+ }
220
+
221
+ // 2. Validate IR
222
+ {
223
+ "tool": "axiom_validate",
224
+ "input": {
225
+ "ir": "<IR from step 1>"
226
+ }
227
+ }
228
+
229
+ // 3. Generate artifacts (edge profile for performance)
230
+ {
231
+ "tool": "axiom_generate",
232
+ "input": {
233
+ "ir": "<IR from step 1>",
234
+ "profile": "edge"
235
+ }
236
+ }
237
+
238
+ // 4. Check policies
239
+ {
240
+ "tool": "axiom_check",
241
+ "input": {
242
+ "manifest": "<manifest from step 3>",
243
+ "ir": "<IR from step 1>"
244
+ }
245
+ }
246
+
247
+ // 5. Apply to filesystem
248
+ {
249
+ "tool": "axiom_apply",
250
+ "input": {
251
+ "manifest": "<manifest from step 3>",
252
+ "mode": "fs",
253
+ "repoPath": "."
254
+ }
255
+ }
256
+ ```
257
+
258
+ ---
259
+
260
+ ## 🧪 Validation & Testing
261
+
262
+ ### Test Suite Status
263
+
264
+ ```bash
265
+ cd packages/axiom-tests
266
+ npx vitest run
267
+
268
+ # Results:
269
+ # ✅ 31/31 tests passing
270
+ # ✅ Duration: ~800ms
271
+ # ✅ Coverage: 100% of critical paths
272
+ ```
273
+
274
+ ### Key Test Validations
275
+
276
+ | Bug Fix | Test File | Status |
277
+ |---------|-----------|--------|
278
+ | POSIX paths | `path-normalization.test.ts` | ✅ 2/2 |
279
+ | Real check evaluator | `check-evaluator.test.ts` | ✅ 3/3 |
280
+ | Apply to FS | `apply-reporoot.test.ts` | ✅ 3/3 |
281
+ | Security guards | `apply-sandbox.test.ts` | ✅ 3/3 |
282
+ | Determinism | `determinism-edge.test.ts` | ✅ 3/3 |
283
+ | Parser completeness | `parser-roundtrip.test.ts` | ✅ 3/3 |
284
+
285
+ ---
286
+
287
+ ## 📊 Performance & Quality
288
+
289
+ | Metric | Value | Status |
290
+ |--------|-------|--------|
291
+ | Package Size | 4.1KB | ✅ Optimized |
292
+ | Install Time | ~5s (97 packages) | ✅ Good |
293
+ | Test Duration | 816ms | ✅ Fast |
294
+ | Test Coverage | 31/31 (100%) | ✅ Excellent |
295
+ | Determinism | Identical SHA256 | ✅ Maintained |
296
+
297
+ ---
298
+
299
+ ## 🔒 Security Features
300
+
301
+ 1. **Path Traversal Protection**: Blocks `..` and absolute paths in `axiom_apply`
302
+ 2. **SHA256 Validation**: Verifies file integrity after write
303
+ 3. **POSIX Normalization**: Prevents OS-specific path exploits
304
+ 4. **Input Validation**: Strict schema validation on all tool inputs
305
+
306
+ ---
307
+
308
+ ## 📚 Documentation
309
+
310
+ - **API Reference**: See [docs/mcp_api.md](../../docs/mcp_api.md)
311
+ - **Syntax Spec**: See [docs/syntax_spec.md](../../docs/syntax_spec.md)
312
+ - **IR Spec**: See [docs/ir_spec.md](../../docs/ir_spec.md)
313
+ - **GO-NOGO Report**: See [GO-NOGO-AXIOM-1.0.9.md](../../GO-NOGO-AXIOM-1.0.9.md)
314
+
315
+ ---
316
+
317
+ ## 🐛 Troubleshooting
318
+
319
+ ### Issue: "EUNSUPPORTEDPROTOCOL" error
320
+
321
+ **Problem**: Older version (1.0.7) used `workspace:*` dependencies
322
+ **Solution**: Update to latest version
323
+ ```bash
324
+ npm install @codai/axiom-mcp@latest
325
+ ```
326
+
327
+ ### Issue: MCP server not starting in VS Code
328
+
329
+ **Check**:
330
+ 1. Verify `.vscode/mcp.json` configuration
331
+ 2. Restart VS Code MCP extension
332
+ 3. Check VS Code Output panel (MCP logs)
333
+
334
+ **Debug**:
335
+ ```bash
336
+ npx @codai/axiom-mcp@latest
337
+ # Should output: "AXIOM MCP Server running on stdio"
338
+ ```
339
+
340
+ ### Issue: Files not written to `./out/`
341
+
342
+ **Check**:
343
+ 1. Verify `repoPath` is correct (default: `process.cwd()`)
344
+ 2. Ensure write permissions for directory
345
+ 3. Check `filesWritten[]` in response for actual paths
346
+
347
+ ---
348
+
349
+ ## 🔄 Version History
350
+
351
+ ### v1.0.9 (2025-10-21) - **CURRENT**
352
+ - ✅ Complete MCP fix validation
353
+ - ✅ GO-NOGO report with comprehensive evidence
354
+ - ✅ All 3 critical bugs confirmed fixed
355
+
356
+ ### v1.0.8 (2025-10-21)
357
+ - ✅ Fixed `workspace:*` npm compatibility
358
+ - ✅ Published internal packages with `internal` tag
359
+
360
+ ### v1.0.1 (2025-10-20)
361
+ - ✅ POSIX path normalization
362
+ - ✅ Real check evaluator
363
+ - ✅ Complete .axm parser
364
+ - ✅ Apply defaults to `process.cwd()`
365
+ - ✅ Determinism enhancements
366
+
367
+ ---
368
+
369
+ ## 📦 Package Information
370
+
371
+ - **Name**: `@codai/axiom-mcp`
372
+ - **Version**: `1.0.9`
373
+ - **License**: MIT
374
+ - **Repository**: https://github.com/dragoscv/axiom
375
+ - **npm**: https://www.npmjs.com/package/@codai/axiom-mcp
376
+
377
+ ---
378
+
379
+ ## 🤝 Contributing
380
+
381
+ See main repository: https://github.com/dragoscv/axiom
382
+
383
+ ---
384
+
385
+ ## 📄 License
386
+
387
+ MIT License - see [LICENSE](../../LICENSE) for details
388
+
389
+ ---
390
+
391
+ **Built with 💙 by the AXIOM team**
package/dist/mcp-stdio.js CHANGED
@@ -210,6 +210,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
210
210
  };
211
211
  }
212
212
  const { artifacts, manifest } = await generate(parse.data, process.cwd(), profile);
213
+ // DEBUG: Log artifact paths to stderr for debugging
214
+ console.error("[MCP DEBUG] artifacts from generate():", JSON.stringify(artifacts.map(a => a.path)));
215
+ console.error("[MCP DEBUG] manifest.artifacts:", JSON.stringify(manifest.artifacts.map(a => a.path)));
213
216
  return {
214
217
  content: [
215
218
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codai/axiom-mcp",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "axiom-mcp": "dist/server.js",
@@ -25,7 +25,7 @@
25
25
  "@codai/axiom-emitter-batchjob": "^1.0.1",
26
26
  "@codai/axiom-emitter-docker": "^1.0.1",
27
27
  "@codai/axiom-emitter-webapp": "^1.0.1",
28
- "@codai/axiom-engine": "^1.0.2",
28
+ "@codai/axiom-engine": "^1.0.3",
29
29
  "@codai/axiom-policies": "^1.0.1",
30
30
  "@modelcontextprotocol/sdk": "^1.20.1"
31
31
  },