mcp4api
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.
Install
pip install mcp4api
uvx mcp4api
Quickstart
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.
git clone https://github.com/smusali/mcp4api && cd mcp4api
uvx mcp4api examples/sample-api/openapi.yaml --offline --out examples/sample-api
cat examples/sample-api/report/verification.md
Generated tool
upload_book_file from the Shelf sample is four calls composed into one tool.
@mcp.tool(
title="Upload Book File",
annotations=ToolAnnotations(
read_only_hint=False,
destructive_hint=False,
idempotent_hint=False,
open_world_hint=True,
),
)
async def upload_book_file(
book_id: Annotated[str, Field(description="book id")],
content_type: Annotated[str, Field(description="content type")],
data: Annotated[str, Field(description="data")],
filename: Annotated[str, Field(description="filename")],
) -> UploadBookFileResult:
"""Upload a file and attach it to a book."""
create_upload = await api.request(
"POST",
"/uploads",
body={"content_type": content_type, "filename": filename},
auth=(("api_key", "header", "X-API-Key"),),
)
_upload_part = await api.request(
"PUT",
"/uploads/{upload_id}/parts/{part_number}",
path_params={
"part_number": UPLOAD_BOOK_FILE_PART_NUMBER,
"upload_id": api.pick(create_upload, "id"),
},
body={"data": data},
auth=(("api_key", "header", "X-API-Key"),),
)
_complete_upload = await api.request(
"POST",
"/uploads/{upload_id}/complete",
path_params={"upload_id": api.pick(create_upload, "id")},
auth=(("api_key", "header", "X-API-Key"),),
)
attach_book_file = await api.request(
"PUT",
"/books/{book_id}/file",
path_params={"book_id": book_id},
body={"upload_id": api.pick(create_upload, "id")},
auth=(("api_key", "header", "X-API-Key"),),
)
return UploadBookFileResult.model_validate(attach_book_file)
Verification report
CI
mcp/ holds the committed tools.yaml and cassettes. Exit 3 fails the job.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
- run: uvx mcp4api openapi.yaml --offline --out mcp/
Limitations
- OpenAPI 3.0, 3.1, 3.2, and Swagger 2.0 only.
- API key or bearer token authentication only.
- A failing tool is a known gap. It is not repaired.
- Agent curation needs an Anthropic API key.
The full list is in Limitations.
Contributing
See Contributing.
License
Metadata
Release files for mcp4api 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp4api-0.1.0.tar.gz | 176.9 kB | With provenance | Details for mcp4api-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp4api-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mcp4api-0.1.0-py3-none-any.whl |
Total release size: 279.5 kB
Release files / mcp4api-0.1.0.tar.gz
| Download URL | mcp4api-0.1.0.tar.gz |
|---|---|
| Size | 176.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da89f8c75ae2270d75d0c03963a1cd99a23e1f8013df42de10a1f49920b84f8d
|
|
BLAKE2b-256 checksum How to use checksums |
6aa975d4f0d449c5745b68d26f46ccf5c0df03b1b006f48f7f3ab8b29034b493
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / mcp4api-0.1.0-py3-none-any.whl
| Download URL | mcp4api-0.1.0-py3-none-any.whl |
|---|---|
| Size | 102.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f40940b6256a09595ab47e62ce5134ae964037f2a813b888033937ae09753bfa
|
|
BLAKE2b-256 checksum How to use checksums |
e158ec4ac7bf929fd3560c82b1826d436efdb212aa0a8b8c2e6af8dbc860b861
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for mcp4api 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mcp4api-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.