OpenAPI MCP
OpenAPI based MCP that creates a FastMCP server from an OpenAPI specification.
Build and Install
This project uses uv for dependency management and requires Python 3.12 or higher.
Prerequisites
- Install Python 3.12 or higher
- Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
Installation Steps
-
Clone the repository:
git clone <repository-url> cd openapimcp
-
Install the project in editable mode:
uv pip install -e .
This will:
- Install all required dependencies (
fastmcpandhttpx) - Create the
openapimcpcommand-line tool - Make the project available for development
- Install all required dependencies (
-
Verify the installation:
openapimcp --help
Alternative: Using uvx
You can also run the tool directly without installation using uvx:
uvx openapimcp
This is particularly useful for the example configurations in the examples directory.
Usage
The openapimcp command-line tool creates a FastMCP server from an OpenAPI specification. The tool is configured using environment variables.
Configuration
The following environment variables are available for configuration:
API_BASE_URL: The base URL of the API.OPENAPI_SPEC_URL: The URL of the OpenAPI specification.SERVER_NAME: The name of the MCP server.BEARER_TOKEN: The bearer token for authentication.USERNAME: The username for basic authentication.PASSWORD: The password for basic authentication.
Running the server
To run the server, you can use the openapimcp script, which is created during the installation. You need to set the environment variables before running the script.
For example:
export API_BASE_URL="http://localhost:3000/v1"
export OPENAPI_SPEC_URL="http://localhost/local/openapi/gal-inq.json"
export SERVER_NAME="Galicia Inquiries API"
openapimcp
Examples
The examples directory contains several example configurations that can be used to run the server. These examples are in the form of JSON files that define the environment variables for different services.
For example, to run the gal-mock example, you can use the environment variables defined in examples/gal-mock/gal-inq.json.
{
"mcpServers": {
"galInq": {
"command": "uvx",
"args": [
"openapimcp"
],
"env": {
"SERVER_NAME": "Galicia Inquiries API",
"OPENAPI_SPEC_URL": "http://localhost/local/openapi/gal-inq.json",
"API_BASE_URL": "http://localhost:3000/v1"
}
}
}
}
This configuration can be used with a tool that consumes mcpServers definitions to start the MCP server with the specified environment.
Metadata
Release files for geaimcpopenapi 1.0.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 | |
|---|---|---|---|---|
| geaimcpopenapi-1.0.0.tar.gz | 2.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geaimcpopenapi-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / geaimcpopenapi-1.0.0.tar.gz
| Download URL | geaimcpopenapi-1.0.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
340ef6bfa664316632dcc00fb60c30c08ff02564c065e330abff0077c4593b73
|
|
BLAKE2b-256 checksum How to use checksums |
7b0a506d35ae803f9ab3690732b8e772ef9b71e95f797515cff622444c0d8ae1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.20
|
Release files / geaimcpopenapi-1.0.0-py3-none-any.whl
| Download URL | geaimcpopenapi-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9aa4e2e0fe41c9244e487c7b182100d830350e6e32b24afff23201627746dcce
|
|
BLAKE2b-256 checksum How to use checksums |
6b7c28eb65b1ac1ca87247a76e45a5cc819332435f1b208fab610dac13c0ec10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.20
|
Security for geaimcpopenapi 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.