legacy2mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing
141
+ the origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Balaji Venkatasubramaniyar
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,278 @@
1
+ Metadata-Version: 2.4
2
+ Name: legacy2mcp
3
+ Version: 0.1.0
4
+ Summary: Turn legacy SOAP/WSDL systems into safe, typed, audit-logged MCP servers for AI agents.
5
+ Author: Balaji Venkatasubramaniyar
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/bvenkata/legacy2mcp
8
+ Project-URL: Repository, https://github.com/bvenkata/legacy2mcp
9
+ Project-URL: Issues, https://github.com/bvenkata/legacy2mcp/issues
10
+ Project-URL: MCP Registry, https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.bvenkata/legacy2mcp
11
+ Keywords: mcp,model-context-protocol,soap,wsdl,ai-agents,llm,legacy-modernization,enterprise-integration,zeep,claude
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Classifier: Topic :: System :: Systems Administration
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: mcp==1.29.1
25
+ Requires-Dist: zeep<5,>=4.3
26
+ Requires-Dist: jsonschema<5,>=4.21
27
+ Requires-Dist: pydantic<3,>=2.6
28
+ Requires-Dist: PyYAML<7,>=6.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=8.0; extra == "dev"
31
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
32
+ Requires-Dist: flask>=3.0; extra == "dev"
33
+ Requires-Dist: lxml>=5.0; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # legacy2mcp
37
+
38
+ <!-- mcp-name: io.github.bvenkata/legacy2mcp -->
39
+
40
+ **Turn a legacy SOAP/WSDL system into a safe, typed [MCP](https://modelcontextprotocol.io/) server in minutes — so an AI agent can call it without a hand-written adapter.**
41
+
42
+ [![CI](https://github.com/bvenkata/legacy2mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/bvenkata/legacy2mcp/actions/workflows/ci.yml)
43
+ [![PyPI](https://img.shields.io/pypi/v/legacy2mcp.svg)](https://pypi.org/project/legacy2mcp/)
44
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
45
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
46
+ [![MCP Registry](https://img.shields.io/badge/MCP_Registry-legacy2mcp-6f42c1.svg)](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.bvenkata/legacy2mcp)
47
+ [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing)
48
+
49
+ Point `legacy2mcp` at a WSDL URL. It introspects every operation, generates a real
50
+ JSON Schema for each one from the WSDL's own XSD types, and exposes them as MCP
51
+ tools that any MCP client (Claude Desktop, an agent framework, your own code) can
52
+ call — with **every call schema-validated before it reaches your SOAP endpoint**,
53
+ **write-like operations excluded by default**, and **every call audit-logged**.
54
+
55
+ No hand-written adapter code. No hand-maintained tool schemas that drift from the
56
+ WSDL. No arbitrary calls the WSDL itself doesn't define.
57
+
58
+ ![legacy2mcp turning a Calculator WSDL into four typed, schema-validated MCP tools](demo/legacy2mcp.gif)
59
+
60
+ <sub>Regenerate this clip with `vhs demo/demo.tape` — see [`demo/`](demo/).</sub>
61
+
62
+ ---
63
+
64
+ ## Why this exists
65
+
66
+ Organizations run 10–20 year old SOAP services that aren't going away — systems
67
+ of record, middleware, back-office and line-of-business platforms. More and more
68
+ teams now want to point an AI agent at these systems.
69
+
70
+ Today that means, per WSDL:
71
+
72
+ - hand-writing a bespoke adapter,
73
+ - guessing at input validation,
74
+ - hand-copying tool schemas that immediately start drifting from the service,
75
+ - and hoping nobody points an LLM at `DeleteRecord`.
76
+
77
+ `legacy2mcp` generates the adapter **from the WSDL itself**, so the tool schema
78
+ can never drift from what the service actually accepts, and ships a
79
+ **safe-by-default posture** (no writes without an explicit opt-in, no unvalidated
80
+ arguments, every call logged) instead of leaving that to whoever wrote the last
81
+ adapter.
82
+
83
+ ## Features
84
+
85
+ - **Zero adapter code** — one MCP tool per WSDL operation, named `<adapter_id>_<Operation>`.
86
+ - **Real schemas from the WSDL's XSD** — simple types, nested complex types, enums,
87
+ and repeated elements (arrays) are all handled recursively, depth-limited for
88
+ pathological WSDLs.
89
+ - **Safety net #1: validation** — every call runs through `jsonschema.validate`
90
+ (with `additionalProperties: false`) before any network call.
91
+ - **Safety net #2: read-only by default** — operations whose names look like
92
+ writes (`Create*`, `Update*`, `Delete*`, `Cancel*`, `Submit*`, `Pay*`, …) are
93
+ not exposed unless you set `allow_write_operations: true`.
94
+ - **Explicit allow/deny lists** — `include_operations` / `exclude_operations` on
95
+ top of the heuristic.
96
+ - **Audit log** — one JSON line per call: tool, arguments, timestamp, outcome.
97
+ - **Secrets stay out of config** — passwords are read from named environment
98
+ variables, never written into the YAML.
99
+ - **CI-friendly dry run** — `legacy2mcp inspect` lists the generated tools and
100
+ exits, so a broken WSDL fails your pipeline instead of your production agent.
101
+
102
+ See [docs/security.md](docs/security.md) for the full, honest security model —
103
+ what's covered today and what isn't yet.
104
+
105
+ ## Install
106
+
107
+ ```bash
108
+ pip install legacy2mcp # or: uv tool install legacy2mcp / pipx install legacy2mcp
109
+ ```
110
+
111
+ Also on the [MCP Registry](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.bvenkata/legacy2mcp)
112
+ as `io.github.bvenkata/legacy2mcp`, so MCP-aware clients that read the registry
113
+ can discover it directly.
114
+
115
+ ## Quick start
116
+
117
+ ```bash
118
+ git clone https://github.com/bvenkata/legacy2mcp.git
119
+ cd legacy2mcp
120
+ pip install -e ".[dev]"
121
+
122
+ # 1. Start the bundled demo SOAP service (no external network needed)
123
+ python examples/soap/run_mock_calculator.py &
124
+
125
+ # 2. See the MCP tools generated from its WSDL
126
+ legacy2mcp inspect --config examples/soap/config.calculator.yaml
127
+ ```
128
+
129
+ Or with Docker:
130
+
131
+ ```bash
132
+ docker compose up demo-soap-service -d
133
+ docker compose run --rm legacy2mcp legacy2mcp inspect \
134
+ --config examples/soap/config.calculator.docker.yaml
135
+ ```
136
+
137
+ ### Point it at your own WSDL
138
+
139
+ ```yaml
140
+ # config.yaml
141
+ server:
142
+ name: my-legacy-mcp
143
+
144
+ adapters:
145
+ - id: legacy
146
+ type: soap
147
+ config:
148
+ wsdl_url: "https://service.example.com/LegacyService?wsdl"
149
+ auth:
150
+ type: basic
151
+ username: "svc-account"
152
+ password_env: "SERVICE_PASSWORD"
153
+ # Safe by default: Create*/Update*/Delete*/Cancel*/Submit*/... are
154
+ # excluded unless you opt in explicitly.
155
+ allow_write_operations: false
156
+ # Recommended for production: enumerate exactly what the agent may call.
157
+ include_operations: ["GetRecord", "GetRecordDetails", "SearchRecords"]
158
+
159
+ security:
160
+ audit:
161
+ enabled: true
162
+ path: "./legacy-mcp-audit.log"
163
+ ```
164
+
165
+ ```bash
166
+ export SERVICE_PASSWORD=...
167
+ legacy2mcp inspect --config config.yaml # review the generated tools
168
+ legacy2mcp run --config config.yaml # start the MCP server (stdio)
169
+ ```
170
+
171
+ A full production-shaped template lives at
172
+ [`examples/soap/config.template.yaml`](examples/soap/config.template.yaml).
173
+
174
+ ### Use it from Claude Desktop (or any MCP client)
175
+
176
+ ```json
177
+ {
178
+ "mcpServers": {
179
+ "legacy": {
180
+ "command": "legacy2mcp",
181
+ "args": ["run", "--config", "/absolute/path/to/config.yaml"]
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ ## Use cases
188
+
189
+ - **Systems of record** — let an agent read status and detail records from a
190
+ legacy back-office platform, read-only, with every lookup audit-logged.
191
+ - **Financial services** — expose account and transaction *reads* to an agent
192
+ without exposing transfers or adjustments.
193
+ - **Supply chain / ERP** — surface order status, inventory, and shipment tracking
194
+ from an old SOAP middleware layer.
195
+ - **Internal support tooling** — give a support copilot safe, typed access to the
196
+ system of record instead of a scraped UI.
197
+ - **Migration & modernization** — put an MCP layer in front of a legacy service
198
+ now, and swap the backend later without touching the agent.
199
+
200
+ ## Real-world usage
201
+
202
+ ### In CI/CD — catch WSDL drift before it reaches production
203
+
204
+ `legacy2mcp inspect` loads the config, contacts the WSDL, builds every tool
205
+ schema, and exits non-zero if anything fails. Run it as a pipeline gate:
206
+
207
+ ```yaml
208
+ # .github/workflows/contract-check.yml
209
+ - name: Check the WSDL still generates valid MCP tools
210
+ env:
211
+ SERVICE_PASSWORD: ${{ secrets.SERVICE_PASSWORD }}
212
+ run: |
213
+ pip install legacy2mcp
214
+ legacy2mcp inspect --config config/legacy.yaml > tools.json
215
+ # optionally: diff tools.json against a committed snapshot to catch
216
+ # a backend team changing an operation's contract out from under you
217
+ git diff --exit-code --no-index tools/legacy.snapshot.json tools.json
218
+ ```
219
+
220
+ ### As a sidecar / long-running MCP server
221
+
222
+ `legacy2mcp run` speaks MCP over stdio — the transport Claude Desktop and most
223
+ agent frameworks spawn servers over. Package it with your config in the provided
224
+ `Dockerfile` and let your MCP client launch it.
225
+
226
+ ### In a data pipeline
227
+
228
+ Use the same generated, validated tools from your own Python (via any MCP client
229
+ library) to pull records from the legacy system on a schedule, with the audit log
230
+ giving you a record of exactly what was fetched.
231
+
232
+ ## What it actually does, precisely
233
+
234
+ 1. Loads the WSDL with [`zeep`](https://docs.python-zeep.org/), a mature, widely
235
+ used Python SOAP client.
236
+ 2. For every operation on every port/binding, converts the WSDL's XSD input type
237
+ into a JSON Schema
238
+ ([`src/legacy2mcp/schema/xsd_to_jsonschema.py`](src/legacy2mcp/schema/xsd_to_jsonschema.py)) —
239
+ simple types, nested complex types, enums, and arrays, recursively.
240
+ 3. Registers one MCP tool per operation, named `<adapter_id>_<OperationName>`.
241
+ 4. On a tool call: validates arguments against that operation's JSON Schema,
242
+ calls the SOAP operation via `zeep`, serializes the response back to plain
243
+ JSON, and writes an audit log entry.
244
+ 5. Operations whose names look like writes are excluded unless
245
+ `allow_write_operations: true` — see [docs/security.md](docs/security.md) for
246
+ exactly what this heuristic does and doesn't catch.
247
+
248
+ ## Status
249
+
250
+ **v0.1** — the SOAP/WSDL adapter is implemented and tested (`pytest tests/` runs
251
+ against an in-process mock SOAP service, no network needed). A database adapter
252
+ (safe, parameterized-query-only, table/operation allowlists) and a queue adapter
253
+ (Kafka/RabbitMQ/SQS) are on the [roadmap](docs/roadmap.md) but **not implemented
254
+ yet** — the `BaseAdapter` interface
255
+ ([`src/legacy2mcp/adapters/base.py`](src/legacy2mcp/adapters/base.py)) is the
256
+ extension point if you want to build one.
257
+
258
+ ## Development
259
+
260
+ ```bash
261
+ pip install -e ".[dev]"
262
+ pytest tests/ -v
263
+ ```
264
+
265
+ CI runs the suite on Python 3.10–3.12 ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)).
266
+ Releases to PyPI and the MCP Registry are tag-triggered — see
267
+ [docs/releasing.md](docs/releasing.md).
268
+
269
+ ## Contributing
270
+
271
+ Adapters for new legacy systems are the highest-value contribution — implement
272
+ `BaseAdapter` (`discover_tools()` + `invoke()`) and the MCP server core handles
273
+ validation, dispatch, and audit logging for you automatically. Issues and PRs
274
+ welcome.
275
+
276
+ ## License
277
+
278
+ Apache 2.0 — see [LICENSE](LICENSE).