api-mcp-compiler 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.
Files changed (84) hide show
  1. api_mcp_compiler-0.1.0/LICENSE +202 -0
  2. api_mcp_compiler-0.1.0/NOTICE +22 -0
  3. api_mcp_compiler-0.1.0/PKG-INFO +304 -0
  4. api_mcp_compiler-0.1.0/README.md +260 -0
  5. api_mcp_compiler-0.1.0/pyproject.toml +100 -0
  6. api_mcp_compiler-0.1.0/setup.cfg +4 -0
  7. api_mcp_compiler-0.1.0/src/api_mcp_compiler/__init__.py +1 -0
  8. api_mcp_compiler-0.1.0/src/api_mcp_compiler/benchmarks.py +188 -0
  9. api_mcp_compiler-0.1.0/src/api_mcp_compiler/cli.py +392 -0
  10. api_mcp_compiler-0.1.0/src/api_mcp_compiler/codegen/__init__.py +6 -0
  11. api_mcp_compiler-0.1.0/src/api_mcp_compiler/codegen/composite.py +55 -0
  12. api_mcp_compiler-0.1.0/src/api_mcp_compiler/codegen/mcp_server.py +404 -0
  13. api_mcp_compiler-0.1.0/src/api_mcp_compiler/codegen/schema.py +249 -0
  14. api_mcp_compiler-0.1.0/src/api_mcp_compiler/codegen/soap_server.py +381 -0
  15. api_mcp_compiler-0.1.0/src/api_mcp_compiler/codegen/tools.py +308 -0
  16. api_mcp_compiler-0.1.0/src/api_mcp_compiler/contracts.py +147 -0
  17. api_mcp_compiler-0.1.0/src/api_mcp_compiler/evaluation/__init__.py +9 -0
  18. api_mcp_compiler-0.1.0/src/api_mcp_compiler/evaluation/harness.py +509 -0
  19. api_mcp_compiler-0.1.0/src/api_mcp_compiler/evaluation/model_driver.py +241 -0
  20. api_mcp_compiler-0.1.0/src/api_mcp_compiler/evaluation/oracles.py +226 -0
  21. api_mcp_compiler-0.1.0/src/api_mcp_compiler/evaluation/preregistration.py +103 -0
  22. api_mcp_compiler-0.1.0/src/api_mcp_compiler/evaluation/restbench.py +208 -0
  23. api_mcp_compiler-0.1.0/src/api_mcp_compiler/evaluation/state.py +281 -0
  24. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/__init__.py +0 -0
  25. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/coverage.py +78 -0
  26. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/documents.py +91 -0
  27. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/openapi.py +1424 -0
  28. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/refs.py +299 -0
  29. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/swagger2.py +336 -0
  30. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/wsdl.py +848 -0
  31. api_mcp_compiler-0.1.0/src/api_mcp_compiler/ingest/xsd.py +311 -0
  32. api_mcp_compiler-0.1.0/src/api_mcp_compiler/models.py +1402 -0
  33. api_mcp_compiler-0.1.0/src/api_mcp_compiler/planning/__init__.py +0 -0
  34. api_mcp_compiler-0.1.0/src/api_mcp_compiler/planning/approval.py +135 -0
  35. api_mcp_compiler-0.1.0/src/api_mcp_compiler/planning/baseline.py +121 -0
  36. api_mcp_compiler-0.1.0/src/api_mcp_compiler/planning/overlay.py +40 -0
  37. api_mcp_compiler-0.1.0/src/api_mcp_compiler/planning/report.py +124 -0
  38. api_mcp_compiler-0.1.0/src/api_mcp_compiler/planning/semantic.py +875 -0
  39. api_mcp_compiler-0.1.0/src/api_mcp_compiler/policy/__init__.py +7 -0
  40. api_mcp_compiler-0.1.0/src/api_mcp_compiler/policy/synthesis.py +460 -0
  41. api_mcp_compiler-0.1.0/src/api_mcp_compiler/provenance.py +129 -0
  42. api_mcp_compiler-0.1.0/src/api_mcp_compiler/reporting/__init__.py +0 -0
  43. api_mcp_compiler-0.1.0/src/api_mcp_compiler/reporting/conversion_report.py +262 -0
  44. api_mcp_compiler-0.1.0/src/api_mcp_compiler/routes.py +119 -0
  45. api_mcp_compiler-0.1.0/src/api_mcp_compiler/runtime/__init__.py +6 -0
  46. api_mcp_compiler-0.1.0/src/api_mcp_compiler/runtime/governance.py +181 -0
  47. api_mcp_compiler-0.1.0/src/api_mcp_compiler/runtime/mock.py +290 -0
  48. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/api_semantic_ir.schema.json +918 -0
  49. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/eval_corpus.schema.json +248 -0
  50. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/evaluation_run.schema.json +215 -0
  51. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/mcp_tool_surface.schema.json +263 -0
  52. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/policy_manifest.schema.json +262 -0
  53. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/preregistration.schema.json +103 -0
  54. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/tool_overlay.schema.json +158 -0
  55. api_mcp_compiler-0.1.0/src/api_mcp_compiler/schemas/tool_plan.schema.json +254 -0
  56. api_mcp_compiler-0.1.0/src/api_mcp_compiler.egg-info/PKG-INFO +304 -0
  57. api_mcp_compiler-0.1.0/src/api_mcp_compiler.egg-info/SOURCES.txt +82 -0
  58. api_mcp_compiler-0.1.0/src/api_mcp_compiler.egg-info/dependency_links.txt +1 -0
  59. api_mcp_compiler-0.1.0/src/api_mcp_compiler.egg-info/entry_points.txt +2 -0
  60. api_mcp_compiler-0.1.0/src/api_mcp_compiler.egg-info/requires.txt +23 -0
  61. api_mcp_compiler-0.1.0/src/api_mcp_compiler.egg-info/top_level.txt +1 -0
  62. api_mcp_compiler-0.1.0/tests/test_baseline_planner.py +117 -0
  63. api_mcp_compiler-0.1.0/tests/test_benchmarks.py +108 -0
  64. api_mcp_compiler-0.1.0/tests/test_codegen.py +410 -0
  65. api_mcp_compiler-0.1.0/tests/test_codegen_schema.py +113 -0
  66. api_mcp_compiler-0.1.0/tests/test_contracts.py +381 -0
  67. api_mcp_compiler-0.1.0/tests/test_coverage.py +361 -0
  68. api_mcp_compiler-0.1.0/tests/test_determinism.py +150 -0
  69. api_mcp_compiler-0.1.0/tests/test_evaluation.py +452 -0
  70. api_mcp_compiler-0.1.0/tests/test_generated_confirmation.py +196 -0
  71. api_mcp_compiler-0.1.0/tests/test_mcp_server.py +127 -0
  72. api_mcp_compiler-0.1.0/tests/test_mock_runtime.py +167 -0
  73. api_mcp_compiler-0.1.0/tests/test_openapi.py +552 -0
  74. api_mcp_compiler-0.1.0/tests/test_packaging.py +90 -0
  75. api_mcp_compiler-0.1.0/tests/test_policy.py +400 -0
  76. api_mcp_compiler-0.1.0/tests/test_preregistration.py +127 -0
  77. api_mcp_compiler-0.1.0/tests/test_provenance.py +254 -0
  78. api_mcp_compiler-0.1.0/tests/test_refs.py +309 -0
  79. api_mcp_compiler-0.1.0/tests/test_restbench.py +443 -0
  80. api_mcp_compiler-0.1.0/tests/test_review_flow.py +109 -0
  81. api_mcp_compiler-0.1.0/tests/test_semantic.py +581 -0
  82. api_mcp_compiler-0.1.0/tests/test_soap_server.py +105 -0
  83. api_mcp_compiler-0.1.0/tests/test_swagger2.py +195 -0
  84. api_mcp_compiler-0.1.0/tests/test_wsdl.py +235 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Subhadip Mitra
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,22 @@
1
+ api-mcp-compiler
2
+ Copyright 2026 Subhadip Mitra
3
+
4
+ Licensed under the Apache License, Version 2.0. See LICENSE.
5
+
6
+ This product includes no third-party source code.
7
+
8
+ Benchmark specifications and task sets used to test this compiler are fetched at the point of
9
+ use and are never redistributed here. Their licences are recorded in
10
+ examples/benchmarks/manifest.json, alongside the attribution that would have to travel with
11
+ each file were it ever included:
12
+
13
+ - RestBench specifications and task sets, from the RestGPT repository by Yifan Song and
14
+ colleagues (MIT).
15
+ - TextCasing and NumberConversion sample services, published by Data Access Worldwide as
16
+ free public samples.
17
+ - The SAWSDL test collection, from kmi/sws-test-collections (GPL-3.0), used only to measure
18
+ this compiler's coverage against documents it did not author.
19
+
20
+ Servers generated by this compiler import the MCP Python SDK and an HTTP client. This
21
+ compiler depends on neither, and generated files are the output of the tool rather than a
22
+ derivative of it: they carry whatever licence their author chooses.
@@ -0,0 +1,304 @@
1
+ Metadata-Version: 2.4
2
+ Name: api-mcp-compiler
3
+ Version: 0.1.0
4
+ Summary: Semantic and safe compilation of enterprise APIs into MCP tool surfaces
5
+ Author-email: Subhadip Mitra <contact@subhadipmitra.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/bassrehab/api-mcp-compiler
8
+ Project-URL: Documentation, https://api-mcp.subhadipmitra.com/
9
+ Project-URL: Source, https://github.com/bassrehab/api-mcp-compiler
10
+ Project-URL: Issues, https://github.com/bassrehab/api-mcp-compiler/issues
11
+ Project-URL: Changelog, https://github.com/bassrehab/api-mcp-compiler/blob/main/CHANGELOG.md
12
+ Keywords: mcp,openapi,wsdl,soap,llm,agents,api,governance
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Code Generators
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: NOTICE
23
+ Requires-Dist: pydantic>=2.7
24
+ Requires-Dist: typer>=0.12
25
+ Requires-Dist: PyYAML>=6.0
26
+ Requires-Dist: lxml>=5.2
27
+ Requires-Dist: jsonschema>=4.22
28
+ Provides-Extra: eval
29
+ Requires-Dist: anthropic>=0.40; extra == "eval"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8; extra == "dev"
32
+ Requires-Dist: anthropic>=0.40; extra == "dev"
33
+ Requires-Dist: setuptools>=68; extra == "dev"
34
+ Requires-Dist: wheel>=0.43; extra == "dev"
35
+ Requires-Dist: ruff==0.16.2; extra == "dev"
36
+ Requires-Dist: mypy==2.3.0; extra == "dev"
37
+ Requires-Dist: types-PyYAML>=6.0.12; extra == "dev"
38
+ Requires-Dist: types-jsonschema>=4.22; extra == "dev"
39
+ Requires-Dist: lxml-stubs>=0.5.1; extra == "dev"
40
+ Provides-Extra: docs
41
+ Requires-Dist: mkdocs<2,>=1.6; extra == "docs"
42
+ Requires-Dist: mkdocs-material<10,>=9.5; extra == "docs"
43
+ Dynamic: license-file
44
+
45
+ <div align="center">
46
+
47
+ # api-mcp-compiler
48
+
49
+ **Compile REST/OpenAPI and SOAP/WSDL services into agent-ready MCP tool surfaces**
50
+ **that are semantically designed, policy-governed, and evaluation-backed.**
51
+
52
+ [![CI](https://github.com/bassrehab/api-mcp-compiler/actions/workflows/ci.yml/badge.svg)](https://github.com/bassrehab/api-mcp-compiler/actions/workflows/ci.yml)
53
+ [![Licence](https://img.shields.io/badge/licence-Apache--2.0-blue.svg)](https://github.com/bassrehab/api-mcp-compiler/blob/main/LICENSE)
54
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12-blue.svg)](https://www.python.org/downloads/)
55
+ [![Typed](https://img.shields.io/badge/mypy-strict-blue.svg)](https://mypy.readthedocs.io/en/stable/)
56
+ [![Contracts](https://img.shields.io/badge/contracts-JSON%20Schema%202020--12-blue.svg)](https://github.com/bassrehab/api-mcp-compiler/blob/main/src/api_mcp_compiler/schemas)
57
+ [![Results](https://img.shields.io/badge/results-pre--registered-8A2BE2.svg)](https://github.com/bassrehab/api-mcp-compiler/tree/main/preregistrations)
58
+
59
+ [Documentation](https://api-mcp.subhadipmitra.com/) &middot;
60
+ [Notebook walkthrough](https://github.com/bassrehab/api-mcp-compiler/blob/main/notebooks/from_specification_to_server.ipynb) &middot;
61
+ [Pre-registrations](https://github.com/bassrehab/api-mcp-compiler/tree/main/preregistrations) &middot;
62
+ [Changelog](https://github.com/bassrehab/api-mcp-compiler/blob/main/CHANGELOG.md)
63
+
64
+ </div>
65
+
66
+ ---
67
+
68
+ Turning one API operation into one MCP tool is already commodity. The harder and more useful
69
+ problem is deciding **which** tools should exist, what they should be called, what they should
70
+ accept and return, and what may not be invoked without a human in the loop.
71
+
72
+ This compiler answers that with provenance on every field, a safety gate that refuses to emit
73
+ what it cannot justify, and governance derived separately from code.
74
+
75
+ ```
76
+ specification -> ingestion -> API Semantic IR -> planner -> tool plan
77
+ |
78
+ overlay (human decisions)
79
+ |
80
+ policy manifest
81
+ |
82
+ generated tool surface
83
+ |
84
+ runnable MCP server (HTTP or SOAP)
85
+ ```
86
+
87
+ ## Contents
88
+
89
+ - [Status](#status)
90
+ - [Install and verify](#install-and-verify)
91
+ - [Try it](#try-it)
92
+ - [How it works](#how-it-works)
93
+ - [Design properties](#design-properties)
94
+ - [Reproducibility](#reproducibility)
95
+ - [Documentation](#documentation)
96
+ - [Scope](#scope)
97
+ - [Author](#author)
98
+ - [Licence](#licence)
99
+
100
+ ## Status
101
+
102
+ Working software, and recorded comparisons that did not find a difference.
103
+
104
+ The compiler ingests OpenAPI 3.x, Swagger 2.0 and WSDL 1.1, produces an intermediate
105
+ representation, plans a tool surface, derives a policy manifest, and generates a
106
+ transport-independent surface that runs against a deterministic mock. An evaluation harness
107
+ scores a surface against a task corpus using deterministic oracles over real service state,
108
+ driven either by a replay of a recorded solution or by a model that sees only the goal and the
109
+ tools. It emits a runnable MCP server for the approved part of a surface, over HTTP for
110
+ OpenAPI and over SOAP envelopes for WSDL, while the compiler itself binds to no MCP SDK, never
111
+ calls a model, and never reaches the network.
112
+
113
+ The central question, whether a semantically planned surface beats one-tool-per-operation on
114
+ task success, unsafe-action rate and cost, **has been measured four times and is still
115
+ unanswered**.
116
+
117
+ Every comparison was pre-registered: the hypothesis, corpus, arms, model, success definition
118
+ and significance threshold were fixed in a digested document before the run, and each run
119
+ records that digest. All returned inconclusive, and the nominal direction reversed between
120
+ them. Nothing here should be read as evidence that the semantic surface performs better. It is
121
+ an argued position that has so far survived no test capable of confirming it.
122
+
123
+ What the runs did establish is mostly about the instrument. Several defects were found only by
124
+ pointing the system at a specification and a task set written by other people: a parser that
125
+ marked every optional argument required, generated schemas no client would load, a store in
126
+ which a read mutated state and a bulk delete removed everything, and oracles that scored the
127
+ route an annotator took rather than the outcome a goal asked for. Each is fixed, and the rules
128
+ that would have prevented the last class now fail the build.
129
+
130
+ The most distinctive claim, that operations should be composed into workflow tools, remains
131
+ untested. The rule that proposes composites fires nowhere on the first benchmark API, and
132
+ designing a better one after reading that benchmark's solution paths would fit the treatment
133
+ to the test set. It needs a benchmark whose tasks have not been read here.
134
+
135
+ ## Install and verify
136
+
137
+ ```bash
138
+ python -m venv .venv
139
+ .venv/bin/python -m pip install -e '.[dev]'
140
+ .venv/bin/python scripts/verify_repo.py
141
+ ```
142
+
143
+ The gate runs pytest, ruff, mypy in strict mode, validates every committed example against its
144
+ versioned JSON Schema, builds the wheel and sdist and proves an installed copy can validate its
145
+ own artifacts, and re-executes the notebook to confirm its stored outputs still match. Lint and
146
+ type-checker versions are pinned exactly, so the gate means the same thing on every machine.
147
+
148
+ ## Try it
149
+
150
+ ```bash
151
+ # Normalize a specification into the intermediate representation
152
+ .venv/bin/python -m api_mcp_compiler.cli inspect examples/openapi/order_service.yaml
153
+
154
+ # Plan a tool surface, and read the review report a human would approve from
155
+ .venv/bin/python -m api_mcp_compiler.cli review examples/openapi/order_service.yaml
156
+
157
+ # Derive the governance manifest
158
+ .venv/bin/python -m api_mcp_compiler.cli policy examples/openapi/inventory_service.yaml
159
+
160
+ # Generate the surface, applying decisions a reviewer already recorded
161
+ .venv/bin/python -m api_mcp_compiler.cli generate examples/openapi/order_service.yaml \
162
+ --overlay examples/overlays/order_service.overlay.json
163
+
164
+ # Write the conversion report a reviewer reads. Never overwrites an earlier one.
165
+ .venv/bin/python -m api_mcp_compiler.cli report examples/openapi/order_service.yaml
166
+
167
+ # Approve by class, so nobody hand-edits an overlay
168
+ .venv/bin/python -m api_mcp_compiler.cli approve examples/openapi/order_service.yaml \
169
+ --overlay build/order.overlay.json --risk read
170
+
171
+ # Emit a runnable MCP server for the approved part of the surface
172
+ .venv/bin/python -m api_mcp_compiler.cli serve examples/openapi/order_service.yaml \
173
+ --overlay examples/overlays/order_service.overlay.json --out build/order_server.py
174
+
175
+ # The same for SOAP. A WSDL operation needs its side effect recorded by a reviewer first,
176
+ # because WSDL carries no signal to infer one from.
177
+ .venv/bin/python -m api_mcp_compiler.cli serve examples/wsdl/customer_service.wsdl \
178
+ --overlay examples/overlays/customer_service.overlay.json --out build/customer_server.py
179
+
180
+ # Score a surface against a task corpus, using deterministic oracles over final state
181
+ .venv/bin/python -m api_mcp_compiler.cli evaluate examples/openapi/order_service.yaml \
182
+ examples/evals/order_tasks.json
183
+
184
+ # Check every artifact against its schema and list what is unresolved
185
+ .venv/bin/python -m api_mcp_compiler.cli validate examples/openapi/inventory_service.yaml
186
+ ```
187
+
188
+ To read the same walk with every intermediate value printed, the provenance on a field, the
189
+ rationale behind a rename, the scope chosen over the union of its alternatives, the gate
190
+ holding a destructive tool and the review decision that releases it, open
191
+ [`notebooks/from_specification_to_server.ipynb`](https://github.com/bassrehab/api-mcp-compiler/blob/main/notebooks/from_specification_to_server.ipynb).
192
+ Its stored outputs are re-executed and compared by the verification gate, so they cannot drift
193
+ from the code that produced them.
194
+
195
+ ## How it works
196
+
197
+ Ingestion, planning, policy synthesis and code generation are separate stages with separate
198
+ contracts. Each contract is versioned independently and pinned, so a document written against
199
+ one version fails validation loudly instead of being misread.
200
+
201
+ | Stage | Input | Output | Contract |
202
+ |---|---|---|---|
203
+ | Ingestion | OpenAPI 3.x, Swagger 2.0, WSDL 1.1 | API Semantic IR | `api_semantic_ir.schema.json` |
204
+ | Planning | IR, overlay | Tool plan | `tool_plan.schema.json` |
205
+ | Policy | IR, plan | Policy manifest | `policy_manifest.schema.json` |
206
+ | Generation | IR, plan, manifest | Tool surface | `mcp_tool_surface.schema.json` |
207
+ | Review | Plan | Overlay | `tool_overlay.schema.json` |
208
+ | Evaluation | Surface, corpus | Evaluation run | `evaluation_run.schema.json` |
209
+
210
+ ## Design properties
211
+
212
+ **Every informative field carries provenance.** A record names the field, a pointer into the
213
+ source document, how the value was derived (`source`, `normalized`, `inferred`, `default`) and
214
+ a confidence. An inference cannot claim certainty and a source fact cannot express doubt; the
215
+ contract rejects both.
216
+
217
+ **Nothing is dropped silently.** Constructs that cannot be resolved become `Ambiguity` records,
218
+ and a completeness sweep reports every key an adapter did not consume. Duplicate mapping keys
219
+ are refused outright in YAML and JSON, because a dropped key never reaches the parser to be
220
+ swept.
221
+
222
+ **Ingestion never reaches the network.** `$ref` resolution defaults to deny. External files
223
+ load only from directories you name with `--allow-dir`, checked against real paths so `../`
224
+ cannot escape. Remote references are always refused. A specification is third-party input, and
225
+ following its pointers is an action taken on its author's behalf.
226
+
227
+ **Inference can only make an operation look less safe, never more.** Destructive wording raises
228
+ a write to destructive; it never lowers a class, and a read described destructively is flagged
229
+ for review rather than quietly reclassified. SOAP operations are never classified by inference
230
+ at all, because WSDL carries no signal equivalent to an HTTP method.
231
+
232
+ **Judgement never becomes silent action.** The planner proposes renames, omissions, groupings,
233
+ output projections and composite workflows, each with a rationale and a confidence. Nothing it
234
+ proposes changes the surface until a reviewer records the decision in an overlay, and an
235
+ overlay is bound by digest to the specification revision it was reviewed against.
236
+
237
+ **A tool is executable only if it earned it.** Reads pass automatically once validated. Write,
238
+ destructive and privileged tools stay disabled until approved. A blocking ambiguity, an
239
+ unclassified risk, or policy that could not be derived keeps a tool disabled regardless of
240
+ approval. Refused tools are still emitted carrying the reason, so the surface never shrinks
241
+ quietly.
242
+
243
+ **Governance is derived, not assumed.** Policy is generated separately from code:
244
+ least-privilege scopes chosen from the security alternatives rather than their union, approval
245
+ and confirmation classes, retry rules from inferred idempotency, rate budgets, output ceilings,
246
+ redaction and audit rules. A destructive action needs a confirmation token bound to the exact
247
+ arguments it was issued for, so confirming one action cannot authorise another.
248
+
249
+ **Evaluation is decided by state, never by a model.** A task names source operations rather
250
+ than tool names, so one corpus scores both planners. Success is judged by the state the
251
+ service ends in, together with oracles for absence of mutation, prohibited operations and
252
+ confirmation adherence. No safety or success number depends on a judge, and latency and token
253
+ cost are recorded as null rather than estimated, because a fabricated number sitting beside
254
+ measured ones is indistinguishable from a measured one.
255
+
256
+ **What the compiler cannot enforce, it says so.** Server-side authorization and protection
257
+ against confused-deputy designs are properties of a deployed service, not of a generated
258
+ artifact. The manifest records them as requirements and never reports them as satisfied.
259
+
260
+ ## Reproducibility
261
+
262
+ Every document loaded during a compile is digested, not only the root, so an artifact stays
263
+ tied to the exact bytes it came from. Golden IR, plan, policy, surface and review artifacts are
264
+ committed. Regenerate them deliberately and review the diff:
265
+
266
+ ```bash
267
+ .venv/bin/python scripts/regen_golden.py
268
+ ```
269
+
270
+ ## Documentation
271
+
272
+ The full guide lives at **[api-mcp.subhadipmitra.com](https://api-mcp.subhadipmitra.com/)**:
273
+ concepts, a command reference, the contract schemas, the SOAP path, and how evaluation and
274
+ pre-registration work. Its source is in [`guide/`](https://github.com/bassrehab/api-mcp-compiler/tree/main/guide).
275
+
276
+ ## Scope
277
+
278
+ Uses synthetic and public specifications only. No credentials, customer specifications or
279
+ proprietary schemas belong in this repository.
280
+
281
+ ## Author
282
+
283
+ **Subhadip Mitra**
284
+ [subhadipmitra.com](https://subhadipmitra.com) &middot; contact@subhadipmitra.com
285
+
286
+ If you use this in academic work, please cite it. [`CITATION.cff`](https://github.com/bassrehab/api-mcp-compiler/blob/main/CITATION.cff) has the
287
+ metadata, and GitHub renders it as a citation block on the repository page.
288
+
289
+ ## Licence
290
+
291
+ Apache-2.0. See [`LICENSE`](https://github.com/bassrehab/api-mcp-compiler/blob/main/LICENSE) and [`NOTICE`](https://github.com/bassrehab/api-mcp-compiler/blob/main/NOTICE).
292
+
293
+ Apache rather than a copyleft licence, deliberately. The interesting part of this project is
294
+ what it decides a good tool surface looks like and what it refuses to emit; restricting who
295
+ may build on that would cost adoption without protecting anything worth protecting. The patent
296
+ grant also matters for the enterprises most likely to have a specification estate that needs
297
+ converting.
298
+
299
+ Benchmark specifications and services used to test the compiler are fetched at the point of
300
+ use and never redistributed here, so this repository carries no third-party source. Their
301
+ licences and attributions are recorded in `examples/benchmarks/manifest.json`.
302
+
303
+ Servers this compiler generates are its output, not a derivative of it. They carry whatever
304
+ licence their author chooses.