Skip to main content

OWASP legacy2mcp: analyze a codebase, label every business flow by risk, and turn the approved flows into safe MCP tools

OWASP legacy2mcp

Understand any codebase, then turn the flows you approve into a safe MCP server.
Python and JavaScript/TypeScript. Offline, no API key, nothing executed or uploaded.

Level: Incubator Type: Code Slack: #project-legacy2mcp Build status

License Last commit Contributors

Forks Stars Downloads

Issues Pull requests

PyPI version Python versions MCP Registry

Created: Sep 2026

What is legacy2mcp?

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 or JavaScript/TypeScript codebase and it generates an MCP server, with guardrails built in, for just the parts you approve.

How it works

flowchart LR
  A["Your codebase<br/>Python · JS/TS"] --> 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.

Why teams use it

  • 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.

Quick start

You need Python 3.10+ and a local Python or JavaScript/TypeScript 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.

What the report shows

legacy2mcp report: executive summary with KPIs, recommended first steps and flow-risk breakdown

  • 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.

Proposed agent topology: a coordinator, specialist agents per domain, and approval gates in front of write tools

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

Supported frameworks

  • Python: Flask, FastAPI, Django, click/typer, Celery, APScheduler
  • JavaScript / TypeScript: Express, Next.js API routes, commander, node-cron, BullMQ, amqplib, kafkajs

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

Safe by default

  • 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.

Documentation

Community and contributing

Authors & maintainers

See AUTHORS and MAINTAINERS.md.

How to cite

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}
}

License

Apache 2.0. See LICENSE.

OWASP legacy2mcp · an OWASP Foundation project

Metadata

Release files for legacy2mcp 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for legacy2mcp 0.6.1
File Size Uploaded Provenance Actions
legacy2mcp-0.6.1.tar.gz 358.7 kB With provenance Details for legacy2mcp-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for legacy2mcp 0.6.1
File Interpreter ABI Platform Actions
legacy2mcp-0.6.1-py3-none-any.whl Python 3 none any Details for legacy2mcp-0.6.1-py3-none-any.whl

Total release size: 684.4 kB

Release files / legacy2mcp-0.6.1.tar.gz

Download URL legacy2mcp-0.6.1.tar.gz
Size 358.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28346865996fe2f01f75b64b9c993aad68e6530f643b1792d8dc92756982be97
BLAKE2b-256 checksum
How to use checksums
ea55fd964fb57e942a13905cb0f7b03932221f8f3e1c1bb8d575cbf1d04e9ea8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / legacy2mcp-0.6.1-py3-none-any.whl

Download URL legacy2mcp-0.6.1-py3-none-any.whl
Size 325.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0548e525fd1f28b2a69f7557fdccdc32f58d92c8b16cb69d77c5950188c92b9d
BLAKE2b-256 checksum
How to use checksums
db8bdfe1d9ca11e3c25ee5965da0ecfd117d8660af2b3575b7e2f1a4cc5f73c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for legacy2mcp 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for legacy2mcp-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page