Qoder 支持通过 DeepLink 添加 MCP Server

Deeplinks 允许用户通过简单的 URL 与他人分享 AI Chat 提示词、Quest 任务、规则和 MCP 服务器配置。当您点击深链时,IDE 会打开并显示确认对话框,展示即将添加的内容。在您审核并确认前,深链不会自动执行任何操作。

URL 格式

复制代码
{scheme}://{host}/{path}?{parameters}

可用的深链类型

创建智能会话

/chat分享可直接用于聊天的提示词。点击聊天深链后,IDE 会打开并在聊天输入框中预填充指定内容。

URL 格式

复制代码
qoder://aicoding.aicoding-deeplink/chat?text={prompt}&mode={mode}

参数说明

示例

复制代码
qoder://aicoding.aicoding-deeplink/chat?text=%E5%B8%AE%E6%88%91%E9%87%8D%E6%9E%84%E8%BF%99%E6%AE%B5%E4%BB%A3%E7%A0%81&mode=agent

生成链接代码

  • TypeScript

    function generateChatDeeplink(text: string, mode?: 'agent' | 'ask'): string {
    if (!text) {
    throw new Error('缺少必需参数: text');
    }

    const url = new URL('qoder://aicoding.aicoding-deeplink/chat');
    url.searchParams.set('text', text);
    if (mode) {
    url.searchParams.set('mode', mode);
    }

    复制代码
    return url.toString();

    }

    // 示例
    const deeplink = generateChatDeeplink('帮我重构这段代码以提升性能', 'agent');
    console.log(deeplink);
    // qoder://aicoding.aicoding-deeplink/chat?text=%E5%B8%AE%E6%88%91...&mode=agent

  • Python

    from urllib.parse import urlencode

    def generate_chat_deeplink(text: str, mode: str = None) -> str:
    if not text:
    raise ValueError('缺少必需参数: text')

    复制代码
      params = {'text': text}
      if mode:
          params['mode'] = mode
          
      return f"qoder://aicoding.aicoding-deeplink/chat?{urlencode(params)}"

    示例

    deeplink = generate_chat_deeplink('帮我重构这段代码以提升性能', 'agent')
    print(deeplink)

创建 Quest 任务

/quest分享 Quest 任务,让 AI 自主完成复杂的开发任务。Quest 模式允许 AI 规划、执行并迭代任务,最大限度减少人工干预。

URL 格式

复制代码
qoder://aicoding.aicoding-deeplink/quest?text={description}&agentClass={agentClass}

参数说明

执行模式

示例

复制代码
qoder://aicoding.aicoding-deeplink/quest?text=%E5%AE%9E%E7%8E%B0JWT%E7%94%A8%E6%88%B7%E8%AE%A4%E8%AF%81&agentClass=LocalWorktree

生成链接代码

  • TypeScript

    type AgentClass = 'LocalAgent' | 'LocalWorktree' | 'RemoteAgent';

    function generateQuestDeeplink(text: string, agentClass?: AgentClass): string {
    if (!text) {
    throw new Error('缺少必需参数: text');
    }

    复制代码
    const url = new URL('qoder://aicoding.aicoding-deeplink/quest');
    url.searchParams.set('text', text);
    if (agentClass) {
      url.searchParams.set('agentClass', agentClass);
    }
    
    return url.toString();

    }

    // 示例
    const deeplink = generateQuestDeeplink('实现基于 JWT 的用户认证系统', 'LocalWorktree');
    console.log(deeplink);

  • Python

    from urllib.parse import urlencode

    def generate_quest_deeplink(text: str, agent_class: str = None) -> str:
    if not text:
    raise ValueError('缺少必需参数: text')

    复制代码
      params = {'text': text}
      if agent_class:
          params['agentClass'] = agent_class
          
      return f"qoder://aicoding.aicoding-deeplink/quest?{urlencode(params)}"

    示例

    deeplink = generate_quest_deeplink('实现基于 JWT 的用户认证系统', 'LocalWorktree')
    print(deeplink

示例

deeplink = generate_quest_deeplink('实现基于 JWT 的用户认证系统', 'LocalWorktree')print(deeplink)

创建规则

/rule分享规则来指导 AI 行为。规则可以定义代码规范、项目约定或 AI 响应的特定指令。

URL 格式

复制代码
qoder://aicoding.aicoding-deeplink/rule?name={ruleName}&text={ruleContent}

参数说明

示例

复制代码
qoder://aicoding.aicoding-deeplink/rule?name=typescript-conventions&text=%E5%A7%8B%E7%BB%88%E4%BD%BF%E7%94%A8%E4%B8%A5%E6%A0%BC%E7%9A%84TypeScript%E7%B1%BB%E5%9E%8B

生成链接代码

  • TypeScript

    function generateRuleDeeplink(name: string, text: string): string {
    if (!name || !text) {
    throw new Error('缺少必需参数: name 和 text');
    }

    复制代码
    const url = new URL('qoder://aicoding.aicoding-deeplink/rule');
    url.searchParams.set('name', name);
    url.searchParams.set('text', text);
    
    return url.toString();

    }

    // 示例
    const deeplink = generateRuleDeeplink(
    'typescript-conventions',
    始终使用严格的 TypeScript 类型。 避免使用 'any' 类型。 对象类型优先使用 interface 而非 type。
    );
    console.log(deeplink);

  • Python

    from urllib.parse import urlencode

    def generate_rule_deeplink(name: str, text: str) -> str:
    if not name or not text:
    raise ValueError('缺少必需参数: name 和 text')

    复制代码
      params = {'name': name, 'text': text}
      return f"qoder://aicoding.aicoding-deeplink/rule?{urlencode(params)}"

    示例

    deeplink = generate_rule_deeplink(
    'typescript-conventions',
    """始终使用严格的 TypeScript 类型。
    避免使用 'any' 类型。
    对象类型优先使用 interface 而非 type。"""
    )
    print(deeplink)

添加 MCP 服务器

/mcp/add分享 MCP (Model Context Protocol) 服务器配置。MCP 服务器通过提供额外的工具和上下文来源来扩展 AI 能力。

URL 格式

复制代码
qoder://aicoding.aicoding-deeplink/mcp/add?name={serverName}&cnotallow={base64EncodedConfig}

参数说明

注意:配置必须包含 command 或 url 其中之一。

示例

复制代码
qoder://aicoding.aicoding-deeplink/mcp/add?name=postgres&cnotallow=JTdCJTIyY29tbWFuZCUyMiUzQSUyMm5weCUyMiUyQyUyMmFyZ3MlMjIlM0ElNUIlMjIteSUyMiUyQyUyMiU0MG1vZGVsY29udGV4dHByb3RvY29sJTJGc2VydmVyLXBvc3RncmVzJTIyJTJDJTIycG9zdGdyZXNxbCUzQSUyRiUyRmxvY2FsaG9zdCUyRm15ZGIlMjIlNUQlN0Q%3D

生成链接代码MCP server JSON 配置编码流程:

  1. 创建配置 JSON 对象
  2. 使用 JSON.stringify() 序列化
  3. 使用 encodeURIComponent() 进行 URL 编码
  4. 使用 btoa() 进行 Base64 编码
  5. 使用 encodeURIComponent() 对结果进行 URL 编码
  • TypeScript

    interface McpServerConfig {
    command?: string;
    args?: string[];
    url?: string;
    env?: Record<string, string>;
    }

    function generateMcpAddDeeplink(name: string, config: McpServerConfig): string {
    if (!name) {
    throw new Error('缺少必需参数: name');
    }
    if (!config) {
    throw new Error('缺少必需参数: config');
    }
    if (!config.command && !config.url) {
    throw new Error('配置必须包含 "command" 或 "url"');
    }

    复制代码
    const configJson = JSON.stringify(config);
    const base64Config = btoa(encodeURIComponent(configJson));
    const encodedName = encodeURIComponent(name);
    const encodedConfig = encodeURIComponent(base64Config);
    
    return `qoder://aicoding.aicoding-deeplink/mcp/add?name=${encodedName}&cnotallow=${encodedConfig}`;

    }

    // 示例 1: PostgreSQL MCP 服务器
    const postgresDeeplink = generateMcpAddDeeplink('postgres', {
    command: 'npx',
    args: ['-y', '@modelcontextprotocol/server-postgres', 'postgresql://localhost/mydb']
    });
    console.log(postgresDeeplink);

    // 示例 2: 带环境变量的 GitHub MCP 服务器
    const githubDeeplink = generateMcpAddDeeplink('github', {
    command: 'npx',
    args: ['-y', '@modelcontextprotocol/server-github'],
    env: { GITHUB_PERSONAL_ACCESS_TOKEN: '<YOUR_TOKEN>' }
    });
    console.log(githubDeeplink);

    // 示例 3: 基于 HTTP 的 MCP 服务器
    const httpDeeplink = generateMcpAddDeeplink('custom-server', {
    url: 'https://mcp.example.com/sse'
    });
    console.log(httpDeeplink);

  • Python

    import json
    import base64
    from urllib.parse import quote

    def generate_mcp_add_deeplink(name: str, config: dict) -> str:
    if not name:
    raise ValueError('缺少必需参数: name')
    if not config:
    raise ValueError('缺少必需参数: config')
    if 'command' not in config and 'url' not in config:
    raise ValueError('配置必须包含 "command" 或 "url"')

    复制代码
      config_json = json.dumps(config)
      config_encoded = quote(config_json)
      config_base64 = base64.b64encode(config_encoded.encode()).decode()
      encoded_name = quote(name)
      encoded_config = quote(config_base64)
      
      return f"qoder://aicoding.aicoding-deeplink/mcp/add?name={encoded_name}&cnotallow={encoded_config}"

    示例 1: PostgreSQL MCP 服务器

    postgres_deeplink = generate_mcp_add_deeplink('postgres', {
    'command': 'npx',
    'args': ['-y', '@modelcontextprotocol/server-postgres', 'postgresql://localhost/mydb']
    })
    print(postgres_deeplink)

    示例 2: 带环境变量的 GitHub MCP 服务器

    github_deeplink = generate_mcp_add_deeplink('github', {
    'command': 'npx',
    'args': ['-y', '@modelcontextprotocol/server-github'],
    'env': { 'GITHUB_PERSONAL_ACCESS_TOKEN': '<YOUR_TOKEN>' }
    })
    print(github_deeplink)

安全注意事项

重要提示:在分享或点击深链前,请务必审核内容。

  • 不要包含敏感数据:不要在深链中嵌入 API 密钥、密码或专有代码
  • 验证来源:只点击来自可信来源的深链
  • 确认前仔细审核:IDE 始终会显示确认对话框,请在继续前仔细审核内容
  • 不会自动执行:深链永远不会自动执行,始终需要用户确认

常见问题排查

URL 长度限制深链 URL 不应超过 8,000 个字符。对于较长的内容,可以考虑:

  • 精简提示词或规则内容
  • 使用外部引用替代内联内容
  • 拆分为多个深链

详细内容,可以关注产品文档介绍:​​https://docs.qoder.com/zh/user-guide/deeplink​

关注我,掌握Qoder最新动态

相关推荐
hkNaruto13 小时前
【AI】AI学习笔记:MCP协议与gRPC、OpenAPI的差异
人工智能·笔记·学习
狮子座明仔13 小时前
SimpleMem:让AI智能体拥有“过目不忘“的高效记忆系统
人工智能·microsoft
roamingcode13 小时前
超越 Context Window:为何文件系统是 AI Agent 的终极记忆体
人工智能·agent·cursor·claude code·上下文工程·skill 技能
笨鸟笃行13 小时前
0基础小白使用ai能力将本地跑的小应用上云(作为个人记录)
人工智能·学习
低调小一14 小时前
AI 时代旧敏捷开发的核心矛盾与系统困境
人工智能·敏捷流程
红目香薰14 小时前
GitCode-我的运气的可量化方案-更新v5版本
人工智能·开源·文心一言·gitcode
草莓熊Lotso14 小时前
脉脉独家【AI创作者xAMA】|当豆包手机遭遇“全网封杀”:AI学会操作手机,我们的饭碗还保得住吗?
运维·开发语言·人工智能·智能手机·脉脉
C7211BA14 小时前
通义灵码和Qoder的差异
大数据·人工智能
杜子不疼.14 小时前
脉脉AI创作者活动:聊聊AI时代技术人的真实出路
人工智能