🛡️ OWASP legacy2mcp opens existing apps to AI agents over MCP, but only the flows you approve

In brief
- 🔍 legacy2mcp scans Python and JavaScript/TypeScript code and rates every business flow by risk.
- ✅ From the flows you approve, it generates an MCP server that AI agents can call.
- 🔒 Read-only by default; every call is schema-validated and audit-logged.
- 📦 Open source (Apache 2.0), an OWASP Incubator Project, installed with pip, no API key needed.
🛡️ Giving an AI agent access to an existing application usually means writing an MCP server by hand, the interface through which agents in Claude or Cursor call tools. [legacy2mcp](https://github.com/OWASP/legacy2mcp), an OWASP Incubator Project according to its repository, takes over that step: it reads the existing code of a Python or JavaScript/TypeScript application, finds its entry points and the flows behind them, and labels each one read-only, low-risk write or high-risk. ✅ In an HTML report you tick which tools an agent should get, and the tool generates the configuration of an MCP server from that. According to the README the server is read-only by default, write tools stay hidden unless explicitly allowed, and every call is checked against a schema and written to an audit log. 📦 The project is licensed under Apache 2.0, runs locally on Python 3.10 or newer and needs no API key. It is meant for development teams that want to open an existing app to agents without rewriting it; anyone without a backend of their own has no use for it.
🧭 **Four steps.** Analysis starts with `legacy2mcp analyze` on a local project folder. The tool looks for everything that can trigger the application from outside: HTTP routes, command-line commands, scheduled jobs and queue consumers. For each entry point it follows what happens behind it and notes side effects such as database writes, outbound HTTP calls, e-mail, payments or changes to permissions. According to the README every label carries the file and line it rests on, so a developer can check why a flow counts as high-risk.
📋 **The report as the decision point.** The result is a `report.html` file opened in the browser. It proposes MCP tools, an agent setup with approval points on every write, and a phased roadmap. Read-only tools are preselected; everything else has to be ticked by hand and exported as `selections.json`. The `legacy2mcp generate` command turns that into a `config.yaml` pointing at the running application, for example a staging environment. Write tools are only added with the `--allow-writes` flag. The configuration can then be added to Claude Desktop, Cursor, VS Code or Claude Code.
🔐 **What does not happen.** The project stresses that the scanned code is parsed, never imported or executed, and that nothing is uploaded. Optional enrichment by a language model is off unless you supply your own key, runs only after confirmation and, according to the README, never changes a risk level or the selection of tools. The project lists Flask, FastAPI, Django, click/typer, Celery and APScheduler for Python, and Express, Next.js API routes, commander, node-cron, BullMQ, amqplib and kafkajs for JavaScript and TypeScript.
🔄 **Where it comes from.** In October the developer, Balaji Venkatasubramaniyar, introduced the tool in a [DZone article](https://dzone.com/articles/legacy2mcp-mcp-legacy-systems) as a generator for old SOAP services: point it at a WSDL description and get the operations as MCP tools. That function remains; according to the README, `legacy2mcp init` connects directly to a SOAP service, database, REST API or website when there is no source code to scan. His argument then: whoever writes ten MCP servers by hand copies the same validation, logging and permission logic ten times, and each copy can drift. A generated server, he wrote, makes safety a property of the toolkit rather than of each developer's diligence.
⚖️ **Who it suits.** It makes most sense for teams with an application that has grown over years and whose logic an agent should use, such as an older Flask app or a Node.js service. Approval stays manual: the tool proposes, a person decides. Teams rebuilding their application anyway, or already running a clean API with its own MCP server, gain less. Installation is `pip install "legacy2mcp[analyze]"`; the project takes bugs and requests through the issues of its GitHub repository and a channel in the OWASP Slack.