Open Source Tool Compiler

Forge once.
Run everywhere.

Define your tools once. Compile to MCP servers, TypeScript SDKs, OpenAPI specs, docs, eval harnesses, and agent‑optimized schemas.

tools.anvil.yaml → 10 targets
anvil: "1.0"
service:
  name: weather-tools
  version: "1.0.0"

tools:
  get_current_weather:
    description: Get current weather for a location
    agent:
      when_to_use:
        - User asks about current weather
      tips:
        - Prefer city names over coordinates
    parameters:
      location:
        type: string
        required: true
      units:
        type: enum
        values: [celsius, fahrenheit]
    permissions:
      - type: network
        target: api.weather.com
    side_effects: none
    cost: low

The tool layer is fragmented.

Every agent runtime has its own schema format. Every integration needs its own docs, permissions, and tests. You maintain seven versions of the same definition that drift apart.

MCP schema
OpenAPI spec
TypeScript types
Agent descriptions
Permission declarations
Test suites
Human docs

Anvil replaces all of them with a single source of truth.

One schema. Full semantics.

Anvil captures everything agents need — not just types. Descriptions optimized for LLMs, cost indicators, side effects, permissions, and examples that become test cases.

agent.description

Rich context for LLM tool selection — separate from human docs

when_to_use

Explicit scenarios where this tool is the right choice

when_not_to_use

Anti-patterns — redirect agents to better alternatives

permissions

Declared per-tool, enforced at runtime. Network, filesystem, env, db

side_effects

none / read / write / destructive — agents know the blast radius

cost

free / low / medium / high / variable — agents can budget

examples

Input/output pairs that become eval test cases automatically

errors + agent_hint

Known failure modes with recovery instructions for agents

Ten targets. Zero config.

anvil compile --target mcp — no config file needed. All targets are built into the CLI. Or use --all for everything.

MCP Server

Fully typed Model Context Protocol server with tool handlers and annotations.

@anvil-tools/target-mcp
📐

OpenAPI 3.1

Complete spec with schemas, security, examples, and error responses.

@anvil-tools/target-openapi
📘

Documentation

Markdown docs with parameter tables, examples, and agent guidance.

@anvil-tools/target-docs
🧠

Agent Schema

LLM-optimized tool schema with agent descriptions and few-shot examples.

@anvil-tools/target-agent-schema
🧪

Eval Harness

Test suite with schema validation, contract testing, and agent eval.

@anvil-tools/target-eval
📦

TypeScript SDK

Typed client class with Zod runtime validation.

@anvil-tools/target-sdk-ts
⌨️

CLI Application

Commander-based CLI with subcommands and JSON output.

@anvil-tools/target-cli-gen
🔌

Claude · GPT · Vercel AI

Native tool formats for Anthropic, OpenAI, and Vercel AI SDK.

target-anthropic / target-openai / target-vercel-ai

Try it live.

Edit the YAML on the left. See generated outputs update instantly on the right.

tools.anvil.yaml1 tool detected
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = new Server(
  { name: 'weather-tools', version: '1.0.0' },
  { capabilities: { tools: {} } },
);

server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: 'get_weather',
      description: "Use this tool for real-time weather data.\n        Best for current conditions.",
      inputSchema: {
        type: 'object',
        properties: {
          "location": { "type": "string", "description": "City name" },
          "units": { "type": "enum" }
        },
        required: ["location"],
      },
    }
  ],
}));

const transport = new StdioServerTransport();
await server.connect(transport);

Compiler architecture.

Like protobuf compiles .proto to language-specific code, Anvil compiles .anvil.yaml through an IR. Adding a target is one interface.

Source
.anvil.yaml
or TypeScript
Parse + Validate
IR
Generate
Target Plugins
Output
MCP · API · SDK
Docs · Eval · CLI

Get started in 30 seconds.

1
npm install -g @anvil-tools/cli
2
anvil init my-tools && cd my-tools
3
anvil compile --target mcpZero config — MCP server generated
4
anvil serve --stubLive MCP server for Claude Desktop / Cursor