Skip to main content

connectorgen

CI License: Apache 2.0 Python 3.10–3.13

Connectors for any HTTP API or MCP server, generated from what already exists, kept working as APIs change.

Point connectorgen at an OpenAPI or Swagger spec, an API's documentation pages, or an MCP server, and it generates a connector: actions with input schemas, auth, pagination and triggers. Your app runs any connector the same way, with one execute(action, inputs) call. When the API changes, connectorgen detects it, regenerates the connector, keeps your customizations, and proposes the update for approval.

A connector is data, not code (one JSON file), so it can be validated, diffed, tested and repaired. It's built as a library for workflow and integration tools, with a CLI on top.

OpenAPI / Swagger 2.0 ─┐
API docs (+ LLM) ──────┼─► Connector (JSON) ─► one runtime: execute · paginate · triggers · OAuth
MCP server ────────────┘         │                └─► or serve it as an MCP server
                                 └─► contract tests · live smoke tests · check/diff/apply when APIs change

Tested on 740 real-world API specs (99.8% of 43,000 generated actions pass their contract tests), plus the full Stripe and GitHub APIs and the official MCP reference servers.

Works with any LLM, and needs none. Generating, running, testing and repairing connectors use no model. The optional AI features (filling gaps, reading docs, diagnosing rejected requests) work with Claude, OpenAI, or any OpenAI-compatible model, including local ones via Ollama.

Install

pip install connectorgen              # core: generate, run, test, repair
pip install "connectorgen[mcp]"       # + MCP client/server
pip install "connectorgen[ai]"        # + the Anthropic SDK (other LLM providers need no extra)

Quick start

CLI

# 1. Generate a connector from an OpenAPI 3.x or Swagger 2.0 spec (URL or file)
connectorgen generate https://example.com/openapi.yaml -o example.json
connectorgen convert swagger.json -o openapi.yaml     # or just convert Swagger 2.0 to OpenAPI 3

# 2. See what it found
connectorgen inspect example.json

# 3. Call an action (credentials come from env vars)
export CONNECTORGEN_API_KEY=...        # or CONNECTORGEN_TOKEN / _USERNAME + _PASSWORD
connectorgen call example.json get_pet -i petId=42
connectorgen call example.json list_pets -i limit=50 --paginate --max-pages 3
connectorgen call example.json create_pet --body pet.json
connectorgen call example.json delete_pet -i petId=42 --allow-destructive

# 4. Test it offline, and keep it current
connectorgen test example.json
connectorgen check example.json        # re-reads the spec; proposes an update if it changed

Python

from connectorgen import connector_from_openapi, ConnectorClient, Credentials

connector = connector_from_openapi("openapi.yaml")
connector.save("petstore.json")           # store / version / diff this

with ConnectorClient(connector, Credentials(api_key="...")) as client:
    pet = client.execute("get_pet", petId=42)
    client.execute("create_pet", body={"name": "Rex"})
    for pet in client.paginate("list_pets", page_size=100):
        print(pet["name"])

Inputs are validated against each action's JSON Schema before any request goes out (InputValidationError); non-2xx responses raise ActionHTTPError with status and body.

MCP, both ways

# Use an MCP server as a connector (--env names a secret the server needs; only the name is saved)
connectorgen from-mcp --command "npx -y @modelcontextprotocol/server-filesystem /data" -o fs.json
connectorgen call fs.json read_text_file -i path=/data/notes.txt

# Serve any connector as an MCP server (destructive actions are left out unless allowed)
connectorgen serve github.json --tag issues

Embedding in a workflow tool

Everything a host needs comes from the connector file, whatever its source:

Host need API
Store a connector connector.save(path) / Connector.load(path): one JSON format for HTTP and MCP
Build the step's input form connector.input_schema(action, prune=True): self-contained JSON Schema
Show the step action.summary, action.description, action.safe, action.destructive
Run a step with open_client(connector, creds) as c: c.execute(action, inputs)
"New item" triggers connector.triggers + Poller (HTTP), parse_webhook (webhooks)
Async runtime AsyncMcpClient for MCP (the HTTP client is sync; run it in a worker thread)
Expose steps to AI agents build_mcp_server(connector, creds)
Health checks run_contract_tests (offline), run_smoke_tests (live, read-only)
Keep connectors current check_for_drift(connector), then apply_proposal(...) after approval

Errors share one base class, ConnectorError, with specific subclasses (InputValidationError, ActionHTTPError, RateLimitError, McpToolError, …) so a host can map them to step failures, retries, or user-facing messages.

What's supported

Area Supported
Sources OpenAPI 3.0 / 3.1, Swagger 2.0 (converted automatically), API docs pages (with an LLM), MCP servers (stdio or Streamable HTTP)
Specs JSON or YAML (1.2), URL or file; local $refs (recursive, percent-encoded, into lists); tolerant of common spec mistakes (dates in YAML, boolean exclusiveMinimum, JS-style regex, relative server URLs, duplicate params, query strings in paths); spec URLs aren't redirected to plain http or to private addresses
Auth API key (header / query / cookie), bearer, basic, OAuth2 (authorization code + PKCE, client credentials, refresh; other flows with a token you supply); per-operation security, including schemes that must be sent together, so each action uses the credentials it accepts
Inputs and bodies path, query and header params, with OpenAPI serialization styles (deepObject, form, spaceDelimited, pipeDelimited, label, matrix); JSON bodies; form-encoded bodies with nested objects in bracket notation (metadata[plan]=pro). Multipart (file upload) bodies aren't sent yet
Pagination cursor (incl. nested cursor fields), cursor-as-URL, Stripe-style starting_after + has_more, offset, page, RFC 8288 Link headers (GitHub style)
Triggers polling ("new X") from list actions, with dedup and resume; webhooks from the spec, with HMAC signature checks (GitHub and Stripe presets)
Reliability retries for rate limits, transient 5xx and network failures; optional response validation
Testing offline contract tests for every action; live, read-only smoke tests
Keeping current check / diff / apply: changes classified as breaking, review, additive or info; local customizations kept; fixes from live API evidence
Credentials sent only to the API's own origin (next-page links and redirects can't carry them elsewhere), and never over plain http to another machine; never in connector files, repr(), error messages or request logs
Safety destructive actions (every PUT, PATCH and DELETE, and POSTs that delete, revoke, refund, …) flagged and opt-in (--allow-destructive); smoke tests read-only; updates need approval unless purely additive; webhooks without a configured secret are refused unless allowed
Limits response size, total request time, pages, spec size and nesting, regex and schema-validation work are all bounded, for specs, docs and servers you don't control

On the full Stripe (612 actions) and GitHub (1,242 actions) specs, every action passes its contract test, and pagination is detected for 133 and 274 actions respectively.

Documentation

Contributing

Contributions are welcome, especially reports of specs that don't work. See CONTRIBUTING.md for setup, tests and design principles, and SECURITY.md for reporting vulnerabilities privately. Notable changes are listed in CHANGELOG.md.

License

Apache License 2.0. Copyright 2026 Ahmad Karawash.

Metadata

Release files for connectorgen 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for connectorgen 0.9.1
File Size Uploaded Provenance Actions
connectorgen-0.9.1.tar.gz 234.8 kB With provenance Details for connectorgen-0.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for connectorgen 0.9.1
File Interpreter ABI Platform Actions
connectorgen-0.9.1-py3-none-any.whl Python 3 none any Details for connectorgen-0.9.1-py3-none-any.whl

Total release size: 405.8 kB

Release files / connectorgen-0.9.1.tar.gz

Download URL connectorgen-0.9.1.tar.gz
Size 234.8 kB
Tags Source
SHA-256 checksum
How to use checksums
65b2015308ab28c5b5b7423354130f289c37d8fdae8ffd2eba16ce6748d2a71c
BLAKE2b-256 checksum
How to use checksums
b5b725d6f177f18a8a422b8636bf3851d11d4405af121838466299600e3c4f64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / connectorgen-0.9.1-py3-none-any.whl

Download URL connectorgen-0.9.1-py3-none-any.whl
Size 170.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
357b1a631c864056c395016dfc0043f61a87141c79a15b24cf43d715f0bf6ddd
BLAKE2b-256 checksum
How to use checksums
dba27335b3b622fd77c5c33ba3f59829c53b124e97b3828f5dbb9bab2ffb6e1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for connectorgen 0.9.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for connectorgen-0.9.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page