Agentify
by piyush0213
README.md
# Agentify: make any legacy app agent-ready, safely
> **Vibe-a-thon track:** Make a Legacy App Agent-Ready
Most Indian businesses still run on old back-office software: CGI URLs, cryptic parameter names, pipe-delimited replies, amounts in paise, `DD/MM/YY` dates, `ERR 42` errors and cookie sessions. AI agents can't use these apps safely. Rewriting them is expensive and risky.
**Agentify adds an agent-ready layer on top of the legacy app without changing a single line of it.** You describe the app in one YAML manifest, and Agentify serves it as an **MCP server** with typed tools that are clean and safe to use. Claude, Cursor or any MCP client can then call them.
```mermaid
flowchart LR
A[LLM agent<br/>Claude / Cursor / any MCP client] -- MCP stdio --> B[Agentify runtime]
B --> V[Schema validation]
B --> P[Preview + pre-checks]
B --> T[HMAC confirm token<br/>bound to exact args]
B --> H[Human approval<br/>for destructive ops]
B --> L[Audit log + rate limit<br/>+ PII redaction]
B -- "CGI / forms / cookies" --> C[(Legacy app<br/>unchanged)]
S[agentify scan] -. drafts .-> M[manifest.yaml]
M --> B
```
## What makes it different
| Problem with legacy apps | What Agentify does |
|---|---|
| Cryptic endpoints (`/cgi/ord.asp?act=NEW&c_id=..`) | Named, documented tools with JSON Schema (`create_order(customer_id, sku, qty)`) |
| `BRK-PAD-01\|Brake Pad Set\|4\|20\|34900\|1` | Typed JSON: `{"qty_on_hand": 4, "price_inr": 349.0, "needs_reorder": true}` |
| Paise, `DD/MM/YY`, status `3` | Rupees, ISO dates, `SHIPPED` (declarative converters) |
| `ERR 51\|CR LIMIT` | `{"code":"ERR 51","message":"Order would exceed the customer's credit limit.","hint":"Check get_customer for credit headroom.","retry":false}` |
| Agents writing blindly | **Two-phase writes:** the first call returns a preview and pre-checks; the second call needs an HMAC `confirm_token` bound to the *exact* arguments, and each token works once |
| An agent could delete or cancel data on its own | **Destructive tools need a human** to run `agentify approve <id>` outside the chat |
| Retries create duplicate orders | Idempotency key is derived from the token and passed to the legacy app's `ref` field |
| Session expiry mid-task | Logs in again and retries once, so the agent never sees a session error |
| Phone numbers leaking into prompts | Redacted at the boundary (`98XXXXXX78`) |
| "What did the AI do?" | Every call goes to `.agentify/audit.jsonl` (`agentify audit`) |
| Onboarding takes weeks | **`agentify scan`** crawls the app's menu and forms, probes only safe GET links, guesses response formats and risk levels, and drafts the manifest for a human to review |
## Quick start
```bash
pip install -r requirements.txt
# 1. run the sample legacy app (ShopKeeper 2009, a 2-wheeler spare-parts distributor)
python legacy_app/app.py # http://127.0.0.1:5009
# 2. let Agentify draft a manifest from it
python -m agentify scan http://127.0.0.1:5009 --user admin --password admin123 -o draft.yaml
# 3. serve the reviewed manifest as an MCP server
python -m agentify serve manifests/shopkeeper.yaml
# 4. full end-to-end demo over real MCP (starts everything itself)
python demo/agent_demo.py
```
### Use with Claude Desktop / Claude Code
```json
{
"mcpServers": {
"shopkeeper": {
"command": "python",
"args": ["-m", "agentify", "serve", "manifests/shopkeeper.yaml"],
"cwd": "/path/to/agentify",
"env": {"SK_URL": "http://127.0.0.1:5009"}
}
}
}
```
Then ask: *"Verma Puncture needs brake pads; restock what's low and cancel Gill's pending order."* The agent reads the stock, gets a pre-check refusal for 10 pads (only 4 left), previews 4 pads and asks you, places the order, and stops at the cancel step until a manager approves it. See [`demo/demo_output.txt`](demo/demo_output.txt) and the 2-minute video [`demo/agentify_demo.mp4`](demo/agentify_demo.mp4).
## The manifest (the only thing you write)
```yaml
- name: create_order
risk: write # read | write | destructive
input:
customer_id: {type: string}
sku: {type: string}
qty: {type: integer, minimum: 1}
preview:
lookups:
item: {tool: get_item, args: {sku: "{sku}"}}
customer: {tool: get_customer, args: {customer_id: "{customer_id}"}}
compute: {amount_inr: "qty * item.price_inr"}
checks:
- {expr: "qty <= item.qty_on_hand", message: "Only {item.qty_on_hand} in stock."}
- {expr: "amount_inr <= customer.credit_headroom_inr", message: "Needs Rs {amount_inr} but headroom is Rs {customer.credit_headroom_inr}."}
summary: "Order {qty} x {item.name} for {customer.name}: Rs {amount_inr}"
request: {method: POST, path: /cgi/ord.asp, form: {act: NEW, c_id: "{customer_id}", sku: "{sku}", q: "{qty}", ref: "{_idempotency_key}"}}
response: {format: pipe_row, fields: [ok, order_id:int, flag]}
```
Expressions run in a tiny sandboxed evaluator (arithmetic, comparisons, dotted names; no calls, no imports, tested).
## Project layout
```
agentify/core.py runtime: transport, parsing, validation, previews, tokens, approvals, audit
agentify/server.py MCP server (stdio) with read-only/destructive tool annotations
agentify/scan.py legacy-app crawler that drafts a manifest
agentify/__main__.py CLI: serve | scan | approve | audit | call
legacy_app/app.py ShopKeeper 2009 sample legacy app (Flask + SQLite)
manifests/ reviewed manifest + scanner draft
demo/agent_demo.py end-to-end MCP demo
tests/ 12 pytest tests
```
## Tests
```bash
python -m pytest -q tests # 12 passed
```
These cover format translation, redaction, error mapping, argument validation, preview, confirm and single-use tokens, tokens bound to the exact arguments, pre-check blocking, human approval, session-expiry recovery, the audit log, the scanner and sandbox escapes.
## Roadmap
- More adapters: SOAP/WSDL, desktop apps via UI automation, Tally / ERP exports, SQL views
- Approval through WhatsApp or Slack instead of the CLI
- Learn manifests from recorded HTTP traffic (HAR files)
MIT licensed.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues