MCP OIDC 供应商 是 AI Skill Hub 本期精选MCP工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
MCP OIDC 供应商 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
MCP OIDC 供应商 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/tigrisdata/mcp-oidc-provider
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"mcp-oidc----": {
"command": "npx",
"args": ["-y", "mcp-oidc-provider"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 MCP OIDC 供应商 执行以下任务... Claude: [自动调用 MCP OIDC 供应商 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"mcp_oidc____": {
"command": "npx",
"args": ["-y", "mcp-oidc-provider"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
mcp-oidc-provider is an Express middleware that acts as an OIDC provider for MCP (Model Context Protocol) servers with support for any OIDC-compliant identity provider as its backend.
Implementing a remote hosted MCP server requires implementing MCP Authorization Protocol. In theory, this is straightforward because modern applications either implement OAuth specs themselves or use an OAuth-compliant IdP like Auth0, Clerk, Okta, or Keycloak. Long story short, using your own IdP as-is imposes many limitations.
This package takes care of those limitations for you so you can focus on implementing your tools, resources, and prompts instead of spending hours investigating why your implementation doesn't work with Cursor or logs you out from Claude every few hours.
This package allows you to run either in standalone mode or integrate it into your MCP implementation. It works with any OIDC-compliant identity provider like Auth0, Clerk, Okta, Keycloak, Azure AD, Google, and more.
It uses different packages under the hood to glue everything together:
| Package | Purpose |
|---|---|
oidc-provider | Core OIDC/OAuth 2.0 server implementation. Handles authorization, token issuance, JWKS, client registration, and all OAuth flows |
openid-client | OAuth 2.0/OIDC client library. Used by OidcClient to communicate with upstream identity providers via OIDC Discovery |
jose | JWT signing/verification and JWKS generation. Used for access tokens and ID tokens |
keyv | Universal key-value storage abstraction. Used for sessions, tokens, grants, and OIDC adapter data |
express | Web framework for the Express adapter. Provides routing, middleware, and HTTP handling |
express-session | Session management for Express. Stores login state during OAuth flows |
npm install mcp-oidc-provider keyv openid-client
| Option | Type | Required | Description |
|---|---|---|---|
idpClient | IOidcClient | Yes | OIDC client instance |
store | Keyv | Yes | Keyv instance for storage |
baseUrl | string | Yes | Base URL of the server |
secret | string | Yes | Secret for signing cookies/sessions |
jwks | JWKS | No | Custom JWKS for signing tokens |
isProduction | boolean | No | Production mode flag |
sessionMaxAge | number | No | Session max age in ms (default: 30 days) |
additionalCorsOrigins | string[] | No | Additional origins to allow for CORS |
customMiddleware | RequestHandler[] | No | Custom middleware to run after CORS |
Choose your deployment:
That is useful if you already have your MCP implementation in a different stack than express js. You can have the implementation in nextjs, then you can run this server standalone and proxy the Auth requests to it using the MCP SDK's ProxyOAuthServerProvider. See the standalone-oidc example.
Both servers must share the same persistent Keyv store (e.g., Tigris, Redis) so the MCP server can look up tokens issued by the OIDC server.
auth.ts - OIDC Server (port 4001)
<details> <summary>TypeScript code</summary>
import { Keyv } from 'keyv';
import { KeyvTigris } from '@tigrisdata/keyv-tigris';
import { createOidcServer, OidcClient } from 'mcp-oidc-provider/oidc';
import { type JWKS } from 'mcp-oidc-provider';
const OIDC_PORT = 4001;
const OIDC_BASE_URL = process.env.OIDC_BASE_URL ?? `http://localhost:${OIDC_PORT}`;
// Use a persistent store so both servers can access the same data
const store = new Keyv({ store: new KeyvTigris() });
// Parse JWKS from environment variable (required for production)
const jwks: JWKS | undefined = process.env.JWKS ? JSON.parse(process.env.JWKS) : undefined;
const oidcServer = createOidcServer({
idpClient: new OidcClient({
issuer: 'https://your-tenant.auth0.com', // or any OIDC issuer
clientId: process.env.OIDC_CLIENT_ID!,
clientSecret: process.env.OIDC_CLIENT_SECRET!,
redirectUri: `${OIDC_BASE_URL}/oauth/callback`,
}),
store,
secret: process.env.SESSION_SECRET!,
port: OIDC_PORT,
baseUrl: OIDC_BASE_URL,
jwks,
});
await oidcServer.start();
</details>
mcp.ts - MCP Server (port 3001)
<details> <summary>TypeScript code</summary>
import express from 'express';
import { Keyv } from 'keyv';
import { KeyvTigris } from '@tigrisdata/keyv-tigris';
import { mcpAuthRouter } from '@modelcontextprotocol/sdk/server/auth/router.js';
import { ProxyOAuthServerProvider } from '@modelcontextprotocol/sdk/server/auth/providers/proxyProvider.js';
import { requireBearerAuth } from '@modelcontextprotocol/sdk/server/auth/middleware/bearerAuth.js';
import { createMcpAuthProvider } from 'mcp-oidc-provider/mcp';
const OIDC_BASE_URL = process.env.OIDC_BASE_URL ?? 'http://localhost:4001';
const MCP_PORT = 3001;
const MCP_BASE_URL = process.env.MCP_BASE_URL ?? `http://localhost:${MCP_PORT}`;
// Same persistent store as the OIDC server
const store = new Keyv({ store: new KeyvTigris() });
const mcpApp = express();
// Get config for ProxyOAuthServerProvider
const { proxyOAuthServerProviderConfig, mcpRoutes, resourceMetadataUrl } = createMcpAuthProvider({
oidcBaseUrl: OIDC_BASE_URL,
store,
mcpServerBaseUrl: MCP_BASE_URL,
});
// Create auth provider
const authProvider = new ProxyOAuthServerProvider(proxyOAuthServerProviderConfig);
// Mount routes (includes CORS, health check, and protected resource metadata)
mcpApp.use(mcpRoutes);
// Install MCP auth router
mcpApp.use(
mcpAuthRouter({
provider: authProvider,
issuerUrl: new URL(OIDC_BASE_URL),
baseUrl: new URL(MCP_BASE_URL),
})
);
// Protected MCP endpoint
mcpApp.use(express.json());
mcpApp.post(
'/mcp',
requireBearerAuth({ verifier: authProvider, resourceMetadataUrl }),
async (req, res) => {
// Your MCP handler here
}
);
mcpApp.listen(MCP_PORT);
</details>
For simpler deployments where OIDC and MCP run in the same Express app. See the mcp-integrated-oidc example.
<details> <summary>TypeScript code</summary>
import { Keyv } from 'keyv';
import { setupMcpExpress } from 'mcp-oidc-provider/mcp';
import { OidcClient } from 'mcp-oidc-provider/oidc';
import { type JWKS } from 'mcp-oidc-provider';
// Parse JWKS from environment variable (required for production)
const jwks: JWKS | undefined = process.env.JWKS ? JSON.parse(process.env.JWKS) : undefined;
const { app, handleMcpRequest } = setupMcpExpress({
idpClient: new OidcClient({
issuer: 'https://your-tenant.auth0.com', // or any OIDC issuer
clientId: process.env.OIDC_CLIENT_ID!,
clientSecret: process.env.OIDC_CLIENT_SECRET!,
redirectUri: `${process.env.BASE_URL}/oauth/callback`,
}),
store: new Keyv(),
baseUrl: process.env.BASE_URL!,
secret: process.env.SESSION_SECRET!,
jwks,
});
// Handle MCP requests - user is available via req.user
handleMcpRequest(async (req, res) => {
console.log('Authenticated user:', req.user);
// Your MCP server logic here
});
app.listen(3000);
</details>
mcp-oidc-provider will read from the following environment variables by default:
| Variable | Type | Description |
|---|---|---|
| SESSION_SECRET | High-entropy string | Secret for signing cookies/sessions |
| JWKS | JSON Web Key Set (JSON) | Pre-generated signing keys (production) |
The OidcClient works with any OIDC-compliant identity provider. It uses OIDC Discovery to automatically configure endpoints.
| Option | Type | Required | Description |
|---|---|---|---|
issuer | string | Yes | OIDC issuer URL (e.g., https://your-tenant.auth0.com) |
clientId | string | Yes | OAuth client ID |
clientSecret | string | Yes | OAuth client secret |
redirectUri | string | Yes | OAuth callback URL |
scopes | string | No | OAuth scopes (default: openid email profile) |
additionalAuthParams | Record<string, string> | No | Additional authorization parameters (e.g., { audience: '...' }) |
extractCustomData | (claims: UserClaims) => Record<string, unknown> \| undefined | No | Extract provider-specific data from ID token claims |
// Auth0
new OidcClient({
issuer: 'https://your-tenant.auth0.com',
clientId: process.env.AUTH0_CLIENT_ID!,
clientSecret: process.env.AUTH0_CLIENT_SECRET!,
redirectUri: 'https://your-app.com/oauth/callback',
scopes: 'openid email profile offline_access',
additionalAuthParams: { audience: 'https://your-api.com' },
});
// Clerk (note: doesn't support offline_access)
new OidcClient({
issuer: 'https://your-app.clerk.accounts.dev',
clientId: process.env.CLERK_CLIENT_ID!,
clientSecret: process.env.CLERK_CLIENT_SECRET!,
redirectUri: 'https://your-app.com/oauth/callback',
extractCustomData: (claims) => {
if (claims['org_id']) {
return {
organization: {
id: claims['org_id'],
slug: claims['org_slug'],
role: claims['org_role'],
},
};
}
},
});
// Okta
new OidcClient({
issuer: 'https://your-domain.okta.com',
clientId: process.env.OKTA_CLIENT_ID!,
clientSecret: process.env.OKTA_CLIENT_SECRET!,
redirectUri: 'https://your-app.com/oauth/callback',
extractCustomData: (claims) => {
if (claims['groups']) {
return { groups: claims['groups'] };
}
},
});
// Keycloak
new OidcClient({
issuer: 'https://keycloak.example.com/realms/my-realm',
clientId: process.env.KEYCLOAK_CLIENT_ID!,
clientSecret: process.env.KEYCLOAK_CLIENT_SECRET!,
redirectUri: 'https://your-app.com/oauth/callback',
});
// Microsoft Azure AD
new OidcClient({
issuer: `https://login.microsoftonline.com/${tenantId}/v2.0`,
clientId: process.env.AZURE_CLIENT_ID!,
clientSecret: process.env.AZURE_CLIENT_SECRET!,
redirectUri: 'https://your-app.com/oauth/callback',
});
// Google
new OidcClient({
issuer: 'https://accounts.google.com',
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
redirectUri: 'https://your-app.com/oauth/callback',
});
| Option | Type | Required | Description |
|---|---|---|---|
idpClient | IOidcClient | Yes | OIDC client instance |
store | Keyv | Yes | Keyv instance for storage |
secret | string | Yes | Secret for signing cookies/sessions |
port | number | Yes | Port to listen on |
baseUrl | string | Yes | Base URL of the OIDC server |
jwks | JWKS | No | Custom JWKS for signing tokens |
isProduction | boolean | No | Production mode flag |
sessionMaxAge | number | No | Session max age in ms (default: 30 days) |
additionalCorsOrigins | string[] | No | Additional origins to allow for CORS |
onListen | function | No | Callback when server starts |
| Option | Type | Required | Description |
|---|---|---|---|
oidcBaseUrl | string | Yes | Base URL of the OIDC server (e.g., http://localhost:4001) |
store | Keyv | Yes | Same Keyv instance used by OIDC server |
mcpServerBaseUrl | string | Yes | Base URL of your MCP server |
mcpEndpointPath | string | No | MCP endpoint path (default: /mcp) |
scopesSupported | string[] | No | Supported OAuth scopes |
jwksCacheOptions | JwksCacheOptions | No | JWKS cache settings (default: 30s cooldown, 10min cache) |
When using createOidcServer, the following endpoints are available:
| Endpoint | Description |
|---|---|
GET /authorize | Authorization endpoint |
POST /token | Token endpoint |
POST /token/revocation | Token revocation endpoint |
POST /register | Dynamic Client Registration |
GET /jwks | JSON Web Key Set |
GET /.well-known/openid-configuration | OIDC Discovery |
GET /oauth/callback | IdP callback handler |
GET /health | Health check |
We suggest storing data in a durable globally distributed object storage system like Tigris for production usecases. This will make your data usable globally, making it trivial for you to scale your MCP server without fear of high latency to your storage backend.
import { Keyv } from 'keyv';
import { KeyvTigris } from 'keyv-tigris';
const store = new Keyv({
store: new KeyvTigris(),
});
一个小巧、灵活的OIDC供应商,适合身份验证和授权场景
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,MCP OIDC 供应商 在MCP工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | mcp-oidc-provider |
| 原始描述 | 开源MCP工具:Open-sourced mcp-oidc-provider: a minimal, vendor-neutral OIDC layer that sits b。⭐11 · TypeScript |
| Topics | authmcpoauthoidcoidc-proxytypescript |
| GitHub | https://github.com/tigrisdata/mcp-oidc-provider |
| License | MIT |
| 语言 | TypeScript |
收录时间:2026-05-25 · 更新时间:2026-05-30 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端