跳到正文

智能体 · 进行中

MCP 服务器

Identvia 提供无状态 MCP 服务器,使助手可向用户请求对已启用 AgentPass 的站点的访问并使用它,同时用户保持掌控。

复制给你的 AI 代理用的提示词

在用编程代理?这段提示词会把它指向这些文档,并列出它必须遵守的规则。像审查其他代码一样审查它写的代码。

You are helping me add "Sign in with Identvia" to my app (PHP). Identvia is an OpenID Connect provider.

Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration

Stack: plain PHP 8.1+ (no framework). Use the official SDK identvia/identvia-php (composer require identvia/identvia-php, or the zip with vendor/ from https://id.identvia.com/developers/docs/php for hosts without Composer). Create identvia.php (config), login.php (redirectToSignIn), callback.php (handleCallback, then session_regenerate_id(true) and store sub) and logout.php. Read secrets from environment variables or a config file outside the web root.

Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.

Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md

Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.

连接

服务器 URL:https://id.identvia.com/mcp(Streamable HTTP,JSON 响应,无会话或 SSE)。客户端通过 /.well-known/oauth-protected-resource/mcp 发现授权,再使用带 PKCE 的 OAuth 2.1 与 resource=https://id.identvia.com/mcp。可用 Client ID Metadata Document(HTTPS client_id)标识自身,或动态注册。支持协议修订 2026-07-28 与 2025-11-25 / 2025-06-18 / 2025-03-26。

权限范围

  • profile:用户是谁(whoami)。
  • grants:read:列出智能体访问与待处理请求。
  • grants:revoke:撤销智能体访问。
  • agent:request:请求访问、检查并用其调用站点。

工具

  • whoami、list_grants、revoke_grant
  • request_access:向用户收件箱发送 AgentPass 请求。
  • check_access:用户批准后,Identvia 兑换通行证并返回 credential_handle。令牌本身永不返回给客户端。
  • call_service:仅向已授权站点发出一次 HTTPS 请求(10 秒,256 KB)。

没有批准工具。批准仅在 Identvia 中由已登录用户通过通行密钥或身份验证器应用完成。