Authplane Python SDK MCPサーバー
コミット 2026年10月26日JWT検証とPython向けの専用フレームワークアダプターを使用して、MCPおよびOAuth 2.1リソースサーバーを保護します。
別名 AuthPlane/python-sdk
- スター
- 11
- ツール
- —
- ダウンロード数(30日間)
- —
- 最新バージョン
- —
- 最終コミット
- 2026年10月26日
- ライセンス
- Apache-2.0
Authplane Python SDK MCPとは
Authplane Python SDKはMCPサーバーです。 JWT検証とPython向けの専用フレームワークアダプターを使用して、MCPおよびOAuth 2.1リソースサーバーを保護します。.
プロジェクトのREADMEから生成された概要
Authplane Python SDK MCP server について
このPython SDKの主な機能は、OAuth 2.1とJWT検証を使用してModel Context Protocolリソースサーバーを保護することです。公式のMCP Python SDKとFastMCPの両方に特化したアダプターを提供しており、開発者は既存のサーバーアーキテクチャへ認証機能を迅速に統合できます。authplane_authやauthplane_mcp_authなどの関数を使用することで、メタデータの検出、JWKSの取得、アクセストークンの検証を単一のステップで自動化できます。
このツールキットはPython 3.11以降の環境向けに設計されており、厳格なセキュリティ基準に重点を置いています。RS256やES256などの非対称アルゴリズムを強制し、アルゴリズム混同やSSRF攻撃に対する防御を実装しています。バックグラウンドでのJWKS更新、DPoPプルーフ検証、トークンイントロスペクションなどの複雑なタスクを自動的に管理します。これにより、リソースサーバーは、すべてのセキュリティレイヤーを手動で実装することなく、RFC 9068やRFC 9449などのRFC標準への準拠を維持できます。
できること
- 1FastMCPツールアクセスの保護require_scopesデコレータを使用することで、特定のツールへのアクセスを、必要なOAuthスコープを持つユーザーのみに制限できます。
- 2OAuthメタデータの自動検出認可サーバーのメタデータを検出して必要なキーを取得することにより、SDKがサーバーを自動的に設定できます。
- 3アウトバウンドリクエストの強化メタデータ取得時の組み込みDNSピニングとIPブロッキングにより、サーバーをSSRF攻撃から保護できます。
- 4送信者拘束トークンの実装このライブラリはDPoPをサポートしており、アクセストークンを特定のクライアントに紐付けることで、リプレイ攻撃を防止します。
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
自動チェック
実行日 2026年11月14日完全なレポート →まだ検証されていません。サーバーには80点のスコア、重大な問題がないこと、および検証に必要な十分なデータが必要です。 チェックの仕組み · 点数を上げるための改善点
- ソースリポジトリがリンクされており、アクセス可能authplane/python-sdk is public and reachablegithub.com/authplane/python-sdk ↗合格
- パッケージがこのリポジトリをソースとして指定未チェック
- ビルドの来歴 (Sigstore 証明)未チェック
- オープンソースライセンス (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit or release 2026-10-26github.com/authplane/python-sdk ↗合格
- OpenSSF Scorecard未チェック
- パッケージ名が有名なパッケージに酷似していない未チェック
- パッケージおよびその依存関係に重大な勧告なし未チェック
- モデルへの隠れた指示がない0 tool descriptions and the README read; no override phrases, credential paths or hidden characters合格
- 破壊的なツールがラベル付けされている未チェック
- リモートエンドポイントが MCP ハンドシェイクに応答未チェック
README
GitHubで見るAuthplane Python SDK
OAuth 2.1 JWT validation and token operations for Python resource servers, with first-class adapters for Model Context Protocol (MCP) servers.
Why Authplane
- One call wires up everything.
authplane_auth()(FastMCP) orauthplane_mcp_auth()(MCP) does RFC 8414 metadata discovery, fetches the JWKS, validates RFC 9068 access tokens, and serves RFC 9728 Protected Resource Metadata — unpacked straight into your MCP server. - Secure defaults. Asymmetric algorithms only, strict claim validation, SSRF-hardened fetches, background JWKS refresh, and a circuit breaker around the AS — out of the box.
- Standards-aligned. OAuth 2.1, DPoP (RFC 9449), Token Exchange (RFC 8693), Token Introspection (RFC 7662), Token Revocation (RFC 7009), Resource Indicators (RFC 8707).
Quickstart — FastMCP server with auth
import asyncio
from authplane_fastmcp import authplane_auth
from fastmcp import FastMCP
from fastmcp.server.auth import require_scopes
async def main() -> None:
result = await authplane_auth(
issuer="https://auth.company.com",
base_url="https://mcp.company.com",
scopes=["tools/query"],
)
mcp = FastMCP("My Server", **result)
@mcp.tool(auth=require_scopes("tools/query"))
def query(sql: str) -> str:
return f"Ran: {sql}" # replace with your real handler
try:
await mcp.run_async(transport="http", port=8080)
finally:
await result.aclose()
asyncio.run(main())
That's a complete, secure, standards-compliant MCP resource server. Swap authplane-fastmcp for authplane-mcp to use the official MCP Python SDK instead — see each adapter's README for the equivalent snippet.
Packages
| Package | Install | Purpose |
|---|---|---|
authplane-sdk |
pip install authplane-sdk |
Framework-agnostic JWT validation, AS metadata discovery, and token operations |
authplane-mcp |
pip install authplane-mcp |
Adapter for the official MCP Python SDK |
authplane-fastmcp |
pip install authplane-fastmcp |
Adapter for FastMCP |
Adapter packages depend on authplane-sdk, so installing one adapter brings the core SDK along. Adapter packages export only the adapter-specific glue (authplane_auth, AuthplaneAuthResult, AuthplaneTokenVerifier, etc.); core types (ASCredentials, FetchSettings, IntrospectionRevocation, errors) come from authplane, and TokenExchangeOptions / TokenResponse from authplane.oauth.
Requires Python 3.11+.
Compatibility
Tested against authserver 0.2.0. Introspection-based revocation (IntrospectionRevocation) requires authserver ≥ 0.1.2 and a confidential resource-server client that is either the issuing client or a runtime-client of the Resource — see the user guide.
Capabilities
Standards and RFCs
- OAuth 2.1 (draft-ietf-oauth-v2-1)
- RFC 8414 — Authorization Server Metadata discovery
- RFC 9068 — JWT Profile for OAuth 2.0 Access Tokens
- RFC 7662 — Token Introspection
- RFC 7009 — Token Revocation
- RFC 8693 — Token Exchange
- RFC 8707 — Resource Indicators
- RFC 9449 — DPoP (sender-constrained access tokens)
- RFC 9728 — OAuth 2.0 Protected Resource Metadata
- RFC 6750 — Bearer Token Usage
- RFC 7234 — HTTP caching semantics on discovery responses
- RFC 7519 / 7517 — JWT and JWKS
Security
- JWT signature, issuer, audience,
exp/nbf/iat, andtyp(at+jwt) validation; required claims enforced (sub,client_id,exp,iat,jti) - Algorithm-confusion defenses: only
RS256andES256(asymmetric) are accepted;none,HS256,HS384,HS512are always rejected at construction - AS metadata hardening: discovered
issuermust match configured issuer exactly; required endpoints must be present - SSRF hardening on outbound HTTP: DNS pinning, private/loopback/link-local/cloud-metadata IP blocking, HTTPS-only, response size limits, no redirects
- HTTPS-only by default with a
dev_modetoggle forlocalhostand private networks - JWKS resilience: stale-cache fallback, background refresh at 80% TTL, force-refresh on
kidmiss, coordinated fetches - Inbound DPoP proof verification: binding, replay,
htm/htu/athchecks - Outbound DPoP proof generation with nonce retry and pluggable nonce storage
- Circuit breaker around authorization-server calls
- Token caching with TTL buffers
Framework integrations
- Official MCP Python SDK →
authplane-mcp - FastMCP →
authplane-fastmcp
Observability
- Structured logging (
loggingmodule) across JWKS refresh, metadata discovery, circuit breaker transitions, token verification, and DPoP binding outcomes - Strict Pyright typing and immutable validated claims
Documentation
- Core SDK:
authplane/README.md· User Guide - MCP adapter:
authplane-mcp/README.md· User Guide - FastMCP adapter:
authplane-fastmcp/README.md· User Guide - Release history:
CHANGELOG.md - Security policy:
SECURITY.md - Contributing:
CONTRIBUTING.md - Release policy:
RELEASE_POLICY.md
License
Apache-2.0 — see LICENSE.
Authplane Python SDK MCPのよくある質問
JWT検証でサポートされているセキュリティアルゴリズムは何ですか?
アルゴリズム混同攻撃を防ぐため、このSDKは非対称アルゴリズム(具体的にはRS256およびES256)のみを受け入れます。
このSDKはDPoPをサポートしていますか?
はい、インバウンドのDPoPプルーフ検証とアウトバウンドのDPoPプルーフ生成の両方をサポートしています。
必要な最小Pythonバージョンは何ですか?
Python 3.11以上を使用する必要があります。