-
Notifications
You must be signed in to change notification settings - Fork 370
Create MCP proxy from OpenAPI specifications #1561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
davorrunje
merged 61 commits into
main
from
1554-create-mcp-proxy-from-openapi-specifications
May 12, 2025
Merged
Create MCP proxy from OpenAPI specifications #1561
davorrunje
merged 61 commits into
main
from
1554-create-mcp-proxy-from-openapi-specifications
May 12, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ttps://github.com/ag2ai/ag2 into 1554-create-mcp-proxy-from-openapi-specifications
…-from-openapi-specifications
…ithub.com:ag2ai/ag2 into 1554-create-mcp-proxy-from-openapi-specifications
Add requirement decorator
davorrunje
approved these changes
May 12, 2025
Codecov ReportAttention: Patch coverage is
... and 73 files with indirect coverage changes 🚀 New features to boost your workflow:
|
karikalanarun
pushed a commit
to karikalanarun/ag2
that referenced
this pull request
Jun 11, 2025
* Init mcp proxy cli * WIP * WIP * WIP * WIP * WIP * WIP * Fix ForwardRef issues by removing from __future__ import annotations * WIP * WIP * WIP * WIP * WIP * WIP * Add security examples, update version * Add security examples, update version * version updated * version updated to 0.8.6alpha2 * WIP * Trello WIP * Polish * Fix template * 1652 add operation renaming using llm (ag2ai#1659) * WIP * Add operation renaming * version updated to 0.8.8alpha0 * WIP * Fix function renaming * version updated to 0.8.8alpha1 * Add schema configuration examples to security examples * Add operation grouping * stringcase added to dependancies * Remove stringcase from imports * Remove stringcase from imports * Move fastapi_code_generator to optional import * Move fastapi_code_generator to optional import * Move fastapi_code_generator to optional import * Remove entrypoint for MCP CLI * Add configuration type to MCPProxy.create * Add configuration type to MCPProxy.create * Fix version * Patch generation failure when components are missing from api specification * Prepare for prerelease * Example cleanup * Add mcp-proxy-gen as dependency in notebooks * linting * Add requirement decorator * Rearrange decorator --------- Co-authored-by: Davor Runje <[email protected]> Co-authored-by: Davor Runje <[email protected]> Co-authored-by: Kumaran Rajendhiran <[email protected]> Co-authored-by: Kumaran Rajendhiran <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
We need a tool that automatically generates an stdio-based MCP server from an OpenAPI specification (either through a URL or as a JSON file). This server will connect to the service described in the OpenAPI spec and expose it as an MCP tool. The main goal is to enable easy creation of authenticated MCP tools for any service that has an OpenAPI specification, including the handling of authentication and security mechanisms as specified by the OpenAPI standard.
Key Features & Requirements:
Input:
Output:
Authentication and Security:
MCP Server:
Error Handling:
Environment Variables:
Use Case:
Motivation:
Acceptance Criteria:
Example Code:
The following Python example demonstrates how to generate an MCP server from an OpenAPI specification, authenticate using environment variables, and interact with the API through an LLM agent:
Explanation:
MCPProxy.create():
create_toolkit_and_run():
AssistantAgent
), which can use the MCP tools.Environment Variables:
API_KEY
andOAUTH2_TOKEN
are passed as environment variables to thestdio_client
. The server uses these variables to authenticate with the service.Stdio Connection:
stdio_client
, which communicates with the server through standard input and output.ClientSession
manages the session between the MCP server and the agent.Additional Notes:
API_KEY
,OAUTH2_TOKEN
).requests
orhttpx
, to facilitate communication with the service described in the OpenAPI specification.