E

Edict

Sowiedu
šŸ‘Øā€šŸ’» Code Execution
0 Views
0 Installs

šŸ“‡ šŸ  – Agent-first programming language: agents produce JSON AST, the compiler validates, type-checks, effect-checks, verifies contracts via Z3/SMT, and compiles to WASM. 19 MCP tools for the full compile-and-execute loop.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "sowiedu-edict": {
      "command": "npx",
      "args": [
        "-y",
        "sowiedu-edict"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

Edict

CI License: MIT Node.js MCP

A programming language designed for AI agents. No parser. No syntax. Agents produce AST directly as JSON.

Edict is a statically-typed, effect-tracked programming language where the canonical program format is a JSON AST. It's purpose-built so AI agents can write, verify, and execute programs through a structured pipeline — no text parsing, no human-readable syntax, no ambiguity.

Agent (LLM)
  │  produces JSON AST via MCP tool call
  ↓
Schema Validator ─── invalid? → StructuredError → Agent retries
  ↓
Name Resolver ────── undefined? → StructuredError + candidates → Agent retries
  ↓
Type Checker ─────── mismatch? → StructuredError + expected type → Agent retries
  ↓
Effect Checker ───── violation? → StructuredError + propagation chain → Agent retries
  ↓
Contract Verifier ── unproven? → StructuredError + counterexample → Agent retries
  (Z3/SMT)            ↓
                  Code Generator (pure-JS WASM encoder) → WASM → Execute

Features

  • JSON AST — Programs are JSON objects, not text files. No lexer, no parser.
  • Structured errors — Every error is a typed JSON object with enough context for an agent to self-repair.
  • Type system — Int, Float, String, Bool, Array<T>, Option<T>, Result<T,E>, records, enums, refinement types.
  • Effect tracking — Functions declare pure, reads, writes, io, fails. The compiler verifies consistency.
  • Contract verification — Pre/post conditions verified at compile time by Z3 (via SMT). Failing contracts return concrete counterexamples.
  • WASM compilation — Verified programs compile to WebAssembly via a pure-JS encoder and run in Node.js.
  • MCP interface — All tools exposed via Model Context Protocol for direct agent integration.
  • Schema migration — ASTs from older schema versions are auto-migrated. No breakage when the language evolves.

Execution Model

Edict compiles to WebAssembly and runs in a sandboxed VM. This is a deliberate security decision — not a limitation:

  • No ambient authority — compiled WASM cannot access the filesystem, network, or OS unless the host explicitly provides those capabilities via the pluggable EdictHostAdapter interface
  • Compile-time capability declaration — the effect system (io, reads, writes, fails) lets the host inspect what a program requires before running it
  • Runtime enforcement — RunLimits controls execution timeout, memory ceiling, and filesystem sandboxing
  • Defense-in-depth — agent-generated code that runs immediately needs stronger isolation than human-reviewed code. The effect system + WASM sandbox + host adapter pattern provides exactly that

Host capabilities available through adapters: filesystem (sandboxed), HTTP, crypto (SHA-256, MD5, HMAC), environment variables, CLI arguments. New capabilities are added by extending EdictHostAdapter.

Quick Start

For AI Agents (MCP)

The fastest way to use Edict is through the MCP server — it exposes the entire compiler pipeline as tool calls:

npx edict-lang          # start MCP server (stdio transport, no install needed)

Or install locally:

npm install edict-lang
npx edict-lang          # start MCP server

Two calls to get started: edict_schema (learn the AST format) → edict_check (submit a program). See MCP Tools for the full tool list.

For Development

npm install
npm test          # 2675 tests across 136 files
npm run mcp       # start MCP server (stdio transport)

Docker

Run the Edict MCP server in a container — no local Node.js required:

# stdio transport (default — for local MCP clients)
docker run -i ghcr.io/sowiedu/edict

# HTTP transport (for remote/networked MCP clients)
docker run -p 3000:3000 -e EDICT_TRANSPORT=http ghcr.io/sowiedu/edict

Supported platforms: linux/amd64, linux/arm64.

Browser

Run the Edict compiler entirely in the browser — no server required:

BundleSizePhasesUse case
edict-lang/browser318 KB1–3 (validate, resolve, typecheck, effects, lint, patch)Lightweight checking
edict-lang/browser-full~14 MB1–5 (+ WASM codegen, Z3 contracts, WASM execution)Full compile & run
import { compileBrowser, runBrowserDirect } from 'edict-lang/browser-full';

const result = compileBrowser(astJson);
if (result.ok) {
    const run = await runBrowserDirect(result.wasm);
    console.log(run.output);  // "Hello, World!"
}

Note: ESM modules require HTTP serving. Use npx serve . or any static server — file:// won't work.

See examples/browser/index.html for a working example.

QuickJS (Sandboxed Environments)

The Edict compiler also runs inside QuickJS WASM — useful for sandboxed runtimes, edge workers, or embedding in other WASM applications:

BundleSizePhasesSlowdown vs Node.js
dist/edict-quickjs-check.js373 KB1–3 (validate, resolve, typecheck, effects)~3.7x
dist/edict-quickjs-full.js932 KB1–5 (check + WASM compile)~3.7x
import { EdictQuickJS } from "edict-lang/quickjs";

const edict = await EdictQuickJS.createFull();  // phases 1-5
const result = edict.compile(ast);
if (result.ok) {
    console.log(result.wasm);  // Uint8Array of valid WASM
}
edict.dispose();

Note: quickjs-emscripten is an optional peer dependency — install it alongside edict-lang to use EdictQuickJS. For fs-free environments, pass bundleSource directly instead of loading from disk.

See docs/quickjs-feasibility-report.md for full benchmarks and recommendations.

MCP Tools

ToolDescription
edict_schemaReturns the full AST JSON Schema — the spec for how to write programs
edict_versionReturns compiler version and capability info
edict_examplesReturns 41 example programs as JSON ASTs (includes schema snippet)
edict_validateValidates AST structure (field names, types, node kinds)
edict_checkFull pipeline: validate → resolve names → type check → effect check → verify contracts
edict_compileCompiles a checked AST to WASM (returns base64-encoded binary)
edict_runExecutes a compiled WASM binary, returns output and exit code
edict_patchApplies targeted AST patches by nodeId and re-checks
edict_errorsReturns machine-readable catalog of all error types
edict_lintRuns non-blocking quality analysis and returns warnings
edict_debugExecution tracing and crash diagnostics
edict_composeCombines composable program fragments into a module
edict_explainExplains AST nodes, errors, or compiler behavior
edict_exportPackages a program as a UASF portable skill
edict_import_skillImports and executes a UASF skill package
edict_generate_testsGenerates tests from Z3-verified contracts
edict_replayRecords and replays deterministic execution traces
edict_deployCompiles and deploys an Edict program to edge runtimes (Cloudflare Workers)
edict_invokeInvokes a deployed Edict WASM service via HTTP
edict_invoke_skillInvokes a UASF skill package directly
edict_packagePackages a compiled program as a deployable skill bundle
edict_supportReturns diagnostics and environment info for troubleshooting

MCP Resources

URIDescription
edict://schemaThe full AST JSON Schema
edict://schema/minimalMinimal schema variant for token-efficient bootstrap
edict://examplesAll example programs
edict://errorsMachine-readable error catalog
edict://schema/patchJSON Schema for the AST patch protocol
edict://guideAgent bootstrap guide for MCP-first onboarding
edict://supportDiagnostics and environment info

Example Program

A "Hello, World!" in Edict's JSON AST:

{
  "kind": "module",
  "id": "mod-hello-001",
  "name": "hello",
  "imports": [],
  "definitions": [
    {
      "kind": "fn",
      "id": "fn-main-001",
      "name": "main",
      "params": [],
      "effects": ["io"],
      "returnType": { "kind": "basic", "name": "Int" },
      "contracts": [],
      "body": [
        {
          "kind": "call",
          "id": "call-print-001",
          "fn": { "kind": "ident", "id": "ident-print-001", "name": "print" },
          "args": [
            { "kind": "literal", "id": "lit-msg-001", "value": "Hello, World!" }
          ]
        },
        { "kind": "literal", "id": "lit-ret-001", "value": 0 }
      ]
    }
  ]
}

The Agent Loop

The core design: an agent submits an AST → the compiler validates it → if wrong, returns a StructuredError with enough context for the agent to self-repair → the agent fixes it → resubmits.

// 1. Agent reads the schema to learn the AST format
const schema = edict_schema();

// 2. Agent writes a program (may contain errors)
const program = agentWritesProgram(schema);

// 3. Compile — returns structured errors or WASM
const result = edict_compile(program);

if (!result.ok) {
  // 4. Agent reads errors and fixes the program
  //    Errors include: nodeId, expected type, candidates, counterexamples
  const fixed = agentFixesProgram(program, result.errors);
  // 5. Resubmit
  return edict_compile(fixed);
}

// 6. Run the WASM
const output = edict_run(result.wasm);

Architecture

src/
ā”œā”€ā”€ ast/           # TypeScript interfaces for every AST node
ā”œā”€ā”€ validator/     # Schema validation (structural correctness)
ā”œā”€ā”€ resolver/      # Name resolution (scope-aware, with Levenshtein suggestions)
ā”œā”€ā”€ checker/       # Type checking (bidirectional, with unit types)
ā”œā”€ā”€ effects/       # Effect checking (call-graph propagation)
ā”œā”€ā”€ contracts/     # Contract verification (Z3/SMT integration)
ā”œā”€ā”€ codegen/       # WASM code generation (pure-JS encoder)
│   ā”œā”€ā”€ codegen.ts       # IR → WASM module orchestration
│   ā”œā”€ā”€ compile-ir-expr.ts  # IR expression compilation
│   ā”œā”€ā”€ compile-ir-*.ts  # Specialized IR compilers (calls, data, match, scalars)
│   ā”œā”€ā”€ runner.ts        # WASM execution (Node.js WebAssembly API)
│   ā”œā”€ā”€ host-adapter.ts  # EdictHostAdapter interface + platform adapters
│   ā”œā”€ā”€ closures.ts      # Closure capture and compilation
│   ā”œā”€ā”€ hof-generators.ts # Higher-order function WASM generators
│   ā”œā”€ā”€ wasm-encoder.ts  # Pure-JS WASM binary encoder (replaced binaryen)
│   ā”œā”€ā”€ wasm-interpreter.ts # Pure-JS WASM interpreter (no WebAssembly API needed)
│   ā”œā”€ā”€ recording-adapter.ts # Execution recording for replay
│   ā”œā”€ā”€ replay-adapter.ts  # Deterministic replay from recorded traces
│   └── string-table.ts  # String interning for WASM memory
ā”œā”€ā”€ ir/            # Mid-level IR (lowering, optimization)
ā”œā”€ā”€ builtins/      # Builtin registry and domain-specific builtins
ā”œā”€ā”€ compact/       # Compact AST format (token-efficient for agents)
ā”œā”€ā”€ compose/       # Composable program fragments
ā”œā”€ā”€ deploy/        # Edge deployment scaffolding (Cloudflare Workers)
ā”œā”€ā”€ incremental/   # Incremental checking (dependency graph + diff)
ā”œā”€ā”€ lint/          # Non-blocking quality warnings
ā”œā”€ā”€ patch/         # Surgical AST patching by nodeId
ā”œā”€ā”€ migration/     # Schema version migration (auto-upgrade older ASTs)
ā”œā”€ā”€ skills/        # Skill packaging and invocation
ā”œā”€ā”€ mcp/           # MCP server (tools + resources + prompts)
└── errors/        # Structured error types

tests/             # 2675 tests across 136 files
examples/          # 41 example programs (⭐→⭐⭐⭐ difficulty in README)
schema/            # Auto-generated JSON Schema

Type System

TypeExample
BasicInt, Int64, Float, String, Bool
ArrayArray<Int>
OptionOption<String>
ResultResult<String, String>
RecordPoint { x: Float, y: Float }
EnumShape = Circle { radius: Float } | Rectangle { w: Float, h: Float }
Refinement{ i: Int | i > 0 } — predicates verified by Z3
Function(Int, Int) -> Int

Effect System

Functions declare their effects. The compiler enforces:

  • A pure function cannot call an io function
  • Effects propagate through the call graph
  • Missing effects are detected and reported

Effects: pure, reads, writes, io, fails

Contract Verification

Pre/post conditions are verified at compile time using Z3:

{
  "kind": "post",
  "id": "post-001",
  "condition": {
    "kind": "binop", "id": "binop-001", "op": ">",
    "left": { "kind": "ident", "id": "ident-result-001", "name": "result" },
    "right": { "kind": "ident", "id": "ident-x-001", "name": "x" }
  }
}

Z3 either proves unsat (contract holds āœ…) or returns sat with a concrete counterexample the agent can reason about.

Contributing

We welcome contributions from agents and humans alike. See CONTRIBUTING.md for setup instructions, coding standards, and the PR workflow.

Looking for a place to start? Check issues labeled good first issue.

Roadmap

See ROADMAP.md for the full development plan, FEATURE_SPEC.md for the language specification, and Crystallized Intelligence for how agents store and reuse verified WASM skills.

Support

Edict is free and open source under the MIT license. If your agents find it valuable, consider sponsoring its development.

License

MIT

Related MCP Servers

N
Node Code Sandbox Mcp

šŸ“‡ šŸ  – A Node.js MCP server that spins up isolated Docker-based sandboxes for executing JavaScript snippets with on-the-fly npm dependency installation and clean teardown

šŸ‘Øā€šŸ’» Code Execution0 views
P
Piston Mcp

šŸ ā˜ļø 🐧 šŸŽ 🪟 - MCP server that lets LLMs execute code through the Piston remote code execution engine, with a zero-config uv setup and a ready-to-use Claude Desktop config example.

šŸ‘Øā€šŸ’» Code Execution0 views
E
E2b Sandbox Mcp

šŸ“‡ ā˜ļø šŸŽ 🪟 🐧 - Connect Claude Code with E2B cloud sandboxes — 29 tools for creating isolated Linux VMs, cloning repos, running commands, managing files, and performing git operations without touching the local machine.

šŸ‘Øā€šŸ’» Code Execution0 views
O
Openapi Mcp

šŸŽļø ā˜ļø - OpenAPI-MCP: Dockerized MCP Server to allow your AI agent to access any API with existing api docs.

šŸ‘Øā€šŸ’» Code Execution0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

No check timestamp yet.

Unclaimed listing (imported or pending owner verification). Claim it →
ā˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.