Skip to main content

Authplane JWT validation adapter for the official MCP Python SDK

Project description

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.23.0, <1.28.0. MCP 1.28 renamed the elicitation field from elicitationId (camelCase) to elicitation_id (snake_case), which breaks this adapter's current wire handling. If your project needs MCP 1.28+, please open an issue — the adapter update is straightforward, we just haven't cut it yet.

Quickstart

import asyncio

from authplane_mcp import authplane_mcp_auth, 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)

    @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.

Project details


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.3.0.tar.gz (17.5 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.3.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: authplane_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for authplane_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f6933f84855354805514bb794a31092320a5aaa280e9f1ed516df391ec5da733
MD5 9acde12971c841b2abfde69b534fc99f
BLAKE2b-256 748f7361f110ead4c74fedab060d9417d869e698151f176623ad456d9b7fc320

See more details on using hashes here.

Provenance

The following attestation bundles were made for authplane_mcp-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: authplane_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for authplane_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31f96e24329c490a7fbec8484c5b3f7021190e279060aaa7f35f73db1c80cbba
MD5 df7c5a5f6685a6bb383505af8cd918f2
BLAKE2b-256 531ecbf07ae98845deb3f388cc33893337adc0dcda18c274c6fe8e3fe84824be

See more details on using hashes here.

Provenance

The following attestation bundles were made for authplane_mcp-0.3.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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page