Skip to main content

mcp-api-connect™

License: Apache 2.0 Python 3.10+

One payload in, any API out. mcp-api-connect is a protocol- and auth-agnostic connector engine: describe a target service (URL, protocol, auth, request/ response shape) once, then send it a normalized payload and get a normalized response back — whether the target is a REST/JSON API, a legacy SOAP service, protected by an API key, Basic auth, a Bearer token, or OAuth2 client credentials.

It ships as three things built on the same core engine, so however you want to use it, you can:

  • A Python librarypip install mcp-api-connect, call MCPAPIConnectEngine directly, no server required.
  • A standalone HTTP APIpip install mcp-api-connect[api], run mcp-api-connect-api, POST to /invoke.
  • An MCP serverpip install mcp-api-connect[mcp], run mcp-api-connect, point any MCP client (Claude, etc.) at it so an agent can call registered connectors — or arbitrary services on the fly — as tools.

Why

Every integration project reinvents the same wheel: a REST client here, a SOAP client there, one auth flow per service, ad-hoc request/response mapping scattered across the codebase. mcp-api-connect centralizes that into one declarative spec (InvokeSpec) and one execution engine, so adding a new target service is config, not code.

Quick start (library)

pip install mcp-api-connect
import asyncio
from mcp_api_connect import MCPAPIConnectEngine, InvokeSpec, Target, AuthSpec, AuthType, RequestFormat, ResponseFormat

spec = InvokeSpec(
    target=Target(base_url="https://api.example.com"),
    auth=AuthSpec(type=AuthType.API_KEY, config={"api_key": "secret", "header_name": "X-API-Key"}),
    request_format=RequestFormat(method="POST", path="/v1/orders", content_type="json"),
    response_format=ResponseFormat(content_type="json"),
)

async def main():
    async with MCPAPIConnectEngine() as engine:
        result = await engine.invoke(spec, {"customer": "jane"})
        print(result.success, result.data)

asyncio.run(main())

Quick start (HTTP API)

pip install "mcp-api-connect[api]"
mcp-api-connect-api   # serves on :8000, interactive docs at /docs
curl -X POST http://localhost:8000/invoke -H 'content-type: application/json' -d '{
  "spec": {
    "target": {"base_url": "https://api.example.com"},
    "auth": {"type": "api_key", "config": {"api_key": "secret"}},
    "request_format": {"method": "POST", "path": "/v1/orders"},
    "response_format": {"content_type": "json"}
  },
  "payload": {"customer": "jane"}
}'

Register a reusable connector once, then invoke it by name:

curl -X POST http://localhost:8000/connectors -d '{"name": "orders-api", "spec": {...}}'
curl -X POST http://localhost:8000/connectors/orders-api/invoke -d '{"customer": "jane"}'

Quick start (MCP)

pip install "mcp-api-connect[mcp]"
{
  "mcpServers": {
    "mcp-api-connect": { "command": "/path/to/.venv/bin/mcp-api-connect" }
  }
}

Exposes tools: invoke (stateless, one-off), register_connector, list_connectors, invoke_connector (by name), delete_connector. An agent can register a connector for "the Salesforce API" once, then just say "call it with this payload" from then on.

➜ Full setup for Claude Desktop / Claude Code / Cursor, persistence, security notes, and a worked example: docs/mcp-integration.md.

Core concepts

  • Target — base URL, protocol (rest | soap), timeout, default headers.
  • AuthSpectype (none, api_key, basic, bearer, oauth2_client_credentials) + a config dict shaped for that type. OAuth2 tokens are fetched and cached automatically.
  • RequestFormat / ResponseFormat — content type (json, xml, soap) plus a declarative field_map ({"target.path": "$.source.jsonpath"}) for reshaping payloads without writing code, or a Jinja2 body_template for full control (required for SOAP envelopes).
  • InvokeSpec — bundles the three above; the unit of "how to reach one service." Store it as a named Connector or pass it inline per call.

See src/mcp_api_connect/core/models.py for the full schema, and docs/auth-reference.md for the config shape each auth type expects.

Documentation

Extending

  • New auth type: implement AuthStrategy, register via engine.register_auth_strategy(...).
  • New protocol (e.g. GraphQL): implement ProtocolAdapter, register via engine.register_adapter(...).
  • New connector storage backend: implement ConnectorStore (ships with InMemoryConnectorStore and SqliteConnectorStore, credentials encrypted at rest via Fernet).

Roadmap

  • OAuth2 authorization-code flow, mTLS, AWS SigV4 auth strategies
  • WSDL-driven SOAP (optional zeep-backed adapter, no hand-written envelope needed)
  • GraphQL adapter
  • Postgres-backed ConnectorStore
  • Retry/backoff + rate limiting policies per connector
  • SSRF-safe target allow-listing for public deployments

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev,api,storage,mcp]"
pytest

License

Apache License 2.0 — see LICENSE and NOTICE.

Contributions are accepted under the same license (inbound = outbound); see CONTRIBUTING.md.

Trademark

mcp-api-connect™ is a trademark of Balaji Venkatasubramaniyar. The Apache 2.0 license covers copyright and patents but grants no trademark rights. You may use the name to refer to this project and to state compatibility, but not to name a fork, product, or service, or to imply endorsement. See TRADEMARKS.md for the full policy.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_api_connect-0.1.0.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_api_connect-0.1.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file mcp_api_connect-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_api_connect-0.1.0.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.0

File hashes

Hashes for mcp_api_connect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 43924a11737cf98e8bb8550ece7890702bafd148f9ae8fc3410051f4ba872728
MD5 aaadd832c5c690bef401289fea04c829
BLAKE2b-256 ee6fcc17ad8f4bc41f923396b7d2ce6795f7135880a19c57149ea97b180cfde7

See more details on using hashes here.

File details

Details for the file mcp_api_connect-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_api_connect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2619590f193956b1cde79e4bdccfcafed7e3348c59775da3368479d8fc7f12d6
MD5 ede3ce8d611b7f99eb082ee1d364c390
BLAKE2b-256 1ce931a1755c3c597d49ed2a2c9ee699457ba56216de36a44aa533b25e4e736e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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