@openanysi/website-quality-audit-mcp 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +50 -0
- package/LICENSE +201 -0
- package/README.md +250 -2
- package/bin/server.js +18 -0
- package/docs/README.zh-CN.md +251 -0
- package/package.json +63 -4
- package/skills/website-quality-audit/SKILL.md +28 -0
- package/skills/website-quality-audit/references/common.en.md +3 -0
- package/skills/website-quality-audit/references/common.zh.md +3 -0
- package/skills/website-quality-audit/references/evidence-brief.en.md +19 -0
- package/skills/website-quality-audit/references/evidence-brief.zh.md +19 -0
- package/skills/website-quality-audit/references/research.en.md +30 -0
- package/skills/website-quality-audit/references/research.zh.md +30 -0
- package/src/config.js +37 -0
- package/src/server.js +18 -0
- package/vertical.config.json +204 -0
- package/workflows/common.en.md +3 -0
- package/workflows/common.zh.md +3 -0
- package/workflows/evidence-brief.en.md +19 -0
- package/workflows/evidence-brief.zh.md +19 -0
- package/workflows/research.en.md +30 -0
- package/workflows/research.zh.md +30 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# website-quality-audit-mcp:网站质量与性能审计 MCP
|
|
2
|
+
|
|
3
|
+
通过 OpenAny 为 Claude、Cursor 等客户端提供网站质量与性能审计。本地 `stdio` 运行,客户端负责分析、写作与导出。
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@openanysi/website-quality-audit-mcp)
|
|
6
|
+
[](../LICENSE)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
|
|
9
|
+
[English](../README.md) | 简体中文
|
|
10
|
+
|
|
11
|
+
## 概览
|
|
12
|
+
|
|
13
|
+
本包面向网站负责人及技术 SEO 团队。研究范围包括发现站点 URL、检查单个页面、执行单页 Lighthouse 审计。
|
|
14
|
+
|
|
15
|
+
可交付的成果包括:含审计证据与范围说明的网页修复优先级简报。
|
|
16
|
+
|
|
17
|
+
**适合 / 不适合**
|
|
18
|
+
|
|
19
|
+
- **适合:**发现站点 URL,用于付费审计前选择真实 HTML 页面。
|
|
20
|
+
- **适合:**检查单个页面,用于检查页面专属技术证据。
|
|
21
|
+
- **适合:**执行单页 Lighthouse 审计,用于在明确设备背景下比较实验室性能。
|
|
22
|
+
- **适合:**仅分析用户提供的已有材料,不为写报告新增采集。
|
|
23
|
+
- **不适合:**使用工具未开放的操作或筛选,或将样本当作完整覆盖;具体范围见 FAQ。
|
|
24
|
+
|
|
25
|
+
## 目录
|
|
26
|
+
|
|
27
|
+
- [快速开始](#快速开始)
|
|
28
|
+
- [核心特性](#核心特性)
|
|
29
|
+
- [示例提示词](#示例提示词)
|
|
30
|
+
- [为什么选择本 MCP](#为什么选择本-mcp)
|
|
31
|
+
- [可以构建与交付什么](#可以构建与交付什么)
|
|
32
|
+
- [工具参考](#工具参考)
|
|
33
|
+
- [内置工作流指南](#内置工作流指南)
|
|
34
|
+
- [完整示例](#完整示例)
|
|
35
|
+
- [常见问题](#常见问题)
|
|
36
|
+
- [错误处理与重试](#错误处理与重试)
|
|
37
|
+
- [范围、数据与计费](#范围数据与计费)
|
|
38
|
+
- [开发](#开发)
|
|
39
|
+
- [关于 OpenAny](#关于-openany)
|
|
40
|
+
- [许可证](#许可证)
|
|
41
|
+
|
|
42
|
+
## 快速开始
|
|
43
|
+
|
|
44
|
+
### 前置条件
|
|
45
|
+
|
|
46
|
+
- Node.js 22+ 和支持本地 `stdio` MCP 的客户端。
|
|
47
|
+
- 数据调用需要 OpenAny Key:[API Keys](https://openany.si/dashboard/?page=api-keys)、[配置指南](https://openany.si/setup.md)、[用量和费用](https://openany.si/dashboard/?page=usage)。
|
|
48
|
+
- 三个辅助工具免 Key。
|
|
49
|
+
|
|
50
|
+
### 配置客户端
|
|
51
|
+
|
|
52
|
+
支持 `mcpServers` 的客户端可复制以下配置;其他宿主通过自身设置注册相同命令、参数和环境变量。
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"website-quality-audit-mcp": {
|
|
58
|
+
"command": "npx",
|
|
59
|
+
"args": [
|
|
60
|
+
"-y",
|
|
61
|
+
"@openanysi/website-quality-audit-mcp"
|
|
62
|
+
],
|
|
63
|
+
"env": {
|
|
64
|
+
"OPENANY_API_KEY": "YOUR_OPENANY_API_KEY"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
将 `OPENANY_API_KEY` 保存在私密客户端设置或继承环境中。仅试用辅助工具时可省略 `env`;不要将真实 Key 写入聊天或仓库。
|
|
72
|
+
|
|
73
|
+
### 验证连接
|
|
74
|
+
|
|
75
|
+
- **无 Key:**通过 `get_tool_info` 查看工具参数和价格,再通过 `get_workflow` 加载 `research`;英文指南显式传 `language: "en"`。
|
|
76
|
+
- **有 Key:**先检查目标工具,再按问题采集一个受控样本,保留来源和缺失字段。
|
|
77
|
+
|
|
78
|
+
## 核心特性
|
|
79
|
+
|
|
80
|
+
- **发现站点 URL:**通过 `list_sitemap_urls` 独立读取;输入和可用字段见工具参考。
|
|
81
|
+
- **检查单个页面:**通过 `inspect_page` 独立读取;输入和可用字段见工具参考。
|
|
82
|
+
- **执行单页 Lighthouse 审计:**通过 `run_lighthouse` 独立读取;输入和可用字段见工具参考。
|
|
83
|
+
- **保留比较口径:**记录页面 URL、审计 / 任务状态、设备 / 运行时间,缺失字段标未知。
|
|
84
|
+
- **一次一决策:**先查当前参数和费用,再决定每个请求;超时或未知状态不自动重放。
|
|
85
|
+
- **双语任务指南:**内置采集和简报指南;客户端使用自己的模型完成分析和可用的本地导出。
|
|
86
|
+
|
|
87
|
+
## 示例提示词
|
|
88
|
+
|
|
89
|
+
- “检查选定网页,对照技术检查与 Lighthouse 观察。”
|
|
90
|
+
- “发现网站链接,选择一个 HTML 页面,将技术检查与桌面 Lighthouse 审计对照。”
|
|
91
|
+
- “区分 Lighthouse 实验室结果、真实用户 Core Web Vitals 和全站覆盖。”
|
|
92
|
+
- “只使用我提供的记录,不新增数据调用。按下方证据列整理表格,标记缺失字段并提出后续核对问题。”
|
|
93
|
+
|
|
94
|
+
## 为什么选择本 MCP
|
|
95
|
+
|
|
96
|
+
| 关注点 | 处理方式 | 用户价值 |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| 发现站点 URL | 使用 `list_sitemap_urls`,按当前契约提供 `url` | 付费审计前选择真实 HTML 页面 |
|
|
99
|
+
| 检查单个页面 | 使用 `inspect_page`,按当前契约提供 `tasks` | 检查页面专属技术证据 |
|
|
100
|
+
| 执行单页 Lighthouse 审计 | 使用 `run_lighthouse`,按当前契约提供 `tasks` | 在明确设备背景下比较实验室性能 |
|
|
101
|
+
|
|
102
|
+
## 可以构建与交付什么
|
|
103
|
+
|
|
104
|
+
| 场景 | 客户端执行方式 | 交付物 |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| 发现站点 URL | 选择 `list_sitemap_urls`,按当前契约提供所需标识和输入。 | 用于付费审计前选择真实 HTML 页面的来源证据表。 |
|
|
107
|
+
| 检查单个页面 | 选择 `inspect_page`,按当前契约提供所需标识和输入。 | 用于检查页面专属技术证据的来源证据表。 |
|
|
108
|
+
| 领域比较简报 | 对齐已采集记录的对象、日期和单位,再解释差异。 | 有来源的观察、未解决差异和后续核查问题。 |
|
|
109
|
+
|
|
110
|
+
## 工具参考
|
|
111
|
+
|
|
112
|
+
共 **6 个工具**:3 个数据工具和 3 个免费辅助工具。每次数据工具调用对应一个请求,后续页面和调用由客户端控制。
|
|
113
|
+
|
|
114
|
+
### 数据工具
|
|
115
|
+
|
|
116
|
+
参数表保留英文名称及 required/optional 标记,便于与客户端 Schema 对照。
|
|
117
|
+
|
|
118
|
+
| 工具 | 参数 | 行为 | 返回数据概览 |
|
|
119
|
+
| --- | --- | --- | --- |
|
|
120
|
+
| `list_sitemap_urls` | `url` (string, required); `type` (string, optional; sitemap, all) | 发现站点 URL | `links`;字段取决于接口,部分字段可能缺失。 |
|
|
121
|
+
| `inspect_page` | `tasks` (array, required) | 检查单个页面 | `url`, `status_code`, `onpage_score`, `checks`, `meta`, `page_timing`;字段取决于接口,部分字段可能缺失。 |
|
|
122
|
+
| `run_lighthouse` | `tasks` (array, required) | 执行单页 Lighthouse 审计 | `requestedUrl`, `finalUrl`, `categories`, `audits`, `fetchTime`;字段取决于接口,部分字段可能缺失。 |
|
|
123
|
+
|
|
124
|
+
响应按原接口透传,未编造统一业务 Schema。提取字段或串联标识前先检查真实结果;可选字段可能缺失。只有参数表中存在的工具才接受输入游标。
|
|
125
|
+
|
|
126
|
+
先发现 URL,再逐页检查。tasks 数组只允许一个页面,需检查任务级状态并保留运行环境。Lighthouse 是实验室测量,不是真实用户 Core Web Vitals,也不自动审计全站。
|
|
127
|
+
|
|
128
|
+
`list_sitemap_urls` 必填 url,可选 type(sitemap/all)。检查返回链接,保持目标域名并选择 HTML 页面,不将 sitemap 文件当作页面审计。审计 tasks 必须恰好包含一个对象且提供 url;`inspect_page` 对象内可选 `enable_javascript`、`browser_preset`、`accept_language`;`run_lighthouse` 对象内可选 `for_mobile`、categories、audits、`language_code`。
|
|
129
|
+
|
|
130
|
+
#### 嵌套请求结构
|
|
131
|
+
|
|
132
|
+
字段路径表示实际嵌套位置,不应改成顶层参数。数组使用 `[]` 表示元素;必填性按所属对象判断,其他条件以当前 `get_tool_info` 为准。
|
|
133
|
+
|
|
134
|
+
**`inspect_page`** — `tasks` 数组元素数:1–1。
|
|
135
|
+
|
|
136
|
+
| 嵌套字段 | 必填性 | 类型 / 约束 |
|
|
137
|
+
| --- | --- | --- |
|
|
138
|
+
| `tasks[].accept_language` | 可选 | string / null |
|
|
139
|
+
| `tasks[].browser_preset` | 可选 | string / null |
|
|
140
|
+
| `tasks[].enable_javascript` | 可选 | boolean / null |
|
|
141
|
+
| `tasks[].url` | 所属对象内必填 | string (长度 1–…) |
|
|
142
|
+
|
|
143
|
+
**`run_lighthouse`** — `tasks` 数组元素数:1–1。
|
|
144
|
+
|
|
145
|
+
| 嵌套字段 | 必填性 | 类型 / 约束 |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `tasks[].audits` | 可选 | array / null |
|
|
148
|
+
| `tasks[].categories` | 可选 | array / null |
|
|
149
|
+
| `tasks[].for_mobile` | 可选 | boolean / null |
|
|
150
|
+
| `tasks[].language_code` | 可选 | string / null |
|
|
151
|
+
| `tasks[].url` | 所属对象内必填 | string (长度 1–…) |
|
|
152
|
+
|
|
153
|
+
### 免费辅助工具
|
|
154
|
+
|
|
155
|
+
| 工具 | 参数 | 行为 |
|
|
156
|
+
| --- | --- | --- |
|
|
157
|
+
| `get_tool_info` | 必填 `tool_name`,取数据工具名 | 查看参数、价格与限制 |
|
|
158
|
+
| `get_workflow` | 必填 `workflow`;可选 `language`,zh/en,默认 zh | 读取指南;英文传 `language: "en"` |
|
|
159
|
+
| `search_openany_capabilities` | 必填 `query`,1–256 字符;可选 `limit`,1–10,默认 5 | 查找候选能力,不执行 |
|
|
160
|
+
|
|
161
|
+
## 内置工作流指南
|
|
162
|
+
|
|
163
|
+
`get_workflow` 返回供客户端使用的说明,本身不调用数据或模型;英文指南传 `language: "en"`。
|
|
164
|
+
|
|
165
|
+
| 指南 ID | 适用任务 | 内容 |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| `research` | 选择本领域采集路径 | 核对可用工具、输入标识和采样边界。 |
|
|
168
|
+
| `evidence_brief` | 根据已有材料撰写简报 | 保留来源、比较口径、缺失信息与后续问题。 |
|
|
169
|
+
|
|
170
|
+
### 可选 companion Skill
|
|
171
|
+
|
|
172
|
+
[领域 Skill](../skills/website-quality-audit/SKILL.md) 包含相同双语指南。仅在客户端支持 Skill 时安装;不安装仍可使用 MCP 指南。
|
|
173
|
+
|
|
174
|
+
## 完整示例
|
|
175
|
+
|
|
176
|
+
**提示词:**“发现网站链接,选择一个 HTML 页面,将技术检查与桌面 Lighthouse 审计对照。”
|
|
177
|
+
|
|
178
|
+
**客户端执行方式:**
|
|
179
|
+
|
|
180
|
+
1. 加载 `research`,明确对象、范围和预算,选择实际需要的工具:`list_sitemap_urls`, `inspect_page`, `run_lighthouse`。
|
|
181
|
+
2. 通过 `get_tool_info` 核对当前 Schema 和价格。只有标识与必填字段齐全时才发起已获授权的调用;不要编造标识或自动追加页面。
|
|
182
|
+
3. 发现 URL 后选择同域 HTML 页面,再在每个审计 tasks 数组中提交恰好一页。解读发现前保留设备和运行背景,核对任务级成功状态。
|
|
183
|
+
4. 按以下列保留证据:页面 URL | 审计 / 任务状态 | 设备 / 运行时间 | 观察问题 | 证据 | 优先级假设。缺失字段标未知。
|
|
184
|
+
5. 加载 `evidence_brief`,写出有证据支持的发现与后续问题;有文件工具时再导出 Markdown / CSV。
|
|
185
|
+
|
|
186
|
+
## 常见问题
|
|
187
|
+
|
|
188
|
+
### 开始前需要确认哪些输入?
|
|
189
|
+
|
|
190
|
+
`list_sitemap_urls` 需要 `url`;`inspect_page` 需要 `tasks`;`run_lighthouse` 需要 `tasks`。先按工具表选择查询或已知记录读取;缺少标识时向用户补充,不按相似名称猜测。
|
|
191
|
+
|
|
192
|
+
### 如何比较本领域的记录?
|
|
193
|
+
|
|
194
|
+
比较前对齐页面 URL、审计 / 任务状态、设备 / 运行时间。将可比观察与未知字段分别记录,所需证据不足时明确列出后续核查项。
|
|
195
|
+
|
|
196
|
+
### 有哪些领域范围限制?
|
|
197
|
+
|
|
198
|
+
先发现 URL,再逐页检查。tasks 数组只允许一个页面,需检查任务级状态并保留运行环境。Lighthouse 是实验室测量,不是真实用户 Core Web Vitals,也不自动审计全站。
|
|
199
|
+
|
|
200
|
+
### 使用费用是多少?
|
|
201
|
+
|
|
202
|
+
Apache-2.0 软件包没有 MCP 订阅费。3 个辅助工具免费免 Key;3 个数据工具按 OpenAny 当前价格计费,调用前通过 `get_tool_info` 查看。客户端模型费用另计。
|
|
203
|
+
|
|
204
|
+
### 需要目标平台账号或 Cookie 吗?
|
|
205
|
+
|
|
206
|
+
本包的数据调用使用 `OPENANY_API_KEY`,不要求在 MCP 配置中保存个人平台账号或浏览器 Cookie。它不能借此访问未提供的私密账号数据。
|
|
207
|
+
|
|
208
|
+
### 支持哪些客户端,无 Key 能做什么?
|
|
209
|
+
|
|
210
|
+
支持标准本地 `stdio` MCP。配置 JSON 适用于采用 `mcpServers` 的宿主;其他客户端注册相同命令。无 Key 时可查看工具信息、读取指南和发现相关能力。
|
|
211
|
+
|
|
212
|
+
### 可以把缺失字段当作零,或推断全量结果吗?
|
|
213
|
+
|
|
214
|
+
不能。保留对象、来源、筛选和采样范围;缺失值标未知,结果不代表未采集到的记录。
|
|
215
|
+
|
|
216
|
+
### 谁负责报告与文件导出?
|
|
217
|
+
|
|
218
|
+
客户端 Agent 负责分析和写作,导出 Markdown / CSV 需要其文件工具。MCP 返回数据和指南,不直接生成报告。包外能力可通过 `search_openany_capabilities` 或 OpenAny 通用 MCP 查找。
|
|
219
|
+
|
|
220
|
+
### 超时或执行状态不明怎么办?
|
|
221
|
+
|
|
222
|
+
保留原请求 ID,先核查结果再决定后续调用;未收到最终结果不代表未收费,不自动重放未知请求。
|
|
223
|
+
|
|
224
|
+
## 错误处理与重试
|
|
225
|
+
|
|
226
|
+
| 执行状态 | 常见情况 | 收费情况 | 是否可重试 |
|
|
227
|
+
| --- | --- | --- | --- |
|
|
228
|
+
| 失败 | 发送前参数或凭据被拒绝 | 不收费 | 修正输入后再决定 |
|
|
229
|
+
| 成功 | 返回业务数据 | 按接口计费规则 | 不要重复提交同一请求 |
|
|
230
|
+
| 不确定 / 超时 | 未收到最终结果 | 未知 | 先核对原请求 |
|
|
231
|
+
|
|
232
|
+
## 范围、数据与计费
|
|
233
|
+
|
|
234
|
+
- **执行和计费:**逐次检查并执行;空结果也可能按所选规则收费。
|
|
235
|
+
- **采样边界:**先发现 URL,再逐页检查。tasks 数组只允许一个页面,需检查任务级状态并保留运行环境。Lighthouse 是实验室测量,不是真实用户 Core Web Vitals,也不自动审计全站。
|
|
236
|
+
- **报告规范:**区分原始数据、观察、假设与草稿;缺失事实标未知。
|
|
237
|
+
- **网络和隐私:**服务在本地运行,目录查询和业务输入会发送到 OpenAny。
|
|
238
|
+
|
|
239
|
+
## 开发
|
|
240
|
+
|
|
241
|
+
见英文 [CONTRIBUTING.md](../CONTRIBUTING.md),包含安装、验证及指南维护说明。
|
|
242
|
+
|
|
243
|
+
## 关于 OpenAny
|
|
244
|
+
|
|
245
|
+
[OpenAny](https://openany.si/) 是 B2A(Business-to-Agent)市场,提供 AI 模型、数据和业务 API、MCP 工具以及 ready-to-call Runs。一枚 Key 按调用付费,无需强制月费订阅。
|
|
246
|
+
|
|
247
|
+
使用 `search_openany_capabilities` 或连接 [OpenAny 通用 MCP](https://mcp.openany.si/) 扩展能力。
|
|
248
|
+
|
|
249
|
+
## 许可证
|
|
250
|
+
|
|
251
|
+
[Apache-2.0](../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openanysi/website-quality-audit-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Discover sitemap URLs and inspect individual pages with technical and Lighthouse audit data. Bilingual MCP guides for website owners and technical SEO teams; your client analyzes the returned evidence. Powered by OpenAny.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"bin": {
|
|
11
|
+
"website-quality-audit-mcp": "./bin/server.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"src",
|
|
16
|
+
"vertical.config.json",
|
|
17
|
+
"workflows",
|
|
18
|
+
"README.md",
|
|
19
|
+
"docs/README.zh-CN.md",
|
|
20
|
+
"CONTRIBUTING.md",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"skills"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "node --test test/*.test.mjs",
|
|
26
|
+
"check": "node scripts/check.mjs && node scripts/sync-skill.mjs --check",
|
|
27
|
+
"smoke:package": "node scripts/smoke-package.mjs",
|
|
28
|
+
"sync:skill": "node scripts/sync-skill.mjs"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"mcp",
|
|
32
|
+
"mcp-server",
|
|
33
|
+
"model-context-protocol",
|
|
34
|
+
"openany",
|
|
35
|
+
"ai-agents",
|
|
36
|
+
"website-audit",
|
|
37
|
+
"lighthouse",
|
|
38
|
+
"technical-seo",
|
|
39
|
+
"sitemap",
|
|
40
|
+
"web-performance",
|
|
41
|
+
"claude",
|
|
42
|
+
"cursor",
|
|
43
|
+
"page-audit",
|
|
44
|
+
"lighthouse-audit",
|
|
45
|
+
"page-performance",
|
|
46
|
+
"sitemap-discovery"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/siopenany/just-mcps.git",
|
|
51
|
+
"directory": "packages/website-quality-audit-mcp"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/siopenany/just-mcps/tree/main/packages/website-quality-audit-mcp#readme",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/siopenany/just-mcps/issues"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@openanysi/openany-core": "0.1.2"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@modelcontextprotocol/client": "2.4.0"
|
|
62
|
+
},
|
|
63
|
+
"readme": "# website-quality-audit-mcp: Website Quality Audit MCP\n\nMCP server to discover sitemap URLs and inspect individual pages with technical and Lighthouse audit data. Built for Claude, Cursor and other AI agents. Powered by [OpenAny](https://openany.si/).\n\n[](https://www.npmjs.com/package/@openanysi/website-quality-audit-mcp)\n[](LICENSE)\n[](https://nodejs.org/)\n\nEnglish | [简体中文](docs/README.zh-CN.md)\n\n## Overview\n\nUse this MCP to discover sitemap URLs and inspect individual pages with technical and Lighthouse audit data.\n\nDesigned for website owners and technical SEO teams, it supplies evidence your agent can turn into a prioritized page-fix brief with audit evidence and scope notes.\n\n**Best For / Not For**\n\n- **Best For:** Discover sitemap URLs to select a real HTML page before spending on an audit.\n- **Best For:** Inspect one page to inspect page-specific technical evidence.\n- **Best For:** Run one Lighthouse audit to compare laboratory performance within explicit device context.\n- **Best For:** analyzing supplied material without collecting again merely to write a report.\n- **Not For:** operations or filters absent from Tools Reference, or treating samples as complete coverage; see the scope FAQ.\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [Key Features](#key-features)\n- [Example Prompts](#example-prompts)\n- [Why website-quality-audit-mcp?](#why-website-quality-audit-mcp)\n- [What You Can Build & Deliver](#what-you-can-build--deliver)\n- [Tools Reference](#tools-reference)\n- [Built-in Workflow Guides](#built-in-workflow-guides)\n- [End-to-End Example](#end-to-end-example)\n- [FAQ](#faq)\n- [Error Handling & Retries](#error-handling--retries)\n- [Scope, Data & Billing Notes](#scope-data--billing-notes)\n- [Development](#development)\n- [About OpenAny](#about-openany)\n- [License](#license)\n\n## Quick Start\n\n### Prerequisites\n\n- Node.js 22+ and a client supporting local `stdio` MCP servers.\n- An OpenAny API key for data tools: [API Keys](https://openany.si/dashboard/?page=api-keys), [setup guide](https://openany.si/setup.md), [usage and costs](https://openany.si/dashboard/?page=usage).\n- Utility tools work without a key.\n\n### Configure Your Client\n\nFor clients using `mcpServers`, add this to private settings. Other hosts register the same command, arguments and environment through their MCP settings or CLI.\n\n```json\n{\n \"mcpServers\": {\n \"website-quality-audit-mcp\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@openanysi/website-quality-audit-mcp\"\n ],\n \"env\": {\n \"OPENANY_API_KEY\": \"YOUR_OPENANY_API_KEY\"\n }\n }\n }\n}\n```\n\nStore `OPENANY_API_KEY` in private client settings or the inherited environment. Omit `env` for utility-only use. Keep real keys out of chat and repositories.\n\n### Verify It Works\n\n- **Without an API key:** Inspect `list_sitemap_urls` with `get_tool_info`, then load `get_workflow` with `workflow: \"research\", language: \"en\"`. Explain inputs and pricing without fetching data.\n- **With an API key:** Ask the agent to inspect the relevant tool, request one scoped sample for your question, and preserve sources and missing fields in a research table.\n\n## Key Features\n\n- **Discover sitemap URLs:** use `list_sitemap_urls` as an independent operation; inspect its inputs and available fields below.\n- **Inspect one page:** use `inspect_page` as an independent operation; inspect its inputs and available fields below.\n- **Run one Lighthouse audit:** use `run_lighthouse` as an independent operation; inspect its inputs and available fields below.\n- **Comparable evidence:** retain Page URL; Audit / task status; Device / run time; mark missing fields unknown.\n- **Inspect before collection:** read current parameters and pricing before each request; uncertain outcomes are not automatically replayed.\n- **Bilingual task guidance:** collection and reporting guides support analysis and available local exports with your own client model.\n\n## Example Prompts\n\n- \"Inspect selected website pages and compare technical checks with Lighthouse observations.\"\n- \"Discover links for my website, select one HTML page, and compare its technical checks with a desktop Lighthouse audit.\"\n- \"Keep laboratory Lighthouse results separate from field Core Web Vitals and whole-site coverage.\"\n- \"Use only the records I provide. Make no new data calls. Organize the evidence columns below, mark missing fields and list follow-up questions.\"\n\n## Why website-quality-audit-mcp?\n\n| What You Care About | How We Handle It | Value to You |\n| --- | --- | --- |\n| Discover sitemap URLs | Use `list_sitemap_urls` with `url` | Select a real HTML page before spending on an audit |\n| Inspect one page | Use `inspect_page` with `tasks` | Inspect page-specific technical evidence |\n| Run one Lighthouse audit | Use `run_lighthouse` with `tasks` | Compare laboratory performance within explicit device context |\n\n## What You Can Build & Deliver\n\n| Use Case | How the Agent Runs It | Typical Deliverables |\n| --- | --- | --- |\n| Discover sitemap URLs | Choose `list_sitemap_urls` with the identifiers and inputs required by its current contract. | Sourced evidence to help select a real HTML page before spending on an audit. |\n| Inspect one page | Choose `inspect_page` with the identifiers and inputs required by its current contract. | Sourced evidence to help inspect page-specific technical evidence. |\n| Website Quality Audit brief | Align object identity, dates and units before interpreting collected records. | Sourced observations, unresolved differences and follow-up checks. |\n\n## Tools Reference\n\nThe server exposes **6 tools**: 3 data tools and 3 free keyless utilities. Each data tool maps to one request. The client decides subsequent calls and pages.\n\n### Data Tools\n\n| Tool | Parameters | Behavior | Typical Returned Fields |\n| --- | --- | --- | --- |\n| `list_sitemap_urls` | `url` (string, required); `type` (string, optional; sitemap, all) | Discover sitemap URLs | `links`; provider-dependent; optional fields may be absent. |\n| `inspect_page` | `tasks` (array, required) | Inspect one page | `url`, `status_code`, `onpage_score`, `checks`, `meta`, `page_timing`; provider-dependent; optional fields may be absent. |\n| `run_lighthouse` | `tasks` (array, required) | Run one Lighthouse audit | `requestedUrl`, `finalUrl`, `categories`, `audits`, `fetchTime`; provider-dependent; optional fields may be absent. |\n\nResponses are passed through rather than normalized into an invented common business schema. Inspect the returned payload before extracting fields or chaining identifiers. Optional fields may be missing. An input cursor is available only where listed above.\n\nDiscover URLs, then audit selected pages individually. Each tasks array contains exactly one page. Check task-level success and retain run/device context. Lighthouse is a laboratory measurement, not field Core Web Vitals or an automatic whole-site audit.\n\nEach audit `tasks` array must contain exactly one item with a non-empty `url`.\n\n`list_sitemap_urls` accepts required `url` and optional `type` (`sitemap` or `all`). Inspect returned links, keep the intended host, and select an HTML page rather than passing a sitemap file into an audit. Audit `tasks` must contain exactly one object with required `url`. `inspect_page` also accepts `enable_javascript`, `browser_preset` and `accept_language` inside that object; `run_lighthouse` accepts `for_mobile`, `categories`, `audits` and `language_code`.\n\n#### Nested Request Shapes\n\nPaths show actual nesting; do not send nested fields at the tool top level. `[]` denotes an array item. Required markers apply within the containing object; inspect `get_tool_info` for conditional alternatives.\n\n**`inspect_page`** — `tasks` array item count: 1–1\n\n| Nested field | Requirement | Type / constraints |\n| --- | --- | --- |\n| `tasks[].accept_language` | Optional | string / null |\n| `tasks[].browser_preset` | Optional | string / null |\n| `tasks[].enable_javascript` | Optional | boolean / null |\n| `tasks[].url` | Required within parent | string (length 1–…) |\n\n**`run_lighthouse`** — `tasks` array item count: 1–1\n\n| Nested field | Requirement | Type / constraints |\n| --- | --- | --- |\n| `tasks[].audits` | Optional | array / null |\n| `tasks[].categories` | Optional | array / null |\n| `tasks[].for_mobile` | Optional | boolean / null |\n| `tasks[].language_code` | Optional | string / null |\n| `tasks[].url` | Required within parent | string (length 1–…) |\n\n### Utility Tools (Free, No API Key Required)\n\n| Tool | Parameters | Behavior |\n| --- | --- | --- |\n| `get_tool_info` | Required `tool_name` from the data-tool names above | Read current parameters, pricing and limits |\n| `get_workflow` | Required `workflow`; optional `language` (`zh` or `en`, default `zh`) | Return a guide; use `language: \"en\"` for English |\n| `search_openany_capabilities` | Required `query` (1-256 characters); optional `limit` (1-10, default 5) | Search related capabilities without executing them |\n\n## Built-in Workflow Guides\n\n`get_workflow` returns instructions for your client without calling data tools or a model. Select `language: \"en\"` for English.\n\n| Guide ID | Best For | What It Provides |\n| --- | --- | --- |\n| `research` | Planning website quality audit | A tool/identifier checklist and a scoped collection method. |\n| `evidence_brief` | Reporting from collected website quality audit records | Source attribution, comparison context, missing information and follow-up questions. |\n\n### Companion Skill (Optional)\n\nThe [companion Skill](skills/website-quality-audit/SKILL.md) contains the same bilingual guides. Install it only if your client supports Skills; MCP guides work independently.\n\n## End-to-End Example\n\n**Prompt:** \"Discover links for my website, select one HTML page, and compare its technical checks with a desktop Lighthouse audit.\"\n\n**How the Agent Executes:**\n\n1. Load `research`, establish identifiers, scope and budget, and select the needed tools: `list_sitemap_urls`, `inspect_page`, `run_lighthouse`.\n2. Inspect `get_tool_info` for current schemas and pricing. Make authorized calls only with confirmed identifiers and required inputs; do not fabricate IDs or append pages automatically.\n3. Discover URLs, select a same-host HTML page, then submit exactly one page in each audit tasks array. Preserve device/run context and inspect task-level success before interpreting findings.\n4. Retain evidence using these columns: Page URL | Audit / task status | Device / run time | Observed issue | Evidence | Priority hypothesis. Mark absent fields unknown.\n5. Load `evidence_brief`, write evidence-linked findings and open questions, and export Markdown/CSV only when client file tools are available.\n\n## FAQ\n\n### Which inputs should I confirm before starting?\n\n`list_sitemap_urls` requires `url`; `inspect_page` requires `tasks`; `run_lighthouse` requires `tasks`. Choose the operation that matches the supplied query or known record; ask for missing identifiers rather than guessing from names.\n\n### How should I compare the returned records?\n\nAlign Page URL; Audit / task status; Device / run time before comparing. Keep supported observations separate from unavailable fields and list the specific follow-up evidence needed.\n\n### What are the domain-specific scope limits?\n\nDiscover URLs, then audit selected pages individually. Each tasks array contains exactly one page. Check task-level success and retain run/device context. Lighthouse is a laboratory measurement, not field Core Web Vitals or an automatic whole-site audit.\n\n### How much does this MCP cost?\n\nThe Apache-2.0 package has no MCP subscription fee. Three utilities are free and keyless; 3 data tools follow current OpenAny pricing. Inspect `get_tool_info` before calling. Client model costs are separate.\n\n### Do I need a platform account or browser cookies?\n\nData calls use `OPENANY_API_KEY`. The MCP configuration does not require a personal platform account or browser cookies, and does not grant access to unprovided private account data.\n\n### Which clients work, and what can I try without a key?\n\nUse a standard local `stdio` MCP client. The configuration JSON applies to hosts using `mcpServers`; other clients register the same command. Without a key, inspect tools, read guides and discover related capabilities.\n\n### Can I treat missing fields as zero or infer complete coverage?\n\nNo. Preserve object identity, source, filters and sample scope. Mark missing values unknown; the returned sample does not represent uncollected records.\n\n### Who writes the report and exports files?\n\nYour client agent analyzes and writes; Markdown/CSV export requires its file tools. The MCP returns data and guides rather than generating a report. Discover missing capabilities with `search_openany_capabilities` or the general OpenAny MCP.\n\n### What should I do after a timeout or uncertain result?\n\nPreserve the original request ID and inspect its outcome before another call. A missing final response does not prove that it was uncharged; do not automatically replay an uncertain request.\n\n## Error Handling & Retries\n\n| Execution State | Typical Indicators | Billed? | Safe to Retry? |\n| --- | --- | --- | --- |\n| **Failed** | Input or credential rejection before dispatch | No | After correcting the input |\n| **Succeeded** | Returned business data | According to the selected API's billing rule | Do not resubmit the same request |\n| **Uncertain / Timeout** | Final result was not received | Unknown | Check the original request first |\n\n## Scope, Data & Billing Notes\n\n- **Execution & Billing:** Each call is inspected and executed separately. Empty results may incur a charge when the selected rule applies.\n- **Sampling & Data Boundaries:** Discover URLs, then audit selected pages individually. Each tasks array contains exactly one page. Check task-level success and retain run/device context. Lighthouse is a laboratory measurement, not field Core Web Vitals or an automatic whole-site audit.\n- **Reporting Standards:** Separate source data, observations, hypotheses and drafts. Mark unavailable facts as unknown.\n- **Network & Privacy:** The server runs locally; catalog queries and business inputs are sent to OpenAny.\n\n## Development\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for setup, verification and guide maintenance.\n\n## About OpenAny\n\n[OpenAny](https://openany.si/) is a **B2A (Business-to-Agent) marketplace** for AI models, data and business APIs, tools/MCP servers and ready-to-call Runs. One OpenAny key provides pay-per-call access without a required monthly subscription.\n\nDiscover additional capabilities with `search_openany_capabilities` or connect the general [OpenAny MCP](https://mcp.openany.si/).\n\n## License\n\n[Apache-2.0](LICENSE)\n",
|
|
64
|
+
"readmeFilename": "README.md"
|
|
65
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: website-quality-audit
|
|
3
|
+
description: "Discover sitemap URLs and inspect individual pages with technical and Lighthouse audit data. Use with this MCP for sourced research and evidence briefs; it does not build servers or perform account operations."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Website Quality Audit
|
|
7
|
+
|
|
8
|
+
Use the installed `@openanysi/website-quality-audit-mcp` MCP for this task. This Skill supplies client-side research instructions; it does not install or start the server.
|
|
9
|
+
|
|
10
|
+
## Choose a guide
|
|
11
|
+
|
|
12
|
+
- Read [common rules](references/common.en.md) before collecting data, or [中文规则](references/common.zh.md).
|
|
13
|
+
- For question framing, tool selection, identifiers and sample collection, read [research](references/research.en.md) or [中文调研指南](references/research.zh.md).
|
|
14
|
+
- For a report based on existing outputs, read [evidence brief](references/evidence-brief.en.md) or [中文简报指南](references/evidence-brief.zh.md). No new data calls are required merely to write a report.
|
|
15
|
+
|
|
16
|
+
The same guides are available through `get_workflow` with `workflow: "research"` or `workflow: "evidence_brief"`; use `language: "en"` for English.
|
|
17
|
+
|
|
18
|
+
## Available data tools
|
|
19
|
+
|
|
20
|
+
- `list_sitemap_urls`: Discover sitemap URLs.
|
|
21
|
+
- `inspect_page`: Inspect one page.
|
|
22
|
+
- `run_lighthouse`: Run one Lighthouse audit.
|
|
23
|
+
|
|
24
|
+
Inspect `get_tool_info` before each chosen call and follow its actual input schema. Do not invent filters, fields, IDs, cursors or account access. Client-side analysis and supported CSV/Markdown exports use the client's own model and file tools.
|
|
25
|
+
|
|
26
|
+
## Boundaries
|
|
27
|
+
|
|
28
|
+
Keep source links, dates, sample counts and missing values. Separate observations, hypotheses and drafts. Do not infer sales, demand, demographics, safety or financial outcomes from unrelated fields. Stop after uncertain execution or billing and preserve the request ID. Use `search_openany_capabilities` or https://mcp.openany.si/ for capabilities outside this package.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Research rules
|
|
2
|
+
|
|
3
|
+
Inspect get_tool_info before every data tool. Stay within the user's budget. Each tool performs one request; the client chooses subsequent pages. Keep original links, identifiers, collection time, sample size and missing fields. Separate source data, observations, hypotheses and drafts. An empty page is not evidence of zero demand. Stop after an uncertain request; preserve its request ID and inspect the original outcome before another call. Use https://mcp.openany.si/ for unmet capabilities.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Website Quality Audit: evidence brief
|
|
2
|
+
|
|
3
|
+
Write from existing outputs of `list_sitemap_urls`, `inspect_page`, `run_lighthouse` or supplied material. Do not collect again merely to write.
|
|
4
|
+
|
|
5
|
+
## Research scope
|
|
6
|
+
|
|
7
|
+
Discover sitemap URLs and inspect individual pages with technical and Lighthouse audit data. State the user's question, the checks actually performed and the remaining coverage gaps.
|
|
8
|
+
|
|
9
|
+
## Contents
|
|
10
|
+
|
|
11
|
+
1. Identify the question, objects, sources and collection dates.
|
|
12
|
+
2. Organize records using these evidence columns: Page URL | Audit / task status | Device / run time | Observed issue | Evidence | Priority hypothesis.
|
|
13
|
+
3. Align identities and comparison context before linking observations to sources.
|
|
14
|
+
4. Separate hypotheses, counterexamples, missing fields and the specific follow-up evidence needed.
|
|
15
|
+
5. Use the client's model for original writing; export Markdown/CSV only with its file tools.
|
|
16
|
+
|
|
17
|
+
## Domain scope
|
|
18
|
+
|
|
19
|
+
Discover URLs, then audit selected pages individually. Each tasks array contains exactly one page. Check task-level success and retain run/device context. Lighthouse is a laboratory measurement, not field Core Web Vitals or an automatic whole-site audit.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# website-quality-audit-mcp:证据简报
|
|
2
|
+
|
|
3
|
+
根据 `list_sitemap_urls`, `inspect_page`, `run_lighthouse` 的已有结果或用户提供材料撰写,不为写简报新增取数。
|
|
4
|
+
|
|
5
|
+
## 研究范围
|
|
6
|
+
|
|
7
|
+
研究范围包括发现站点 URL、检查单个页面、执行单页 Lighthouse 审计。说明用户本次要解决的问题、实际执行的检查和未覆盖项。
|
|
8
|
+
|
|
9
|
+
## 内容
|
|
10
|
+
|
|
11
|
+
1. 标明问题、记录对象、来源和采集日期。
|
|
12
|
+
2. 按以下证据列整理记录:页面 URL | 审计 / 任务状态 | 设备 / 运行时间 | 观察问题 | 证据 | 优先级假设。
|
|
13
|
+
3. 对齐对象和比较口径后撰写观察,并逐项关联到来源。
|
|
14
|
+
4. 分别列出假设、反例、缺失字段及需要补充核查的信息。
|
|
15
|
+
5. 使用客户端模型完成原创写作;有文件工具时再导出 Markdown / CSV。
|
|
16
|
+
|
|
17
|
+
## 领域范围
|
|
18
|
+
|
|
19
|
+
先发现 URL,再逐页检查。tasks 数组只允许一个页面,需检查任务级状态并保留运行环境。Lighthouse 是实验室测量,不是真实用户 Core Web Vitals,也不自动审计全站。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Website Quality Audit: research guide
|
|
2
|
+
|
|
3
|
+
## Task
|
|
4
|
+
|
|
5
|
+
Discover sitemap URLs and inspect individual pages with technical and Lighthouse audit data. Select the tools and scope needed for the user's actual question.
|
|
6
|
+
|
|
7
|
+
## Method
|
|
8
|
+
|
|
9
|
+
Discover URLs, select a same-host HTML page, then submit exactly one page in each audit tasks array. Preserve device/run context and inspect task-level success before interpreting findings.
|
|
10
|
+
|
|
11
|
+
1. Establish identifiers, comparison context, sample scope and budget. Available tools: `list_sitemap_urls`, `inspect_page`, `run_lighthouse`; not every question needs all of them.
|
|
12
|
+
2. Use `get_tool_info` for current parameters, nested inputs and prices. Choose follow-up steps from actual records or user-confirmed identifiers.
|
|
13
|
+
3. Execute only needed, authorized requests. Continue with an original-query cursor only when that tool accepts it.
|
|
14
|
+
4. Check object identity, units and timing; retain source records, unknown fields and analysis separately.
|
|
15
|
+
|
|
16
|
+
## Evidence columns
|
|
17
|
+
|
|
18
|
+
Page URL | Audit / task status | Device / run time | Observed issue | Evidence | Priority hypothesis
|
|
19
|
+
|
|
20
|
+
## Deliverable
|
|
21
|
+
|
|
22
|
+
Your agent can prepare a prioritized page-fix brief with audit evidence and scope notes.
|
|
23
|
+
|
|
24
|
+
## Stop conditions
|
|
25
|
+
|
|
26
|
+
Stop on missing required inputs, mismatched identity, unaffordable cost or uncertain execution/billing. Preserve the original request ID rather than replaying an empty or uncertain result.
|
|
27
|
+
|
|
28
|
+
## Domain scope
|
|
29
|
+
|
|
30
|
+
Discover URLs, then audit selected pages individually. Each tasks array contains exactly one page. Check task-level success and retain run/device context. Lighthouse is a laboratory measurement, not field Core Web Vitals or an automatic whole-site audit.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# website-quality-audit-mcp:领域调研
|
|
2
|
+
|
|
3
|
+
## 任务
|
|
4
|
+
|
|
5
|
+
研究范围包括发现站点 URL、检查单个页面、执行单页 Lighthouse 审计。根据用户实际问题选择需要的工具和范围。
|
|
6
|
+
|
|
7
|
+
## 方法
|
|
8
|
+
|
|
9
|
+
发现 URL 后选择同域 HTML 页面,再在每个审计 tasks 数组中提交恰好一页。解读发现前保留设备和运行背景,核对任务级成功状态。
|
|
10
|
+
|
|
11
|
+
1. 先明确对象标识、比较口径、采样范围与预算,可选工具为 `list_sitemap_urls`, `inspect_page`, `run_lighthouse`,不要求每次全部调用。
|
|
12
|
+
2. 使用 `get_tool_info` 查看当前参数、嵌套输入和价格;按真实结果或用户确认的标识选择后续步骤。
|
|
13
|
+
3. 仅执行本任务需要且已获授权的请求;只有对应工具接受游标时才沿原查询的真实游标继续。
|
|
14
|
+
4. 核对对象、单位和时间背景,将来源记录、未知字段与分析分别保留。
|
|
15
|
+
|
|
16
|
+
## 证据列
|
|
17
|
+
|
|
18
|
+
页面 URL | 审计 / 任务状态 | 设备 / 运行时间 | 观察问题 | 证据 | 优先级假设
|
|
19
|
+
|
|
20
|
+
## 交付
|
|
21
|
+
|
|
22
|
+
可交付的成果包括:含审计证据与范围说明的网页修复优先级简报。
|
|
23
|
+
|
|
24
|
+
## 停止条件
|
|
25
|
+
|
|
26
|
+
缺少必填输入、对象不匹配、费用超出预算,或执行/收费状态不明时停止;保留原请求标识,不重试来掩盖空结果。
|
|
27
|
+
|
|
28
|
+
## 领域范围
|
|
29
|
+
|
|
30
|
+
先发现 URL,再逐页检查。tasks 数组只允许一个页面,需检查任务级状态并保留运行环境。Lighthouse 是实验室测量,不是真实用户 Core Web Vitals,也不自动审计全站。
|
package/src/config.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
|
|
3
|
+
export async function loadDefinition(root = new URL('../', import.meta.url)) {
|
|
4
|
+
const read = async path => {
|
|
5
|
+
const text = await readFile(new URL(path, root), 'utf8');
|
|
6
|
+
if (!text.trim()) throw new Error(`Empty bundled asset: ${path}`);
|
|
7
|
+
return text;
|
|
8
|
+
};
|
|
9
|
+
const manifest = JSON.parse(await read('package.json'));
|
|
10
|
+
const config = JSON.parse(await read('vertical.config.json'));
|
|
11
|
+
if (config.packageName !== manifest.name || !manifest.version || !config.instructions?.trim() ||
|
|
12
|
+
!Array.isArray(config.bindings) || !config.bindings.length ||
|
|
13
|
+
new Set(config.bindings.map(x => x.name)).size !== config.bindings.length ||
|
|
14
|
+
!Array.isArray(config.workflows) || !config.workflows.length) throw new Error('Invalid bundled configuration.');
|
|
15
|
+
const commonRules = {};
|
|
16
|
+
for (const language of ['zh', 'en']) {
|
|
17
|
+
const path = `workflows/common.${language}.md`;
|
|
18
|
+
if (config.commonRules?.[language] !== path) throw new Error('Invalid common guide path.');
|
|
19
|
+
commonRules[language] = await read(path);
|
|
20
|
+
}
|
|
21
|
+
const ids = new Set(), filenames = new Set(['common']), workflows = [];
|
|
22
|
+
for (const item of config.workflows) {
|
|
23
|
+
const filename = String(item.id).replaceAll('_', '-');
|
|
24
|
+
if (!/^[a-z][a-z0-9_-]{0,63}$/.test(item.id) || filenames.has(filename) || ids.has(item.id) || !item.version) throw new Error('Invalid workflow.');
|
|
25
|
+
ids.add(item.id);
|
|
26
|
+
filenames.add(filename);
|
|
27
|
+
const instructions = {};
|
|
28
|
+
for (const language of ['zh', 'en']) {
|
|
29
|
+
const path = `workflows/${filename}.${language}.md`;
|
|
30
|
+
if (item.files?.[language] !== path) throw new Error('Invalid workflow path.');
|
|
31
|
+
instructions[language] = await read(path);
|
|
32
|
+
}
|
|
33
|
+
workflows.push({ id: item.id, version: item.version, instructions });
|
|
34
|
+
}
|
|
35
|
+
return { bindings: config.bindings, workflows, commonRules, instructions: config.instructions,
|
|
36
|
+
serverInfo: { name: manifest.name, version: manifest.version } };
|
|
37
|
+
}
|
package/src/server.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createClient } from '@openanysi/openany-core';
|
|
2
|
+
import { createMcpServer, startStdioServer } from '@openanysi/openany-core/mcp';
|
|
3
|
+
import { loadDefinition } from './config.js';
|
|
4
|
+
|
|
5
|
+
export async function createServer({ clientOptions = {}, stdio = false } = {}) {
|
|
6
|
+
const { bindings, serverInfo, instructions, workflows, commonRules } = await loadDefinition();
|
|
7
|
+
const client = createClient({ ...clientOptions, bindings });
|
|
8
|
+
let server;
|
|
9
|
+
try {
|
|
10
|
+
const options = { ...serverInfo, instructions, workflows, commonRules };
|
|
11
|
+
server = stdio ? await startStdioServer(client, options) : createMcpServer(client, options);
|
|
12
|
+
} catch (error) { await client.close(); throw error; }
|
|
13
|
+
let closing;
|
|
14
|
+
const close = () => closing ??= Promise.resolve().then(async () => {
|
|
15
|
+
try { await server.close(); } finally { await client.close(); }
|
|
16
|
+
});
|
|
17
|
+
return { client, server, close };
|
|
18
|
+
}
|