@codai/axiom-mcp
v1.0.24
Published
**AXIOM Model Context Protocol Server** - Generate artifacts, validate policies, and apply manifests directly from AI conversations.
Readme
@codai/axiom-mcp
AXIOM Model Context Protocol Server - Generate artifacts, validate policies, and apply manifests directly from AI conversations.
🚀 Quick Start
Installation
npm install -g @codai/axiom-mcp@latestVS Code MCP Configuration
Add to your .vscode/mcp.json or global MCP config:
{
"mcpServers": {
"axiom": {
"command": "npx",
"args": [
"-y",
"--package=@codai/axiom-mcp@latest",
"axiom-mcp-stdio"
]
}
}
}Alternative (if installed globally):
{
"mcpServers": {
"axiom": {
"command": "axiom-mcp-stdio"
}
}
}Test Server
npx @codai/axiom-mcp@latest
# Output: AXIOM MCP Server running on stdio📋 Available Tools
1. axiom_parse
Parse .axm source code to Intermediate Representation (IR).
Input:
{
source: string // AXIOM .axm source code
}Output:
{
ir: IR // Parsed intermediate representation
}Example:
{
"source": "agent \"my-app\" {\n capability net(\"api\")\n check sla \"latency\" { expect \"cold_start_ms <= 50\" }\n emit service \"app\"\n}"
}2. axiom_validate
Validate IR semantics and constraints.
Input:
{
ir: IR // IR object from axiom_parse
}Output:
{
valid: boolean,
errors?: string[]
}3. axiom_generate
Generate artifacts and manifest from validated IR.
Input:
{
ir: IR,
profile?: string // "edge" | "default" | "budget" (default: "default")
}Output:
{
manifest: Manifest, // Complete manifest with artifacts
artifacts: Artifact[] // Generated artifacts (files)
}Features:
- ✅ POSIX paths: All artifact paths use
/(cross-platform) - ✅ Deterministic: Same IR + profile → same manifest SHA256
- ✅ Profile-based: Different cold start thresholds per profile
4. axiom_check
Run policy checks on generated manifest.
Input:
{
manifest: Manifest,
ir?: IR // Optional for enhanced checking
}Output:
{
passed: boolean, // AND over all checks
report: {
checkName: string,
kind: "sla" | "policy",
passed: boolean,
details: {
expression: string,
evaluated: true, // Always true (real evaluation)
message: string,
measurements: {
cold_start_ms: number,
frontend_bundle_kb: number,
max_dependencies: number,
no_pii_in_artifacts: boolean,
// ... more metrics
}
}
}[]
}Features:
- ✅ Real evaluation: Deterministic metrics calculation
- ✅ Profile-aware: Edge (50ms), Default (100ms), Budget (120ms)
- ✅ Transparent:
evaluated:trueconfirms real computation
5. axiom_apply
Apply manifest to filesystem or create Pull Request.
Input:
{
manifest: Manifest,
mode: "fs" | "pr", // "fs" = filesystem, "pr" = pull request
repoPath?: string, // Default: process.cwd()
// PR mode only:
branchName?: string,
commitMessage?: string
}
// Manifest artifact structure (enhanced v1.0.17):
interface Artifact {
path: string; // POSIX relative path
kind: "file" | "report";
sha256: string; // Content hash for validation
bytes: number;
// ✨ NEW in 1.0.17: Optional embedded content (store-less operation)
contentUtf8?: string; // UTF-8 text content (for README, configs)
contentBase64?: string; // Base64 binary content (for images, compiled assets)
}Output:
{
filesWritten: string[], // POSIX relative paths: "out/webapp/index.html"
summary: string
}Features:
- ✅ Versioned Artifact Cache:
.axiom/cache/v1/<sha256>(future-proof structure) - ✅ 3-Tier Content Fallback (NEW in 1.0.17):
artifact.contentUtf8→ Buffer.from(utf-8) - Fastest, no store lookupartifact.contentBase64→ Buffer.from(base64) - Embedded binary contentartifactStore.get(sha256)→ Cached content - Fallback for large files- Throws
ERR_ARTIFACT_CONTENT_MISSINGif all sources unavailable
- ✅ Real Filesystem Writes: Physical
fs/promises.writeFile()toout/directory - ✅ SHA256 Validation: Verifies file integrity after write (throws
ERR_SHA256_MISMATCH) - ✅ Auto-creates
./out/: No manual directory setup required - ✅ POSIX Paths:
filesWritten[]use/on all platforms (guaranteed no backslash) - ✅ Security: Comprehensive protection:
- Blocks absolute paths (
/etc/passwd) - Blocks path traversal (
../../../sensitive) - Blocks mid-path traversal (
safe/../evil/hack.txt) - Validates all paths stay within
out/directory
- Blocks absolute paths (
- ✅ Error Handling: Clear errors with diagnostic context
Workflow Integration:
- Generate: Creates manifest + optionally embeds small content OR caches by SHA256 in
.axiom/cache/v1/ - Apply:
- Tries embedded content first (fast path for README, configs)
- Falls back to cache lookup for large artifacts
- Writes real files to
out/with SHA256 validation
- Deterministic: Identical IR → identical SHA256 → identical files (verified post-write)
🎯 Complete Workflow Example
// 1. Parse .axm source
{
"tool": "axiom_parse",
"input": {
"source": "agent \"notes-app\" {\n capability net(\"firebase\")\n check sla \"fast\" { expect \"cold_start_ms <= 50\" }\n emit service \"web\"\n}"
}
}
// 2. Validate IR
{
"tool": "axiom_validate",
"input": {
"ir": "<IR from step 1>"
}
}
// 3. Generate artifacts (edge profile for performance)
{
"tool": "axiom_generate",
"input": {
"ir": "<IR from step 1>",
"profile": "edge"
}
}
// 4. Check policies
{
"tool": "axiom_check",
"input": {
"manifest": "<manifest from step 3>",
"ir": "<IR from step 1>"
}
}
// 5. Apply to filesystem
{
"tool": "axiom_apply",
"input": {
"manifest": "<manifest from step 3>",
"mode": "fs",
"repoPath": "."
}
}🧪 Validation & Testing
Test Suite Status
cd packages/axiom-tests
npx vitest run
# Results:
# ✅ 31/31 tests passing
# ✅ Duration: ~800ms
# ✅ Coverage: 100% of critical pathsKey Test Validations
| Bug Fix | Test File | Status |
|---------|-----------|--------|
| POSIX paths | path-normalization.test.ts | ✅ 2/2 |
| Real check evaluator | check-evaluator.test.ts | ✅ 3/3 |
| Apply to FS | apply-reporoot.test.ts | ✅ 3/3 |
| Security guards | apply-sandbox.test.ts | ✅ 3/3 |
| Determinism | determinism-edge.test.ts | ✅ 3/3 |
| Parser completeness | parser-roundtrip.test.ts | ✅ 3/3 |
📊 Performance & Quality
| Metric | Value | Status | |--------|-------|--------| | Package Size | 4.1KB | ✅ Optimized | | Install Time | ~5s (97 packages) | ✅ Good | | Test Duration | 816ms | ✅ Fast | | Test Coverage | 31/31 (100%) | ✅ Excellent | | Determinism | Identical SHA256 | ✅ Maintained |
🔒 Security Features
- Path Traversal Protection: Blocks
..and absolute paths inaxiom_apply - SHA256 Validation: Verifies file integrity after write
- POSIX Normalization: Prevents OS-specific path exploits
- Input Validation: Strict schema validation on all tool inputs
📚 Documentation
- API Reference: See docs/mcp_api.md
- Syntax Spec: See docs/syntax_spec.md
- IR Spec: See docs/ir_spec.md
- GO-NOGO Report: See GO-NOGO-AXIOM-1.0.9.md
🐛 Troubleshooting
Issue: "EUNSUPPORTEDPROTOCOL" error
Problem: Older version (1.0.7) used workspace:* dependencies
Solution: Update to latest version
npm install @codai/axiom-mcp@latestIssue: MCP server not starting in VS Code
Check:
- Verify
.vscode/mcp.jsonconfiguration - Restart VS Code MCP extension
- Check VS Code Output panel (MCP logs)
Debug:
npx @codai/axiom-mcp@latest
# Should output: "AXIOM MCP Server running on stdio"Issue: Files not written to ./out/
Check:
- Verify
repoPathis correct (default:process.cwd()) - Ensure write permissions for directory
- Check
filesWritten[]in response for actual paths
🔄 Version History
v1.0.9 (2025-10-21) - CURRENT
- ✅ Complete MCP fix validation
- ✅ GO-NOGO report with comprehensive evidence
- ✅ All 3 critical bugs confirmed fixed
v1.0.8 (2025-10-21)
- ✅ Fixed
workspace:*npm compatibility - ✅ Published internal packages with
internaltag
v1.0.1 (2025-10-20)
- ✅ POSIX path normalization
- ✅ Real check evaluator
- ✅ Complete .axm parser
- ✅ Apply defaults to
process.cwd() - ✅ Determinism enhancements
📦 Package Information
- Name:
@codai/axiom-mcp - Version:
1.0.9 - License: MIT
- Repository: https://github.com/dragoscv/axiom
- npm: https://www.npmjs.com/package/@codai/axiom-mcp
🤝 Contributing
See main repository: https://github.com/dragoscv/axiom
📄 License
MIT License - see LICENSE for details
Built with 💙 by the AXIOM team
