Project details
mcp4api simplifies the process of turning API documentation into a fully functional MCP server. It automatically tests generated tools against your API, providing insights into functionality and compliance. Ideal for platform teams aiming to streamline integration processes.
mcp4api is a powerful tool designed to facilitate the testing and verification of API documentation by transforming it into a functional MCP (Microservice Communication Protocol) server. This innovative solution is particularly aimed at platform teams seeking to make their products easily callable by agents.
To get started, clone the repository and generate the verification report:
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
The following is a sample of a generated composite 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"),),
)
# Continues with additional request calls...
Generated verification reports provide insights into the functionality of the API, including recognized gaps in tool performance:

mcp4api currently supports the following:
To explore the complete list of limitations, refer to the Limitations Documentation.
For contributors, detailed guidelines can be found in the Contributing Documentation.
This project is hosted under the MIT License.
Utilize mcp4api to enhance the reliability of API calls and streamline communication processes within your platform.
Comments
0Start the conversation
Share the first comment.