跳转到主要内容
跳到正文

MCP 服务器

认证与权限

客户端如何证明自己代表谁:带 PKCE 和动态注册的 OAuth 2.1,或个人令牌,以及每项权限如何授予、缩小与撤销。

8 分钟阅读更新于

两种认证方式

OAuth 2.1个人令牌
适用于Claude、ChatGPT 以及任何支持远程 MCP 的客户端脚本和不支持 OAuth 的工具
凭证访问令牌 rqat_…(1 小时)和刷新令牌 rqrt_…(30 天,轮换)rqpat_…
创建方式通过授权页面在 Repliq → AI 助手中
有效期访问令牌 1 小时;只要持续刷新,连接就会保持30、90、180、365 天后(由你选择)
上限—每个账户最多 10 个有效令牌
显示—仅创建时显示一次

任一令牌都以 Authorization: Bearer <令牌> 发送到 https://repliqds.com/api/mcp。Repliq 的会话令牌(浏览器使用的那种)在此绝不会被接受,助手令牌也永远无法认证 Repliq 的其他部分。

OAuth 2.1 流程

  1. 发现

    客户端读取受保护资源和授权服务器的元数据(RFC 9728 和 RFC 8414)。没有有效令牌的请求会收到 401,并带有指向它们的 WWW-Authenticate: Bearer resource_metadata=… 响应头。

  2. 动态注册(RFC 7591)

    客户端以公开客户端身份注册一次(token_endpoint_auth_method: none,无密钥)。1 到 5 个重定向 URI:HTTPS、http 回环地址或原生应用协议;不得带片段,也不得为 javascript:、data: 或 file:。

  3. 带 PKCE 的授权

    用户被带到 Repliq 登录(适用两步验证),并看到客户端名称、返回地址、是否为已知助手以及请求的权限。必须使用 `S256` 的 PKCE。

  4. 令牌交换

    授权码有效期 5 分钟,并且只能使用一次。客户端用它和 code_verifier 换取访问令牌(1 小时)和刷新令牌(30 天)。

  5. 刷新

    每次刷新都会返回新的一对令牌,并使旧刷新令牌失效。

OAuth 流程
# 1. Discover the endpoints
curl -s https://repliqds.com/.well-known/oauth-protected-resource/api/mcp
curl -s https://repliqds.com/.well-known/oauth-authorization-server

# 2. Register a public client (once)
curl -s -X POST https://repliqds.com/api/mcp/oauth/register \
  -H "Content-Type: application/json" \
  -d '{"client_name":"My agent","redirect_uris":["http://127.0.0.1:8976/callback"]}'

# 3. Send the person to the authorization endpoint with PKCE (S256):
#    https://repliqds.com/oauth/authorize?response_type=code&client_id=rqc_…
#      &redirect_uri=…&code_challenge=…&code_challenge_method=S256
#      &scope=repliq:read%20repliq:draft&state=…

# 4. Exchange the code (valid 5 minutes, single use)
curl -s -X POST https://repliqds.com/api/mcp/oauth/token \
  -d grant_type=authorization_code -d client_id=rqc_… \
  -d code=rqac_… -d redirect_uri=… -d code_verifier=…

权限

权限使用它的工具
repliq:readlist_locations, list_reviews, get_review, get_reputation_summary, get_action_items, get_location_insights, compare_locations, get_benchmark, list_competitors, get_google_profile_performance, get_search_keywords, get_google_profile_health, list_google_posts, list_upcoming_holidays, list_review_requests, get_review_request_stats, list_reply_templates, get_reviewer_history
repliq:draftsave_reply_draft, generate_reply_draft, ask_reviews, summarize_reviews, check_review_authenticity, suggest_google_post, save_reply_template, reject_review, rewrite_reply, translate_review, search_competitors, add_competitor, remove_competitor, get_competitor_themes
repliq:publishpublish_reply, approve_reply, delete_published_reply
repliq:profilepublish_google_post, update_google_description, set_special_hours
repliq:requestssend_review_requests
  • repliq:read 始终包含:没有它,其他权限都无法使用。
  • 未请求任何权限的客户端会获得 repliq:read 和 repliq:draft。未知权限会被拒绝(invalid_scope)。
  • 在授权页面,用户可以缩小权限,但不能扩大。
  • 现有连接严格保留其被授予的权限。

个人令牌

在 Repliq → AI 助手中创建:填写标签(最多 100 个字符)、选择权限(读取为必选)和有效期。令牌只显示一次;系统只保存其 SHA-256 摘要。最多可有 10 个有效令牌,并可随时撤销任何一个。

撤销

  • 你自己:在 Repliq → AI 助手中断开连接。有效令牌几秒内失效(校验结果最多缓存 15 秒)。
  • 客户端:POST /api/mcp/oauth/revoke(RFC 7009)。
  • 自动:修改或重置密码会断开所有助手。重复使用授权码或刷新令牌会撤销整个连接。
  • 工作区成员身份:每次调用都会重新读取,所以把某人移出工作区,会立刻从其助手中移除。

有效期、规则和端点已对照 OAuth 服务器、MCP 配置和 ADR-0006 核实。

这个页面对你有帮助吗?

没有找到需要的内容?

查看常见问题,或给我们写信,我们会帮助你。

常见问题