Skip to main content

authplane-mcp

PyPI License

Authplane JWT validation for servers built on the official MCP Python SDK.

Install

pip install authplane-mcp

Compatibility

Supported mcp range: >=1.28.1, <2.0.0. The floor is 1.28.1 because earlier releases (<=1.28.0) are affected by PYSEC-2026-3483, fixed in 1.28.1. The adapter targets the mcp 1.x server API (mcp.server.fastmcp.FastMCP) and the camelCase URL-elicitation field (ElicitRequestURLParams(elicitationId=...)), which are the shape of the current 1.x line. As a belt-and-braces measure the adapter does not hard-code that spelling: it resolves the elicitation-id field name from the model's own schema — a known spelling is checked at import, then resolved per call — so a rename within 1.x would be picked up automatically rather than breaking the consent path. mcp 2.0 is not yet supported: it removes mcp.server.fastmcp and renames the elicitation field to snake_case elicitation_id, which is a separate port. If your project needs mcp 2.0, please open an issue.

Quickstart

import asyncio

from authplane_mcp import authplane_mcp_auth, install_request_context, require_scope
from mcp.server.fastmcp import FastMCP


async def main() -> None:
    auth_result = await authplane_mcp_auth(
        issuer="https://auth.company.com",
        resource="https://mcp.company.com",
        scopes=["tools/query", "tools/write"],
    )
    mcp = FastMCP("My MCP Server", port=8080, json_response=True, **auth_result)
    # Wires Authplane's per-app hooks onto the server: advertises the issuer /
    # resource identifiers verbatim in the Protected Resource Metadata and
    # installs the request-context middleware used by inbound DPoP enforcement.
    install_request_context(mcp)

    @mcp.tool()
    async def query_database(query: str) -> str:
        require_scope("tools/query")
        return f"Result for: {query}"

    try:
        await mcp.run_streamable_http_async()
    finally:
        await auth_result.aclose()


asyncio.run(main())

auth_result holds background JWKS and metadata refresh tasks bound to the running event loop. Keep the setup, server, and aclose() inside a single asyncio.run(main()) so those tasks stay alive for the server's lifetime.

Documentation

PRM behavior, dev mode, revocation checking, manual setup, the full authplane_mcp_auth / AuthplaneTokenVerifier API, and error handling: User Guide.

Download files

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

Source Distribution

authplane_mcp-0.4.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

authplane_mcp-0.4.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file authplane_mcp-0.4.0.tar.gz.

File metadata

  • Download URL: authplane_mcp-0.4.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for authplane_mcp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ea0b6d856213facaf10143c71d062424eb84631502d20f78f05ffa5f67eae027
MD5 ad378ed789fa06a21ed2683cf9d637dc
BLAKE2b-256 46e29f5d72701aa54d8e4ecc4dc780b8d7c3f9b0df5c3fd04db766cfdc909d69

See more details on using hashes here.

Provenance

The following attestation bundles were made for authplane_mcp-0.4.0.tar.gz:

Publisher: publish-pypi.yml on AuthPlane/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file authplane_mcp-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: authplane_mcp-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for authplane_mcp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4baa172e797fbd40ccf23f903b08458c7ccf580f920d85f38c00c10581513a54
MD5 fb1f9dea120e0e15423b9c757388851c
BLAKE2b-256 681e45e6073d8d4467a3116ff87d56f36e5d9a11a09d188180c3d7df5c738816

See more details on using hashes here.

Provenance

The following attestation bundles were made for authplane_mcp-0.4.0-py3-none-any.whl:

Publisher: publish-pypi.yml on AuthPlane/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

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