Skip to content

Repository files navigation

ALP — Adaptive Layer Protocol

Token-efficient, hallucination-free MCP middleware for AI IDEs.

🌐 Website & Documentation: alp.aorigoon.com

npm version License: MIT


The Problem

When AI IDEs (Cursor, Windsurf) connect to MCP servers, they load every tool's full schema into their context window — costing 20,000+ tokens per session. They also hallucinate parameters, sending wrong data types to your live servers and causing data loss.

The Solution

ALP sits between your AI and your MCP servers as a local proxy:

  1. Snapshot — Fetches MCP schemas once and stores a lightweight summary locally.
  2. Guide — Generates IDE-specific rule files (.cursorrules, .windsurfrules) to tell your AI to read the local snapshot instead of the remote server.
  3. Validate — Dry-runs every AI tool call against the local schema before it hits your live server.
Without ALP:  AI ──────────────────────────► MCP Server (20k tokens, hallucinations)

With ALP:     AI ──► .alp/snapshot (50 tokens) ──► alp validate ──► MCP Server (✅ safe)

Installation

npm install -g alp-cli

Or use without installing:

npx alp-cli init

Quick Start

# 1. Initialize ALP in your project
alp init

# 2. Add your MCP server
alp add http://localhost:3000/mcp
# or a local schema file:
alp add ./my-schema.json

# 3. Fetch and cache tool schemas
alp sync

# 4. Check what's cached
alp status

# 5. Validate before calling (AI does this automatically via .cursorrules)
alp validate delete_user '{"user_id":"abc123"}'

Commands

Command Description
alp init Initialize ALP in the current project
alp add <endpoint> Add a new MCP server (URL or local path)
alp sync Fetch & cache schemas from all servers
alp validate <tool> <params> Dry-run validate an AI tool call
alp status Show snapshot summary & all cached tools
alp on Enable the validation layer
alp off Disable the validation layer (bypass mode)
alp toggle Check current on/off status
alp watch Start auto-sync daemon (re-syncs every 24h)

IDE Integration

After running alp init, ALP auto-generates these files in your project root:

File IDE
.cursorrules Cursor
.windsurfrules Windsurf
alp-instructions.md AntiGravity / Any AI

These files instruct your IDE's AI to:

  1. Read .alp/mcp-snapshot.json for tool definitions (saves tokens).
  2. Run alp validate before every MCP call (prevents hallucinations).

How Validation Works

# ✅ Valid call
alp validate delete_user '{"user_id":"abc123"}'
# → Validation PASSED — Safe to call the real MCP server.

# ❌ Missing required param
alp validate delete_user '{"soft_delete":true}'
# → Missing required parameter: "user_id" (expected type: string)

# ❌ Wrong type
alp validate send_message '{"recipient_id":99,"message":"Hello"}'
# → Wrong type for "recipient_id": expected string, got number

.alp/config.json Structure

{
  "version": "1.0.0",
  "validation_enabled": true,
  "last_synced": "2026-05-04T08:03:31.397Z",
  "servers": [
    { "name": "figma",  "url": "http://localhost:3001/mcp" },
    { "name": "github", "url": "http://localhost:3002/mcp" },
    { "name": "local",  "path": "./my-schema.json"         }
  ]
}

Token Savings

Scenario Tokens Used
Direct MCP call (Figma) ~20,000
With ALP snapshot ~500
Savings ~97.5%

License

MIT © ALP Contributors

Releases

Packages

Contributors

Languages