智能体
x.com ·
@_philschmid
Gemini 新增 Credentials API:让 agent 安全认证外部服务与 MCP 服务器
Philipp Schmid 介绍 Gemini 新的 Credentials API,用于在不向模型暴露密钥的前提下安全认证外部服务和 MCP 服务器。要点包括:通过 credentials.create() 一次性注册密钥,支持 bearer_token、environment_variable 或 oauth2(含自动刷新与 token 轮换);密钥不进入模型上下文、stdout 或内存;agent 只能看到占位符(如 __GEMINI_CRED_slack-bot-token__);出口代理仅在 allowlisted trusted_domains 上替换真实 token,向其他主机的外泄尝试返回 403;凭证可直接绑定到远程 mcp_server 工具或沙箱环境变量。文中附有官方文档链接。
AI推荐理由 介绍 Gemini API 新增 Credentials API 的具体机制:credentials.create() 支持 bearer_token、environment_variable、oauth2(含自动刷新与轮换),密钥不进入模型上下文,agent 仅见占位符,出口代理仅对 allowlisted trusted_domains 替换真实 token,其他主机返回 403,并可绑定远程 MCP server 工具或沙箱环境变量。属于面向开发者的具体技术能力说明,附官方文档链接,但为个人转述,未提供独立验证。
78
浏览 454
点赞 3
评论 3
转发 1
正文
New Credentials API to securely authenticate with external services and MCP servers without the model ever seeing your secrets:
- Register secrets once with `credentials.create()` supporting `bearer\_token`, `environment\_variable`, or `oauth2` (with auto-refresh and token rotation).
- Zero plaintext exposure: Secrets never enter model context, stdout, memory.
- The agent only sees a placeholder (e.g., `\_\_GEMINI\_CRED\_slack-bot-token\_\_`).
- Egress proxy swaps real token on the request only for allowlisted `trusted\_domains` (any exfiltration attempt to another host gets a `403`).
- Bind credentials directly to remote `mcp\_server` tools or sandbox env vars.
Docs: [ai.google.dev/gemini-api/doc…](https://ai.google.dev/gemini-api/docs/agent-credentials)
