mcp4api MCP server
Commit Nov 9, 2026Converts API documentation into working MCP servers and verifies tool functionality by calling them against the API.
Also known as smusali/mcp4api
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 9, 2026
- License
- MIT
What is mcp4api MCP?
mcp4api converts API documentation into working MCP servers and verifies tool functionality by calling them against the API.
Summary generated from the project's README
About mcp4api MCP server
Platform teams that want to make their products callable by AI agents can use mcp4api to automate the creation of Model Context Protocol servers. The tool takes existing API documentation, such as OpenAPI 3.0, 3.1, 3.2, or Swagger 2.0 specifications, and transforms them into functional MCP tools. It handles complex logic by composing multiple API calls into single tools, like the upload_book_file example which combines four separate requests.
After generating the server, the utility verifies the functionality by calling every new tool against the actual API. It produces a verification report to identify which tools work and which contain gaps, such as type mismatches between the specification and the API response. Users can install the package via pip or run it using uvx. The system supports API key or bearer token authentication, though agent curation specifically requires an Anthropic API key.
What you can do with it
- 1Automate MCP server generationConvert an existing OpenAPI specification into a working MCP server for agentic use.
- 2Verify tool functionalityCheck that every generated tool correctly interacts with the live API by running automated calls.
- 3Identify specification gapsDetect discrepancies between your API documentation and the actual API behavior through a verification report.
- 4Compose complex API workflowsCombine multiple sequential API requests into a single, simplified tool for an AI client.
Written from the project's README. Every use case is checked against a quote from it.
Automated checks
Ran Nov 15, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablesmusali/mcp4api is public and reachablegithub.com/smusali/mcp4api ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-09github.com/smusali/mcp4api ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubmcp4api
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
mcp4api MCP questions
What API specifications are supported?
The tool supports OpenAPI 3.0, 3.1, 3.2, and Swagger 2.0.
What authentication methods are supported?
It supports API key or bearer token authentication.
Does the tool fix failing tools?
No, a failing tool is identified as a known gap but is not repaired by the system.