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.2.0.tar.gz (12.7 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.2.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: authplane_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 12.7 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.2.0.tar.gz
Algorithm Hash digest
SHA256 01f356b82c53195c3c32fb19feab9e1073bc5257e914533b623e7cabf79f28ff
MD5 ef95523be0d5cdeec7f3403663be11a7
BLAKE2b-256 16d7b1531b023f46f0ff03ee9b12027f21b2fc80db1939a8abae5dccf05600a5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: authplane_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50504ba8d99447d279a5bea1901846243c99d3ee839edba63678849ee34485a7
MD5 5c5a717e82bd6fd24192c6ff342f4398
BLAKE2b-256 15bb7ed86a0f86cfd7b0cdc496fecd93dd69963be68747a7d68cf6b5362ae4ef

See more details on using hashes here.

Provenance

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