anvil
Health Uyari
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Gecti
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
This utility acts as a universal tool compiler for AI agents. It allows developers to define tool schemas in a single YAML file and automatically compile them into various formats, including MCP servers, OpenAPI specs, and TypeScript types.
Security Assessment
Overall risk: Low. The automated code scan checked 12 TypeScript files and found no dangerous patterns, hardcoded secrets, or malicious code. The tool does not request any dangerous system permissions. However, according to the YAML schema definition capabilities, the tool is designed to generate configurations that can declare network requests and write-access side effects. While this is standard behavior for an API schema compiler, developers should still manually review the generated outputs.
Quality Assessment
The project is under active development, with its most recent code push happening today. It uses the standard and permissive Apache-2.0 license, making it safe for most personal and commercial projects. However, it currently suffers from extremely low community visibility. With only 5 GitHub stars, the project has not been widely peer-reviewed or battle-tested by a large audience.
Verdict
Use with caution — the immediate code is safe and well-structured, but the lack of community adoption means you should review the generated outputs and dependencies carefully.
Forge once. Run everywhere - universal tool compiler for AI agents.
The universal tool compiler for AI agents.
One YAML definition. Ten compilation targets. Zero drift.
The Problem
Every agent runtime has its own tool format. You end up maintaining:
- An MCP schema for Claude Desktop
- An OpenAPI spec for your REST API
- TypeScript types for your SDK
- Hand-written docs that drift out of sync
- No eval coverage, no permission model, no agent-specific descriptions
Anvil replaces all of them with a single source of truth.
Quick Start
npm install -g @anvil-tools/cli
anvil init my-tools && cd my-tools
anvil validate
anvil compile
Define Once
anvil: "1.0"
service:
name: github-tools
version: "1.0.0"
tools:
create_issue:
description: Create a new GitHub issue
agent:
description: |
Create a GitHub issue in a repository.
Use when the user wants to file a bug or feature request.
when_to_use:
- User wants to create a bug report
- User wants to file a feature request
when_not_to_use:
- User wants to comment on existing issue (use add_comment)
tips:
- Always include a clear title
- Use markdown in the body
parameters:
owner:
type: string
required: true
description: Repository owner
repo:
type: string
required: true
title:
type: string
required: true
body:
type: string
permissions:
- type: network
target: api.github.com
methods: [POST]
side_effects: write
cost: free
examples:
- name: bug_report
input:
owner: anthropics
repo: claude-code
title: "Bug: timeout on large files"
body: "Completions time out after 30s on files >10MB."
prompt: "Create a bug report for timeout issues"
Compile Everywhere
anvil compile # → MCP server, OpenAPI spec, TypeScript SDK, docs, eval tests, agent schema, CLI...
| Target | Package | What it generates |
|---|---|---|
| MCP Server | @anvil-tools/target-mcp |
Production TypeScript MCP server with typed handlers |
| OpenAPI 3.1 | @anvil-tools/target-openapi |
Complete spec with schemas, auth, error responses |
| Documentation | @anvil-tools/target-docs |
Markdown with parameter tables, agent guidance, examples |
| Agent Schema | @anvil-tools/target-agent-schema |
LLM-optimized JSON — descriptions, tips, few-shot examples |
| Eval Harness | @anvil-tools/target-eval |
Vitest test suite — schema validation + agent tool selection |
| TypeScript SDK | @anvil-tools/target-sdk-ts |
Typed client with Zod runtime validation |
| CLI | @anvil-tools/target-cli-gen |
Commander CLI with subcommands from tool definitions |
| Anthropic | @anvil-tools/target-anthropic |
Claude Messages API tool format |
| OpenAI | @anvil-tools/target-openai |
GPT function calling format |
| Vercel AI | @anvil-tools/target-vercel-ai |
Vercel AI SDK tool() with Zod schemas |
What Makes Anvil Different
Agent-first semantics. Tools declare when_to_use, when_not_to_use, tips, cost, side_effects, and agent_description — information agents need to make good tool selection decisions.
Permissions as first-class. Every tool declares what it needs. The runtime enforces it.
Built-in eval. Examples in your definition become test cases automatically. Schema validation, contract testing, and agent tool selection eval from one source.
Compiler architecture. Parse → IR → Target plugins. Like protobuf for tools. Adding a new target is implementing one interface.
Schema Semantics
| Field | Purpose |
|---|---|
description |
Human-facing description |
agent.description |
LLM-optimized description with richer context |
when_to_use / when_not_to_use |
Guide agent tool selection |
tips |
Usage hints for better results |
permissions |
Declared per-tool, enforced at runtime |
side_effects |
none / read / write / destructive |
cost |
free / low / medium / high / variable |
errors + agent_hint |
Recovery strategies for agents |
examples |
Input/output pairs → eval + docs |
Registry
Anvil includes a self-hosted registry. Start it locally or deploy to any server:
# Start the registry (seeds with example packages)
cd packages/hub && SEED=true npm run dev
Then publish, search, and install:
anvil login --token <token> --registry http://localhost:4400/api/v1
anvil publish tools.anvil.yaml
anvil search "github"
anvil install github-tools
Runtime Middleware
import { compose, validationMiddleware, rateLimitMiddleware } from '@anvil-tools/runtime';
const handler = compose(
validationMiddleware(ir), // validates input/output
rateLimitMiddleware(ir), // enforces rate limits
cachingMiddleware(ir), // caches by tool config
circuitBreakerMiddleware(), // prevents cascading failures
)(myToolHandler);
CLI Commands
| Command | Description |
|---|---|
anvil init |
Scaffold a new project |
anvil validate |
Validate definitions with rich diagnostics |
anvil compile |
Compile to all configured targets |
anvil dev |
Watch mode — recompile on change |
anvil serve |
Start a local MCP server for testing |
anvil publish |
Publish to the registry |
anvil search |
Search for published tools |
anvil install |
Install a tool definition |
anvil login |
Save registry credentials |
anvil doctor |
Check project health |
Examples
See examples/ for complete definitions:
- GitHub — 5 tools: issues, search, PRs, comments, repo files
- PostgreSQL — queries, table schemas, guarded mutations
- Browser — navigate, screenshot, extract links
- Weather — current conditions, forecasts
- Linear — issue tracking
- Filesystem — read, write, list with permissions
Architecture
packages/
schema/ Core types, parser, validation, IR
compiler/ Compilation pipeline + plugin interface
cli/ 10 CLI commands
runtime/ Middleware, validation, telemetry
registry/ Registry client
hub/ Self-hosted registry server (SQLite)
target-mcp/ MCP server generator
target-openapi/ OpenAPI spec generator
target-docs/ Markdown docs generator
target-agent-schema/ LLM-optimized schema generator
target-eval/ Test harness generator
target-sdk-ts/ TypeScript SDK generator
target-cli-gen/ CLI app generator
target-anthropic/ Claude API tool format
target-openai/ OpenAI function calling format
target-vercel-ai/ Vercel AI SDK format
Contributing
See CONTRIBUTING.md. Clone, pnpm install, pnpm run build, pnpm run test.
License
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi