You cannot just slap an LLM onto a legacy application and call it AI-ready. The integration layer is where things usually break, leak data, or execute dangerous side effects. Enter legacy2mcp, a new OWASP Incubator Project that bridges the gap between existing codebases and Model Context Protocol (MCP) servers. By analyzing Python, JavaScript/TypeScript, and Java projects locally, it generates safe, typed, and audit-logged MCP servers without requiring a rewrite or an API key.

How It Works

The tool operates in a strictly offline mode by default. When you run legacy2mcp analyze, it parses your code to identify entry points like HTTP routes, CLI commands, and scheduled jobs. It then maps business flows and labels each one with a risk level: read-only, low-risk write, or high-risk. This static analysis ensures that your code is never imported or executed during the scanning phase, keeping proprietary logic private. The output is an interactive HTML report where developers can manually approve which flows become exposed tools.

Safety and Guardrails

Security is baked into the generation process. The resulting MCP server configuration defaults to read-only access. Write operations are hidden unless explicitly enabled with the --allow-writes flag. Every tool call is schema-validated before it hits the backend, and all interactions are written to an audit log. This approach prevents dangerous operations, such as payment processing or database deletes, from slipping through unnoticed. If you opt for AI enrichment to improve analysis, it remains optional and requires you to provide your own key, ensuring no data leaves your machine unless you intend it to.

Key Takeaways

  • Supports Python (Flask, Django, FastAPI), JavaScript/TypeScript (Express, Next.js), and Java (Spring Boot, Servlets).
  • Generates MCP servers via a two-step process: analyze to map flows, then generate to build the config.
  • Defaults to read-only mode; write tools require explicit approval and schema validation.
  • Runs entirely locally with no API key required for the core analysis features.
  • Created by Balaji Venkatasubramaniyar under the OWASP Incubator Project umbrella.

The Bottom Line

Stop trying to duct-tape AI agents to your monolith. Legacy2MCP offers a pragmatic, security-first path to exposing legacy logic to modern agents without rewriting the underlying application.