Skip to main content

Prerequisites

  • Python 3.11+ installed on your machine
  • An OpenAPI specification for the API you want to wrap (JSON or YAML)
Don’t have a spec handy? Use the Petstore sample spec to follow along.

Step 1: Generate your server

1

Open the dashboard

Go to mcpblacksmith.com/dashboard and create a new project.
2

Upload your spec

Drag and drop your OpenAPI spec file (JSON or YAML) into the upload zone. Blacksmith supports OpenAPI 2.0, 3.0, 3.1, and 3.2.
3

Generate

Click Generate. Blacksmith analyzes your spec, extracts all operations, builds typed models, configures authentication, and generates the complete server code.
4

Download

Download the generated server as a ZIP file. Extract it to a directory of your choice.

Step 2: Install dependencies

cd my-api-server
pip install -r requirements.txt

Step 3: Configure credentials

If your API requires authentication, open the .env file and fill in your credentials:
.env
# Example: API Key authentication
API_KEY=your-api-key-here

# Example: Bearer token
BEARER_TOKEN=your-token-here

# Example: OAuth2
OAUTH2_CLIENT_ID=your-client-id
OAUTH2_CLIENT_SECRET=your-client-secret
The .env file is pre-configured with the correct variable names for your API’s authentication scheme. See Authentication for details on each auth type.

Step 4: Run the server

python server.py
By default, the server starts with stdio transport — the standard for local MCP connections. You’ll see output like:
INFO: MCP server 'Petstore API' started (transport: stdio)

Step 5: Connect to an MCP client

Add your server to your MCP client’s configuration. Most clients use a JSON config file:
{
  "mcpServers": {
    "petstore": {
      "command": "python",
      "args": ["/absolute/path/to/server.py"]
    }
  }
}
Restart your MCP client. Your API tools are now available to the AI agent.
See the full guide at Connecting to AI Agents for transport options, virtual environments, and troubleshooting.

What’s next?