# ClipNow MCP — 其他 MCP 客户端通用接入指南

Browser page: https://clipnow.art/mcp/general
MCP Endpoint: https://api.zhiyu.art/assets/mcp

适用于 Windsurf、Cline、GitHub Copilot、Cherry Studio、OpenCode、VS Code 及任何支持 Streamable HTTP 的标准 MCP 宿主。

## 服务端点与协议总览

ClipNow MCP 遵循 MCP 2025-03-26 规范（Streamable HTTP，Stateless），任何支持标准远程 MCP 的客户端均可直接接入：

| 项目 | 方法 | 地址 / 取值 |
| --- | --- | --- |
| MCP 主端点（JSON-RPC） | POST | https://api.zhiyu.art/assets/mcp |
| 受保护资源元数据（RFC 9728） | GET | https://api.zhiyu.art/assets/.well-known/oauth-protected-resource/mcp |
| OAuth 授权服务器元数据（RFC 8414） | GET | https://api.zhiyu.art/.well-known/oauth-authorization-server |
| 动态客户端注册（RFC 7591） | POST | https://api.zhiyu.art/oauth/register |
| 浏览器授权入口 | GET | https://api.zhiyu.art/oauth/authorize |
| 换取 / 刷新令牌 | POST | https://api.zhiyu.art/oauth/token |
| PKCE 校验方式 | — | S256（唯一支持，公共客户端 token_endpoint_auth_method=none） |
| 受众绑定（RFC 8707） | — | resource=https://api.zhiyu.art/assets/mcp |

## 标准 mcp.json 配置

对于支持 OAuth 2.1 自动发现的客户端（如 Qoder、OpenCode、Windsurf 等，平台已预置 workbuddy / codebuddy / cursor / claude / qoder 及本地回环回调协议白名单），只需填入：

```json
{
  "mcpServers": {
    "clipnow": {
      "type": "streamableHttp",
      "url": "https://api.zhiyu.art/assets/mcp",
      "timeout": 60000,
      "headers": {
        "Accept": "application/json, text/event-stream"
      }
    }
  }
}
```

## 手动 OAuth 2.1 获取令牌（适用于静态 Bearer 模式）

如果你的 MCP Client 版本暂不支持自动弹出 OAuth 浏览器登录，可以通过以下 4 步在本地终端获取访问令牌（使用本地回调端口 33418，需要终端已安装 curl 与 python3）：

### 1. 动态注册 OAuth 客户端（RFC 7591）

```bash
curl -s -X POST "https://api.zhiyu.art/oauth/register" \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "mcp-client",
    "redirect_uris": ["http://127.0.0.1:33418/callback"],
    "grant_types": ["authorization_code", "refresh_token"],
    "response_types": ["code"],
    "token_endpoint_auth_method": "none",
    "scope": "clipnow:account:read clipnow:asset:read clipnow:asset:write clipnow:material:read clipnow:project:read clipnow:project:write clipnow:task:write",
    "resource": "https://api.zhiyu.art/assets/mcp"
  }'
```

记录返回 JSON 中的 client_id，用于后续步骤替换 <CLIENT_ID>。

### 2. 生成 PKCE S256 校验参数

```bash
python3 -c "
import secrets, hashlib, base64
verifier = base64.urlsafe_b64encode(secrets.token_bytes(32)).rstrip(b'=').decode()
challenge = base64.urlsafe_b64encode(hashlib.sha256(verifier.encode()).digest()).rstrip(b'=').decode()
print(f'VERIFIER={verifier}')
print(f'CHALLENGE={challenge}')
"
```

### 3. 浏览器登录知鱼账号并授权

运行下方命令，它会自动打开浏览器进入知鱼账户授权页，并在本地 33418 端口接收授权码（请将 <CLIENT_ID> 和 <CHALLENGE> 替换为上一步的值）：

```bash
python3 -c "
import http.server, socketserver, urllib.parse, webbrowser
URL = 'https://api.zhiyu.art/oauth/authorize?response_type=code&client_id=<CLIENT_ID>&code_challenge=<CHALLENGE>&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%3A33418%2Fcallback&scope=clipnow%3Aaccount%3Aread+clipnow%3Aasset%3Aread+clipnow%3Aasset%3Awrite+clipnow%3Amaterial%3Aread+clipnow%3Aproject%3Aread+clipnow%3Aproject%3Awrite+clipnow%3Atask%3Awrite&resource=https%3A%2F%2Fapi.zhiyu.art%2Fassets%2Fmcp&state=clipnow'
captured = {}
class H(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        q = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query)
        if 'code' in q:
            captured['code'] = q['code'][0]
            self.send_response(200); self.end_headers()
            self.wfile.write(b'ClipNow MCP authorized - you can close this tab.')
    def log_message(*a): pass
with socketserver.TCPServer(('127.0.0.1', 33418), H) as s:
    s.timeout = 1
    webbrowser.open(URL)
    print('Opened browser authorization page. Sign in and click Approve...')
    for _ in range(180):
        s.handle_request()
        if 'code' in captured: break
print('CODE=' + captured.get('code', '(timed out)'))
"
```

### 4. 用授权码换取 access_token

```bash
curl -s -X POST "https://api.zhiyu.art/oauth/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "code=<AUTHORIZATION_CODE>" \
  -d "redirect_uri=http://127.0.0.1:33418/callback" \
  -d "client_id=<CLIENT_ID>" \
  -d "code_verifier=<VERIFIER>" \
  -d "resource=https://api.zhiyu.art/assets/mcp"
```

返回结果中包含 access_token（有效期 1 小时）和 refresh_token（30 天有效，每次刷新轮换）。将 access_token 填入 客户端 mcp.json 配置：

```json
{
  "mcpServers": {
    "clipnow": {
      "type": "streamableHttp",
      "url": "https://api.zhiyu.art/assets/mcp",
      "headers": {
        "Accept": "application/json, text/event-stream",
        "Authorization": "Bearer <access_token>"
      }
    }
  }
}
```

## 首次调用自检与开始创作

授权完成后，建议第一个调用先跑 clipnow_doctor 与 auth_whoami（无需任何特殊 Scope 即可调用），随后发送启动提示词：

```text
ClipNow MCP 已经连接好了。请先调用 clipnow_doctor 检查连接状态与我的贝壳余额，然后向我整体介绍一下你可以做什么，尤其是这四个部分：
1. AI 生成（视频、图片、音乐、人声配音、音效、3D 模型）
2. Studio 无限画布（灵感分镜发散、多节点编排、批量生成、视频深度信息捕捉）
3. Studio 时间线剪辑（口播去水词、智能字幕、MG 动画、花字与片段模板、转场与 LUT 调色）
4. 素材与资产库（搜索知鱼商用素材库、管理我的个人与项目资产、读取音视频理解档案）
之后问我有什么素材、想做什么样的内容，告诉我你可以根据我的具体需求一步步开始制作，并且我也可以随时打开 ClipNow Studio（https://studio.clipnow.art）自己调整画布、时间线、字幕或 MG 动画。
```
