mcpField
C
Concierge Agent Protocol

Concierge Agent Protocol

本地服务
conciergeprotocol.orgAI 与智能体01 天前更新

关于 Concierge Agent Protocol

Concierge Agent Protocol 提供公司与外部 Agent 沟通的前门协议及 JavaScript 包,适用于构建公司问答入口或调用该入口的客户端。它将客户端、MCP 工具、服务端和基于模型的 Agent 组合为独立组件。

主要功能

  1. 01客户端发现并询问公司入口
  2. 02支持连续提问与登录
  3. 03服务端管理对话线程和消息上限
  4. 04通过 llms.txt 与 MCP 工具构建回答函数

适用场景

  1. 01让访客询问公司的产品与服务
  2. 02为 MCP 客户端提供公司问答工具
  3. 03为现有机器人接入公司前门
  4. 04检查入口配置及回复隔离

MCP 相关

@conciergeprotocol/mcp 将客户端封装为 cap_discover、cap_ask 和 cap_check 三个 MCP 工具。公司发布 agent.txt 作为入口,MCP 服务(如有)留在入口之后。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"conciergeprotocol": {
"command": "npx",
"args": [
"-y",
"@conciergeprotocol/mcp"
],
"env": {
"CAP_FROM": "<CAP_FROM>"
}
}
}
}
启动命令npx -y @conciergeprotocol/mcp
需要配置的环境变量
CAP_FROMCaller identity, like agent:my-assistant. Defaults to agent:cap-mcp.

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@conciergeprotocol/mcp0.1.6

工具

3

收录的工具列表 · 更新于 1 周前

参数类型必填说明
domainstring是公司域名,例如 cosmicjs.com

详细介绍

JavaScript 版 Concierge Agent Protocol

为 CAP 前门两端提供的包。@conciergeprotocol/client 用于访问前门。@conciergeprotocol/mcp 将该客户端作为三个工具公开,让 Claude、Cursor 和其他 MCP 主机能够向公司提问。@conciergeprotocol/server 使用一个 answer 函数运行前门。@conciergeprotocol/agent 根据模型、llms.txt 文件和 MCP 工具构建此函数。

协议见 conciergeprotocol.org。公司会发布 agent.txt,但不会为访客发布 MCP 服务。如果有 MCP 服务,它会留在前门后面。

安装

npm install @conciergeprotocol/client

MCP 服务是一个命令。请先安装,或像下面的代码块中那样使用 npx 运行。

npm install @conciergeprotocol/mcp

客户端

import { createClient } from '@conciergeprotocol/client'

const cap = createClient({ from: 'agent:my-assistant' })

const answer = await cap.ask('example.com', 'Do you have a free plan?')
console.log(answer.reply)

后续提问只需发送新问题:

const thread = cap.thread('example.com')
await thread.ask('What do you sell?')
const price = await thread.ask('How much is the cheapest paid plan?')

如果网站没有前门,discover 会返回 null。遇到同样的情况,ask 会抛出 NoDoorError,此时应改为浏览网站。

ask 最多等待两分钟。如果公司仍在作答,消息会带有 status: 'working',且没有 reply。可再次调用 get 读取消息。

账户相关问题使用 login。客户端会打开公司的页面,而 finishLogin 会保存令牌,供下一次 ask 使用。令牌会保存在传递给 createClient 的令牌存储中。

MCP

Cursor、Claude Desktop 和 VS Code 使用相同的代码块。在 VS Code 中,将其放入 .vscode/mcp.json;在 Cursor 和 Claude Desktop 中,将其放入 MCP 设置文件。

{
  "mcpServers": {
    "cap": {
      "command": "npx",
      "args": ["-y", "@conciergeprotocol/mcp"],
      "env": { "CAP_FROM": "agent:my-assistant" }
    }
  }
}

CAP_FROM 默认值为 agent:cap-mcp。这些工具分别是 cap_discover、cap_ask 和 cap_check。该服务在 MCP 注册表中的条目为 io.github.conciergeprotocol/mcp。cap_ask 会等待 60 秒。如果公司仍在作答,它会返回消息 ID,模型会改为调用 cap_check,而不是猜测答案。

运行前门

answer 是公司自己的函数。服务会维护对话线程,防止一个调用者看到另一个调用者的回复,并执行每日消息上限。

import { createAnswer } from '@conciergeprotocol/agent'
import { createCapServer } from '@conciergeprotocol/server'

const answer = await createAnswer({
  model: 'anthropic/claude-sonnet-4.5',
  instructions: 'You answer for Harbor Goods. Link to the page.',
  sources: [{ type: 'llms', url: 'https://harborgoods.example/llms.txt' }],
})

const cap = await createCapServer({
  agent: { name: 'Harbor Goods', chat: 'https://harborgoods.example/chat' },
  answer,
})

await cap.listen(8088)

已经有机器人的公司可以跳过 agent 包,传入自己的 answer。npx cap-check http://127.0.0.1:8088 会读取 agent.txt、提问一次,并检查第二个调用者是否无法读取该回复。

发布

添加 changeset,然后合并到 main:

bun run changeset

Package Checks 会在每次推送时运行。在 main 上通过检查后,发布工作流会创建版本拉取请求,或发布这两个包并为版本打标签。这两个包使用相同的版本。npm 发布成功后,同一工作流会将该服务列入 MCP 注册表。仓库需要配置 NPM_TOKEN 密钥。

许可证

Apache 2.0

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。