New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@codai/axiom-mcp

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codai/axiom-mcp

**AXIOM Model Context Protocol Server** - Generate artifacts, validate policies, and apply manifests directly from AI conversations.

Source
npmnpm
Version
1.0.22
Version published
Weekly downloads
669
-18.71%
Maintainers
1
Weekly downloads
 
Created
Source

@codai/axiom-mcp

AXIOM Model Context Protocol Server - Generate artifacts, validate policies, and apply manifests directly from AI conversations.

npm version License

🚀 Quick Start

Installation

npm install -g @codai/axiom-mcp@latest

VS 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:true confirms 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 lookup
    • artifact.contentBase64 → Buffer.from(base64) - Embedded binary content
    • artifactStore.get(sha256) → Cached content - Fallback for large files
    • Throws ERR_ARTIFACT_CONTENT_MISSING if all sources unavailable
  • ✅ Real Filesystem Writes: Physical fs/promises.writeFile() to out/ 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
  • ✅ 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 paths

Key Test Validations

Bug FixTest FileStatus
POSIX pathspath-normalization.test.ts✅ 2/2
Real check evaluatorcheck-evaluator.test.ts✅ 3/3
Apply to FSapply-reporoot.test.ts✅ 3/3
Security guardsapply-sandbox.test.ts✅ 3/3
Determinismdeterminism-edge.test.ts✅ 3/3
Parser completenessparser-roundtrip.test.ts✅ 3/3

📊 Performance & Quality

MetricValueStatus
Package Size4.1KB✅ Optimized
Install Time~5s (97 packages)✅ Good
Test Duration816ms✅ Fast
Test Coverage31/31 (100%)✅ Excellent
DeterminismIdentical SHA256✅ Maintained

🔒 Security Features

  • Path Traversal Protection: Blocks .. and absolute paths in axiom_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

🐛 Troubleshooting

Issue: "EUNSUPPORTEDPROTOCOL" error

Problem: Older version (1.0.7) used workspace:* dependencies
Solution: Update to latest version

npm install @codai/axiom-mcp@latest

Issue: MCP server not starting in VS Code

Check:

  • Verify .vscode/mcp.json configuration
  • 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 repoPath is 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 internal tag

v1.0.1 (2025-10-20)

  • ✅ POSIX path normalization
  • ✅ Real check evaluator
  • ✅ Complete .axm parser
  • ✅ Apply defaults to process.cwd()
  • ✅ Determinism enhancements

📦 Package Information

🤝 Contributing

See main repository: https://github.com/dragoscv/axiom

📄 License

MIT License - see LICENSE for details

Built with 💙 by the AXIOM team

FAQs

Package last updated on 21 Oct 2025

Related posts