cd /news/ai-agents/legacy-app-can-t-just-add-ai · home › topics › ai-agents › article
[ARTICLE · art-180610] src=github.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Legacy app can't "just add AI."

The OWASP Incubator Project legacy2mcp released a tool that analyzes Python, JavaScript/TypeScript or Java codebases and generates a guardrailed MCP server exposing only the business flows a user approves, running entirely offline with no API key. The tool labels each flow read-only, low-risk write or high-risk, links every label to a file and line in an HTML report, and generates a schema-validated, audit-logged server that is read-only by default unless --allow-writes is passed. It requires Python 3.10+ and installs via pip install "legacy2mcp[analyze]", parsing code without importing or executing it or uploading anything.

key takeaway

legacy2mcp analyze ./my-app --no-ai produces a report.html labeling each business flow read-only, low-risk write or high-risk with file and line, and legacy2mcp generate builds an MCP server from the exported selections.json that stays read-only unless --allow-writes is added.

read4 min views25 publishedDec 2, 2026
Legacy app can't "just add AI."
Image: Michielbdejong (auto-discovered)

Understand any codebase, then turn the flows you approve into a safe MCP server.

Python, JavaScript/TypeScript and Java. Offline, no API key, nothing executed or uploaded.

Make your existing app AI-ready in seconds. No rewrite, no risk.

legacy2mcp is an OWASP Incubator Project that gives AI agents safe access to the applications you already have. Point it at a Python, JavaScript/TypeScript or Java codebase and it generates an MCP server, with guardrails built in, for just the parts you approve.

flowchart LR
  A["Your codebase<br/>Python · JS/TS · Java"] --> B["analyze<br/>entry points, flows,<br/>side effects"]
  B --> C{"Risk per flow"}
  C -->|read-only| D["report.html<br/>you tick the tools"]
  C -->|low-risk write| D
  C -->|high-risk| D
  D -->|selections.json| E["generate<br/>config.yaml"]
  E --> F["MCP server<br/>schema-validated,<br/>audit-logged"]
  F --> G["AI agent /<br/>MCP client"]
  1. Map : finds every entry point (HTTP routes, CLI commands, scheduled jobs, queue consumers) and the business flow behind it.
  2. Rate : labels each flow read-only, low-risk write, or high-risk, with the file and line behind every reason.
  3. Report : proposes MCP tools, an agent setup with approval points, and a phased roadmap.
  4. Generate : builds a server for only the flows you approve. Read-only by default, every call schema-validated and audit-logged.
  • No hand-written MCP adapters for every endpoint
  • No dangerous operations slipping through unnoticed
  • Works with the code you already have

Private by design. Everything runs locally. Your code is parsed, never imported or executed, and nothing is uploaded. Optional AI enrichment is off unless you provide a key, and it only runs after you confirm. See Data flow and privacy and the analyze guide.

You need Python 3.10+ and a local Python, JavaScript/TypeScript or Java project. No API key. Nothing in your project is run or uploaded.

1. Install

pip install "legacy2mcp[analyze]"

2. Analyze your project

legacy2mcp analyze ./my-app --no-ai

This creates a legacy2mcp-analysis/ folder with report.html in it.

3. Review the report

Open legacy2mcp-analysis/report.html in your browser. Every business flow is labelled read-only, low-risk write or high-risk, with the file and line behind each label. Under Proposed MCP tools, tick the tools you want (read-only tools are ticked for you) and click Export selections.json.

4. Generate the server config

legacy2mcp generate ./legacy2mcp-analysis \
  --selections ~/Downloads/selections.json \
  --base-url https://staging.my-app.example
  • --selections : the file you exported in step 3. Leave it out to use the read-only tools only.
  • --base-url : where your app is running, so the tools can call it.

This writes config.yaml. Write tools stay hidden unless you add --allow-writes.

5. Connect it to your AI client

Check the tools, then add this to your MCP client's config (Claude Desktop, Cursor, VS Code, Claude Code):

legacy2mcp inspect --config config.yaml
{
  "mcpServers": {
    "legacy2mcp": {
      "command": "legacy2mcp",
      "args": ["run", "--config", "/absolute/path/to/config.yaml"]
    }
  }
}

Per-client setup: docs/clients.md.

  • Every entry point (HTTP routes, CLI commands, scheduled jobs, queue consumers), what it calls, and its side effects: database writes, outbound HTTP, email, payments, queues, auth changes.
  • A risk label and reasons for every flow, linked to the source line.
  • The proposed MCP tools, an agent setup with approval points on every write, and a phased roadmap.

See a sample report from a real open-source app.

  • Python: Flask, FastAPI, Django, click/typer, argparse, Celery, APScheduler
  • JavaScript / TypeScript: Express, Next.js API routes, commander, node-cron, BullMQ, amqplib, kafkajs
  • Java: Spring Boot (@RestController ,@Controller ,@RequestMapping ), Java Servlets (@WebServlet ,WEB-INF/web.xml ), JAX-RS (@Path )

Full list, AI enrichment (optional, bring your own key) and every flag: analyze guide.

  • Nothing in the scanned repo is imported, executed or sent anywhere.
  • Generated servers are read-only unless you opt in to writes.
  • Every tool call is schema-validated before it reaches your backend and written to an audit log.
  • AI enrichment is off unless you provide a key; it never changes a risk level or which tools are selected.

See the security model.

Tip

Already have a SOAP service, database, REST API or website instead of a codebase? legacy2mcp init connects to it directly. A page behind a login works too: save it from the browser and pass it as --html-file. See the CLI guide. RabbitMQ queues can be served too, with read-only peek and opt-in publish tools: see Configuration. A read-only SAP RFC / BAPI adapter exposes explicitly allowlisted functions when you provide the NW RFC SDK and a compatible pyrfc module.

See AUTHORS and MAINTAINERS.md.

Use GitHub's "Cite this repository" button (CITATION.cff), or:

@software{legacy2mcp,
  author  = {Venkatasubramaniyar, Balaji},
  title   = {OWASP legacy2mcp: Safe, Typed, Audit-Logged MCP Servers for Legacy Systems},
  url     = {https://github.com/OWASP/legacy2mcp},
  license = {Apache-2.0}
}

Apache 2.0. See LICENSE.

<sub>OWASP legacy2mcp · an</sub>

── more in #ai-agents 4 stories · sorted by recency
── more on @owasp 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/legacy-app-can-t-jus…] indexed:0 read:4min 2026-12-02 · —