PythonとNode.js SDKが利用可能になりました!
Plug-and-play MCPサーバー用の認証
MCP Authは、MCPサーバーに本番環境対応の認証を追加するために必要なすべてを提供します。仕様を読んだり、配線を行ったりする数週間は必要ありません。
なぜMCP Authなのか?
仕様をスキップ。ボイラープレートをスキップ。認証だけ。
MCP仕様はOAuth 2.1やその他のRFCを必要とし、認証の堅固な基盤を提供します。MCP Authを使用すると、わずか数行のコードで信頼できるプロバイダーに接続することで、さらに先に進むことができます。
任意のプロバイダーに接続。それはプロバイダー非依存です。
MCP Authは、OAuth 2.1またはOpenID Connect準拠のプロバイダーと連携します。検証済みリストから選択するか、ツールを使用してプロバイダーが準拠しているかを確認できます。
迅速にリリースし、安全に。
本番環境への準備はできていますか?私たちがサポートします。MCP Authは仕様とベストプラクティスに従っているため、自信を持ってローンチできます。
本当に数行のコードだけで実現できます
- Python
- Node.js
mcp = FastMCP("MyMCPServer")
resource_identifier = "https://api.example.com"
mcp_auth = MCPAuth(
protected_resources=ResourceServerConfig(
metadata=ResourceServerMetadata(
resource=resource_identifier,
authorization_servers=[fetch_server_config('<auth-server-url>', AuthServerType.OIDC)],
scopes_supported=["read", "write"],
)
)
)
app = Starlette(
routes=[
*mcp_auth.resource_metadata_router().routes,
Mount('/', app=mcp.sse_app(), middleware=[Middleware(
mcp_auth.bearer_auth_middleware("jwt",
resource=resource_identifier,
audience=resource_identifier,
required_scopes=["read", "write"]
)
)])
]
)
@mcp.tool()
def whoami():
return mcp_auth.auth_info.claims
const server = new McpServer(/* ... */);
const resourceIdentifier = 'https://api.example.com';
const mcpAuth = new MCPAuth({
protectedResources: {
metadata: {
resource: resourceIdentifier,
authorizationServers: [await fetchServerConfig('<auth-server-url>', { type: 'oidc' })],
scopesSupported: ['read', 'write'],
}
}
});
const app = express();
app.use(mcpAuth.protectedResourceMetadataRouter());
app.use(mcpAuth.bearerAuth('jwt', {
resource: resourceIdentifier,
audience: resourceIdentifier,
requiredScopes: ['read', 'write']
}));
server.tool('whoami', ({ authInfo }) => {
return authInfo.claims;
});
MCP SDKについてはどうですか?
公式MCP SDK(Python、Node.jsなど)は素晴らしい出発点です。MCP Authはすべてのチュートリアルでそれらを使用し、既存のセットアップの強力な補完として機能します。
MCP Authは、認証と認可において「動作する」から「安全で、スケーラブルで、保守可能」への橋渡しをします。
以下を提供することでSDKと連携するように設計されています:
- ファーストクラスのJWTサポート
- プロバイダー非依存のツール
- 様々なIDプロバイダー向けのステップバイステップガイド
さらに、MCP仕様とSDKの変更に追従するので、あなたはその必要がありません。