mcp4api 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.
- mcp4api-0.1.0/.gitignore +221 -0
- mcp4api-0.1.0/CHANGELOG.md +21 -0
- mcp4api-0.1.0/CODE_OF_CONDUCT.md +83 -0
- mcp4api-0.1.0/CONTRIBUTING.md +26 -0
- mcp4api-0.1.0/LICENSE +21 -0
- mcp4api-0.1.0/PKG-INFO +157 -0
- mcp4api-0.1.0/README.md +116 -0
- mcp4api-0.1.0/SECURITY.md +26 -0
- mcp4api-0.1.0/docs/ARCHITECTURE.md +22 -0
- mcp4api-0.1.0/docs/METHODOLOGY.md +62 -0
- mcp4api-0.1.0/docs/USAGE.md +119 -0
- mcp4api-0.1.0/docs/limitations.md +16 -0
- mcp4api-0.1.0/docs/schemas/endpoints.schema.json +802 -0
- mcp4api-0.1.0/docs/schemas/tools.schema.json +510 -0
- mcp4api-0.1.0/docs/schemas/verification.schema.json +335 -0
- mcp4api-0.1.0/examples/sample-api/README.md +78 -0
- mcp4api-0.1.0/examples/sample-api/endpoints.json +3099 -0
- mcp4api-0.1.0/examples/sample-api/generated/.mcp4api-files.json +12 -0
- mcp4api-0.1.0/examples/sample-api/generated/README.md +79 -0
- mcp4api-0.1.0/examples/sample-api/generated/pyproject.toml +24 -0
- mcp4api-0.1.0/examples/sample-api/generated/shelf_mcp/__init__.py +2 -0
- mcp4api-0.1.0/examples/sample-api/generated/shelf_mcp/__main__.py +100 -0
- mcp4api-0.1.0/examples/sample-api/generated/shelf_mcp/client.py +271 -0
- mcp4api-0.1.0/examples/sample-api/generated/shelf_mcp/models.py +166 -0
- mcp4api-0.1.0/examples/sample-api/generated/shelf_mcp/server.py +390 -0
- mcp4api-0.1.0/examples/sample-api/openapi.yaml +1353 -0
- mcp4api-0.1.0/examples/sample-api/report/verification.json +229 -0
- mcp4api-0.1.0/examples/sample-api/report/verification.md +73 -0
- mcp4api-0.1.0/examples/sample-api/server.py +902 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/add_copy.json +36 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/checkout_copy.json +44 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/create_book.json +38 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/delete_book.json +26 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/get_book.json +56 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/get_patron.json +32 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/list_copies.json +62 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/place_hold.json +34 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/register_patron.json +38 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/renew_loan.json +38 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/return_loan.json +38 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/review_book.json +42 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/search_books.json +62 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/update_book.json +36 -0
- mcp4api-0.1.0/examples/sample-api/tests/cassettes/upload_book_file.json +128 -0
- mcp4api-0.1.0/examples/sample-api/tests/conftest.py +20 -0
- mcp4api-0.1.0/examples/sample-api/tests/plan.json +3928 -0
- mcp4api-0.1.0/examples/sample-api/tests/suite.py +1384 -0
- mcp4api-0.1.0/examples/sample-api/tests/test_tools.py +40 -0
- mcp4api-0.1.0/examples/sample-api/tools.yaml +1159 -0
- mcp4api-0.1.0/pyproject.toml +138 -0
- mcp4api-0.1.0/src/mcp4api/__init__.py +1 -0
- mcp4api-0.1.0/src/mcp4api/__main__.py +5 -0
- mcp4api-0.1.0/src/mcp4api/cassettes.py +96 -0
- mcp4api-0.1.0/src/mcp4api/cli.py +665 -0
- mcp4api-0.1.0/src/mcp4api/curate/__init__.py +3 -0
- mcp4api-0.1.0/src/mcp4api/curate/agent.py +850 -0
- mcp4api-0.1.0/src/mcp4api/curate/criteria.md +21 -0
- mcp4api-0.1.0/src/mcp4api/curate/draft.py +606 -0
- mcp4api-0.1.0/src/mcp4api/curate/models.py +614 -0
- mcp4api-0.1.0/src/mcp4api/curate/rules.py +1059 -0
- mcp4api-0.1.0/src/mcp4api/emit/__init__.py +205 -0
- mcp4api-0.1.0/src/mcp4api/emit/catalog.py +717 -0
- mcp4api-0.1.0/src/mcp4api/emit/render.py +917 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/README.md.j2 +58 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/client.py.j2 +305 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/conftest.py.j2 +20 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/file.py.j2 +4 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/header.py.j2 +2 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/main.py.j2 +99 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/pyproject.toml.j2 +24 -0
- mcp4api-0.1.0/src/mcp4api/emit/templates/test_tools.py.j2 +40 -0
- mcp4api-0.1.0/src/mcp4api/errors.py +35 -0
- mcp4api-0.1.0/src/mcp4api/ingest/__init__.py +3 -0
- mcp4api-0.1.0/src/mcp4api/ingest/build.py +1064 -0
- mcp4api-0.1.0/src/mcp4api/ingest/convert.py +569 -0
- mcp4api-0.1.0/src/mcp4api/ingest/load.py +603 -0
- mcp4api-0.1.0/src/mcp4api/model.py +324 -0
- mcp4api-0.1.0/src/mcp4api/py.typed +0 -0
- mcp4api-0.1.0/src/mcp4api/report.py +330 -0
- mcp4api-0.1.0/src/mcp4api/suite.py +1384 -0
- mcp4api-0.1.0/src/mcp4api/verify.py +1114 -0
- mcp4api-0.1.0/tests/conftest.py +117 -0
- mcp4api-0.1.0/tests/corpus/openapi/LICENSES.txt +22 -0
- mcp4api-0.1.0/tests/corpus/openapi/external-root.yaml +19 -0
- mcp4api-0.1.0/tests/corpus/openapi/external-root.yaml.endpoints.json +72 -0
- mcp4api-0.1.0/tests/corpus/openapi/external-schemas.yaml +25 -0
- mcp4api-0.1.0/tests/corpus/openapi/findings.yaml +81 -0
- mcp4api-0.1.0/tests/corpus/openapi/findings.yaml.endpoints.json +266 -0
- mcp4api-0.1.0/tests/corpus/openapi/petstore-2.0.yaml +103 -0
- mcp4api-0.1.0/tests/corpus/openapi/petstore-2.0.yaml.endpoints.json +182 -0
- mcp4api-0.1.0/tests/corpus/openapi/petstore-3.0.yaml +111 -0
- mcp4api-0.1.0/tests/corpus/openapi/petstore-3.0.yaml.endpoints.json +182 -0
- mcp4api-0.1.0/tests/corpus/openapi/petstore-3.1.json +379 -0
- mcp4api-0.1.0/tests/corpus/openapi/petstore-3.1.json.endpoints.json +353 -0
- mcp4api-0.1.0/tests/corpus/openapi/recursive.yaml +28 -0
- mcp4api-0.1.0/tests/corpus/openapi/recursive.yaml.endpoints.json +52 -0
- mcp4api-0.1.0/tests/corpus/openapi/stream.yaml +34 -0
- mcp4api-0.1.0/tests/corpus/openapi/stream.yaml.endpoints.json +61 -0
- mcp4api-0.1.0/tests/test_cli.py +75 -0
- mcp4api-0.1.0/tests/test_curate.py +345 -0
- mcp4api-0.1.0/tests/test_curate_agent.py +608 -0
- mcp4api-0.1.0/tests/test_emit.py +574 -0
- mcp4api-0.1.0/tests/test_ingest.py +782 -0
- mcp4api-0.1.0/tests/test_model.py +77 -0
- mcp4api-0.1.0/tests/test_normalize.py +99 -0
- mcp4api-0.1.0/tests/test_rules.py +260 -0
- mcp4api-0.1.0/tests/test_verify.py +696 -0
mcp4api-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
/lib/
|
|
18
|
+
/lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
/*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
*.lcov
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
/*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
# Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# uv
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
# poetry.lock
|
|
110
|
+
# poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
# pdm.lock
|
|
117
|
+
# pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
# pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi/*
|
|
127
|
+
!.pixi/config.toml
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule*
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
/env/
|
|
157
|
+
.mcp4api/
|
|
158
|
+
venv/
|
|
159
|
+
/ENV/
|
|
160
|
+
env.bak/
|
|
161
|
+
venv.bak/
|
|
162
|
+
|
|
163
|
+
# Spyder project settings
|
|
164
|
+
.spyderproject
|
|
165
|
+
.spyproject
|
|
166
|
+
|
|
167
|
+
# Rope project settings
|
|
168
|
+
.ropeproject
|
|
169
|
+
|
|
170
|
+
# mkdocs/Zensical documentation
|
|
171
|
+
/site
|
|
172
|
+
|
|
173
|
+
# mypy
|
|
174
|
+
.mypy_cache/
|
|
175
|
+
.dmypy.json
|
|
176
|
+
dmypy.json
|
|
177
|
+
|
|
178
|
+
# Pyre type checker
|
|
179
|
+
.pyre/
|
|
180
|
+
|
|
181
|
+
# pytype static type analyzer
|
|
182
|
+
.pytype/
|
|
183
|
+
|
|
184
|
+
# Cython debug symbols
|
|
185
|
+
cython_debug/
|
|
186
|
+
|
|
187
|
+
# PyCharm
|
|
188
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
189
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
190
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
191
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
192
|
+
# .idea/
|
|
193
|
+
|
|
194
|
+
# Abstra
|
|
195
|
+
# Abstra is an AI-powered process automation framework.
|
|
196
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
197
|
+
# Learn more at https://abstra.io/docs
|
|
198
|
+
.abstra/
|
|
199
|
+
|
|
200
|
+
# Visual Studio Code
|
|
201
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
|
|
202
|
+
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
203
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
|
|
204
|
+
# could uncomment the following to ignore the entire vscode folder
|
|
205
|
+
# .vscode/
|
|
206
|
+
# Temporary file for partial code execution
|
|
207
|
+
tempCodeRunnerFile.py
|
|
208
|
+
|
|
209
|
+
# Ruff stuff:
|
|
210
|
+
.ruff_cache/
|
|
211
|
+
|
|
212
|
+
# PyPI configuration file
|
|
213
|
+
.pypirc
|
|
214
|
+
|
|
215
|
+
# Marimo
|
|
216
|
+
marimo/_static/
|
|
217
|
+
marimo/_lsp/
|
|
218
|
+
__marimo__/
|
|
219
|
+
|
|
220
|
+
# Streamlit
|
|
221
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-10-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `mcp4api SPEC` runs ingest, curate, emit, and verify on an OpenAPI 3.0, 3.1, 3.2, or Swagger 2.0 document.
|
|
15
|
+
- `mcp4api ingest` writes a deterministic `endpoints.json` with every schema in JSON Schema 2020-12.
|
|
16
|
+
- `mcp4api curate` writes `tools.yaml` with Claude, a local heuristic, or a hand-edited manifest, within a token and USD budget.
|
|
17
|
+
- `overrides.yaml` renames, describes, excludes, restores, or fixes inputs on curated tools without editing `tools.yaml`.
|
|
18
|
+
- `mcp4api emit` writes a standalone Python MCP server to `generated/` and refuses to overwrite hand edits without `--force`.
|
|
19
|
+
- `mcp4api verify` calls every generated tool behind a host allowlist, writes `report/`, and exits 3 on a known gap.
|
|
20
|
+
- `mcp4api record` writes scrubbed cassettes from a sandbox, so later `--offline` verification needs no network.
|
|
21
|
+
- The Shelf sample under `examples/sample-api` runs the whole pipeline offline.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
* Public or private harassment
|
|
24
|
+
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement through [GitHub security advisories](https://github.com/smusali/mcp4api/security/advisories/new). All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
+
|
|
43
|
+
## Enforcement Guidelines
|
|
44
|
+
|
|
45
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
+
|
|
47
|
+
### 1. Correction
|
|
48
|
+
|
|
49
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
+
|
|
51
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
|
+
|
|
53
|
+
### 2. Warning
|
|
54
|
+
|
|
55
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
56
|
+
|
|
57
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
+
|
|
59
|
+
### 3. Temporary Ban
|
|
60
|
+
|
|
61
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
+
|
|
63
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
64
|
+
|
|
65
|
+
### 4. Permanent Ban
|
|
66
|
+
|
|
67
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
68
|
+
|
|
69
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
70
|
+
|
|
71
|
+
## Attribution
|
|
72
|
+
|
|
73
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
74
|
+
|
|
75
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
76
|
+
|
|
77
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
78
|
+
|
|
79
|
+
[homepage]: https://www.contributor-covenant.org
|
|
80
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
81
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
82
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
83
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Python 3.11 or newer and [uv](https://docs.astral.sh/uv/).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv sync --group dev
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Checks
|
|
12
|
+
|
|
13
|
+
These commands stay offline and do not need an API key:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv run ruff check .
|
|
17
|
+
uv run ruff format --check .
|
|
18
|
+
uv run mypy
|
|
19
|
+
uv run pytest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`pytest` disables network sockets.
|
|
23
|
+
|
|
24
|
+
## Demo recording
|
|
25
|
+
|
|
26
|
+
`tools/record_demo.sh` rewrites `examples/demo.cast` and `examples/demo.gif`. It needs [asciinema](https://docs.asciinema.org/) and [agg](https://github.com/asciinema/agg). Run it when the CLI output changes.
|
mcp4api-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Samir Musali
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
mcp4api-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mcp4api
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turn API docs into a working MCP server, then verify every generated tool against the real API.
|
|
5
|
+
Project-URL: Homepage, https://github.com/smusali/mcp4api
|
|
6
|
+
Project-URL: Repository, https://github.com/smusali/mcp4api
|
|
7
|
+
Project-URL: Issues, https://github.com/smusali/mcp4api/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/smusali/mcp4api/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Documentation, https://github.com/smusali/mcp4api/blob/main/docs/USAGE.md
|
|
10
|
+
Author-email: Samir Musali <samir.musali@gmail.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agentic-ai,ai-agents,ai-infrastructure,cli,code-generation,developer-tools,llm,mcp,model-context-protocol,openapi,python
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
24
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
25
|
+
Classifier: Topic :: Software Development :: Testing
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Requires-Dist: anthropic<3,>=2.2.0
|
|
29
|
+
Requires-Dist: httpx2<3,>=2.16.0
|
|
30
|
+
Requires-Dist: hypothesis-jsonschema<1,>=0.23.1
|
|
31
|
+
Requires-Dist: hypothesis<7,>=6.170.8
|
|
32
|
+
Requires-Dist: jinja2<4,>=3.1.6
|
|
33
|
+
Requires-Dist: jsonschema<5,>=4.26.0
|
|
34
|
+
Requires-Dist: mcp<3,>=2.3
|
|
35
|
+
Requires-Dist: openapi-spec-validator<1,>=0.9.0
|
|
36
|
+
Requires-Dist: pydantic<3,>=2.14.1
|
|
37
|
+
Requires-Dist: pyyaml<7,>=6.0.3
|
|
38
|
+
Requires-Dist: rich<16,>=15.0.0
|
|
39
|
+
Requires-Dist: typer<1,>=0.27.3
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# mcp4api
|
|
43
|
+
|
|
44
|
+
mcp4api turns your API docs into a working MCP server, then calls every generated tool against your API and reports which ones work. Built for platform teams who want their product callable by agents.
|
|
45
|
+
|
|
46
|
+
[](https://github.com/smusali/mcp4api/actions/workflows/ci.yml)
|
|
47
|
+
[](https://pypi.org/project/mcp4api/)
|
|
48
|
+
[](https://github.com/smusali/mcp4api/blob/main/LICENSE)
|
|
49
|
+
[](https://pypi.org/project/mcp4api/)
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
[Recording](https://github.com/smusali/mcp4api/blob/main/examples/demo.cast)
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install mcp4api
|
|
59
|
+
uvx mcp4api
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Quickstart
|
|
63
|
+
|
|
64
|
+
These commands need no API key. They reuse the committed manifest and cassettes, regenerate the other artifacts in place, and exit 3. The sample's one known gap is `get_book`: `page_count` is a string in the API and an integer in the spec.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/smusali/mcp4api && cd mcp4api
|
|
68
|
+
uvx mcp4api examples/sample-api/openapi.yaml --offline --out examples/sample-api
|
|
69
|
+
cat examples/sample-api/report/verification.md
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Generated tool
|
|
73
|
+
|
|
74
|
+
`upload_book_file` from the Shelf sample is four calls composed into one tool.
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
@mcp.tool(
|
|
78
|
+
title="Upload Book File",
|
|
79
|
+
annotations=ToolAnnotations(
|
|
80
|
+
read_only_hint=False,
|
|
81
|
+
destructive_hint=False,
|
|
82
|
+
idempotent_hint=False,
|
|
83
|
+
open_world_hint=True,
|
|
84
|
+
),
|
|
85
|
+
)
|
|
86
|
+
async def upload_book_file(
|
|
87
|
+
book_id: Annotated[str, Field(description="book id")],
|
|
88
|
+
content_type: Annotated[str, Field(description="content type")],
|
|
89
|
+
data: Annotated[str, Field(description="data")],
|
|
90
|
+
filename: Annotated[str, Field(description="filename")],
|
|
91
|
+
) -> UploadBookFileResult:
|
|
92
|
+
"""Upload a file and attach it to a book."""
|
|
93
|
+
create_upload = await api.request(
|
|
94
|
+
"POST",
|
|
95
|
+
"/uploads",
|
|
96
|
+
body={"content_type": content_type, "filename": filename},
|
|
97
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
98
|
+
)
|
|
99
|
+
_upload_part = await api.request(
|
|
100
|
+
"PUT",
|
|
101
|
+
"/uploads/{upload_id}/parts/{part_number}",
|
|
102
|
+
path_params={
|
|
103
|
+
"part_number": UPLOAD_BOOK_FILE_PART_NUMBER,
|
|
104
|
+
"upload_id": api.pick(create_upload, "id"),
|
|
105
|
+
},
|
|
106
|
+
body={"data": data},
|
|
107
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
108
|
+
)
|
|
109
|
+
_complete_upload = await api.request(
|
|
110
|
+
"POST",
|
|
111
|
+
"/uploads/{upload_id}/complete",
|
|
112
|
+
path_params={"upload_id": api.pick(create_upload, "id")},
|
|
113
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
114
|
+
)
|
|
115
|
+
attach_book_file = await api.request(
|
|
116
|
+
"PUT",
|
|
117
|
+
"/books/{book_id}/file",
|
|
118
|
+
path_params={"book_id": book_id},
|
|
119
|
+
body={"upload_id": api.pick(create_upload, "id")},
|
|
120
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
return UploadBookFileResult.model_validate(attach_book_file)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Verification report
|
|
127
|
+
|
|
128
|
+

|
|
129
|
+
|
|
130
|
+
## CI
|
|
131
|
+
|
|
132
|
+
`mcp/` holds the committed `tools.yaml` and cassettes. Exit 3 fails the job.
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
136
|
+
with:
|
|
137
|
+
persist-credentials: false
|
|
138
|
+
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
139
|
+
- run: uvx mcp4api openapi.yaml --offline --out mcp/
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Limitations
|
|
143
|
+
|
|
144
|
+
- OpenAPI 3.0, 3.1, 3.2, and Swagger 2.0 only.
|
|
145
|
+
- API key or bearer token authentication only.
|
|
146
|
+
- A failing tool is a known gap. It is not repaired.
|
|
147
|
+
- Agent curation needs an Anthropic API key.
|
|
148
|
+
|
|
149
|
+
The full list is in [Limitations](https://github.com/smusali/mcp4api/blob/main/docs/limitations.md).
|
|
150
|
+
|
|
151
|
+
## Contributing
|
|
152
|
+
|
|
153
|
+
See [Contributing](https://github.com/smusali/mcp4api/blob/main/CONTRIBUTING.md).
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
[MIT](https://github.com/smusali/mcp4api/blob/main/LICENSE)
|
mcp4api-0.1.0/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# mcp4api
|
|
2
|
+
|
|
3
|
+
mcp4api turns your API docs into a working MCP server, then calls every generated tool against your API and reports which ones work. Built for platform teams who want their product callable by agents.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/smusali/mcp4api/actions/workflows/ci.yml)
|
|
6
|
+
[](https://pypi.org/project/mcp4api/)
|
|
7
|
+
[](https://github.com/smusali/mcp4api/blob/main/LICENSE)
|
|
8
|
+
[](https://pypi.org/project/mcp4api/)
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
[Recording](https://github.com/smusali/mcp4api/blob/main/examples/demo.cast)
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install mcp4api
|
|
18
|
+
uvx mcp4api
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quickstart
|
|
22
|
+
|
|
23
|
+
These commands need no API key. They reuse the committed manifest and cassettes, regenerate the other artifacts in place, and exit 3. The sample's one known gap is `get_book`: `page_count` is a string in the API and an integer in the spec.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git clone https://github.com/smusali/mcp4api && cd mcp4api
|
|
27
|
+
uvx mcp4api examples/sample-api/openapi.yaml --offline --out examples/sample-api
|
|
28
|
+
cat examples/sample-api/report/verification.md
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Generated tool
|
|
32
|
+
|
|
33
|
+
`upload_book_file` from the Shelf sample is four calls composed into one tool.
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
@mcp.tool(
|
|
37
|
+
title="Upload Book File",
|
|
38
|
+
annotations=ToolAnnotations(
|
|
39
|
+
read_only_hint=False,
|
|
40
|
+
destructive_hint=False,
|
|
41
|
+
idempotent_hint=False,
|
|
42
|
+
open_world_hint=True,
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
async def upload_book_file(
|
|
46
|
+
book_id: Annotated[str, Field(description="book id")],
|
|
47
|
+
content_type: Annotated[str, Field(description="content type")],
|
|
48
|
+
data: Annotated[str, Field(description="data")],
|
|
49
|
+
filename: Annotated[str, Field(description="filename")],
|
|
50
|
+
) -> UploadBookFileResult:
|
|
51
|
+
"""Upload a file and attach it to a book."""
|
|
52
|
+
create_upload = await api.request(
|
|
53
|
+
"POST",
|
|
54
|
+
"/uploads",
|
|
55
|
+
body={"content_type": content_type, "filename": filename},
|
|
56
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
57
|
+
)
|
|
58
|
+
_upload_part = await api.request(
|
|
59
|
+
"PUT",
|
|
60
|
+
"/uploads/{upload_id}/parts/{part_number}",
|
|
61
|
+
path_params={
|
|
62
|
+
"part_number": UPLOAD_BOOK_FILE_PART_NUMBER,
|
|
63
|
+
"upload_id": api.pick(create_upload, "id"),
|
|
64
|
+
},
|
|
65
|
+
body={"data": data},
|
|
66
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
67
|
+
)
|
|
68
|
+
_complete_upload = await api.request(
|
|
69
|
+
"POST",
|
|
70
|
+
"/uploads/{upload_id}/complete",
|
|
71
|
+
path_params={"upload_id": api.pick(create_upload, "id")},
|
|
72
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
73
|
+
)
|
|
74
|
+
attach_book_file = await api.request(
|
|
75
|
+
"PUT",
|
|
76
|
+
"/books/{book_id}/file",
|
|
77
|
+
path_params={"book_id": book_id},
|
|
78
|
+
body={"upload_id": api.pick(create_upload, "id")},
|
|
79
|
+
auth=(("api_key", "header", "X-API-Key"),),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return UploadBookFileResult.model_validate(attach_book_file)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Verification report
|
|
86
|
+
|
|
87
|
+

|
|
88
|
+
|
|
89
|
+
## CI
|
|
90
|
+
|
|
91
|
+
`mcp/` holds the committed `tools.yaml` and cassettes. Exit 3 fails the job.
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
95
|
+
with:
|
|
96
|
+
persist-credentials: false
|
|
97
|
+
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
98
|
+
- run: uvx mcp4api openapi.yaml --offline --out mcp/
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Limitations
|
|
102
|
+
|
|
103
|
+
- OpenAPI 3.0, 3.1, 3.2, and Swagger 2.0 only.
|
|
104
|
+
- API key or bearer token authentication only.
|
|
105
|
+
- A failing tool is a known gap. It is not repaired.
|
|
106
|
+
- Agent curation needs an Anthropic API key.
|
|
107
|
+
|
|
108
|
+
The full list is in [Limitations](https://github.com/smusali/mcp4api/blob/main/docs/limitations.md).
|
|
109
|
+
|
|
110
|
+
## Contributing
|
|
111
|
+
|
|
112
|
+
See [Contributing](https://github.com/smusali/mcp4api/blob/main/CONTRIBUTING.md).
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
[MIT](https://github.com/smusali/mcp4api/blob/main/LICENSE)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Only the latest published release receives security fixes.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| Latest published release | Yes |
|
|
10
|
+
| Older releases | No |
|
|
11
|
+
|
|
12
|
+
## Reporting a vulnerability
|
|
13
|
+
|
|
14
|
+
Report vulnerabilities privately through [GitHub security advisories](https://github.com/smusali/mcp4api/security/advisories/new). Do not open a public issue, and do not disclose the report before a fix is published. You can expect an initial response within 3 days.
|
|
15
|
+
|
|
16
|
+
## Threat model
|
|
17
|
+
|
|
18
|
+
mcp4api fetches documentation the operator did not write and passes that text to a model. A hostile page can attempt prompt injection. Curation wraps that text and then enforces exclusions in code. The tool generates code, executes it, and can call live APIs with real credentials. The methodology is in [Methodology](docs/METHODOLOGY.md).
|
|
19
|
+
|
|
20
|
+
## Guarantees
|
|
21
|
+
|
|
22
|
+
- Credentials are read from the environment and are not written into generated code, fixtures, or prompts.
|
|
23
|
+
- Cassettes store no headers, and secret values are replaced before the file is written.
|
|
24
|
+
- Verification dials only loopback or a host passed to `--allow-host`.
|
|
25
|
+
- Destructive and non-idempotent tools are not called under `--live` unless `--allow-writes` is set.
|
|
26
|
+
- Report excerpts are trimmed upstream bodies. Treat `report/` as sensitive when a live body may contain secrets.
|