@meshstream/docs-mcp 0.1.0 → 0.2.0
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/README.md +6 -2
- package/content/ai-coding.md +62 -1
- package/package.json +14 -4
- package/src/catalog.mjs +85 -0
- package/src/server.mjs +32 -1
package/README.md
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# MeshStream Docs MCP
|
|
2
2
|
|
|
3
|
-
只读 MCP
|
|
3
|
+
只读 MCP,数据源是官网文档 Markdown。它提供文档查询、平台集成规划和公开计费指引:
|
|
4
4
|
|
|
5
5
|
- `search_docs`
|
|
6
6
|
- `get_sdk_release`
|
|
7
7
|
- `get_integration_guide`
|
|
8
8
|
- `get_troubleshooting_guide`
|
|
9
|
+
- `get_document`
|
|
10
|
+
- `get_integration_plan`
|
|
11
|
+
- `get_billing_guidance`
|
|
12
|
+
- `get_platform_matrix`
|
|
9
13
|
|
|
10
14
|
## 本地运行
|
|
11
15
|
|
|
@@ -19,4 +23,4 @@ npm start
|
|
|
19
23
|
包内的 `content/`,独立安装后无需访问源码仓库;也可以通过 `MESHSTREAM_DOCS_ROOT`
|
|
20
24
|
指向经过版本锁定的文档快照。
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
MCP 只读官网资料,不接收 SDK Key,不访问客户项目文件,也不执行代码或生产操作。
|
package/content/ai-coding.md
CHANGED
|
@@ -9,6 +9,38 @@ description: 使用 Codex、Cursor 或 Claude Code,通过官方任务模板完
|
|
|
9
9
|
|
|
10
10
|
MeshStream 的 AI Coding 资料让 AI 编辑器基于官方 SDK 文档协助完成接入。当前页面提供可直接复制的任务模板;执行结果仍以本地构建、播放和真实 P2P 互传证据为准。
|
|
11
11
|
|
|
12
|
+
## 现在能做什么
|
|
13
|
+
|
|
14
|
+
AI Coding 分成两个层次:MCP 负责查事实和生成结构化集成方案,Skills 负责把方案落到项目工作流。它们都只读取公开文档,不读取客户代码、不接收 SDK Key,也不会替用户发布生产变更。
|
|
15
|
+
|
|
16
|
+
| 能力 | MCP | Skills |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| 文档、版本和错误码查询 | 支持,返回来源链接 | 支持,要求 AI 先查官方文档 |
|
|
19
|
+
| 按平台、框架、播放器生成接入计划 | `get_integration_plan` | 支持从项目代码识别上下文 |
|
|
20
|
+
| 跑官方 Demo / 从零接入 | 返回步骤和验收清单 | 支持 Codex、Cursor、Claude Code、CodeBuddy |
|
|
21
|
+
| 功能扩展和故障排查 | 返回公开规则 | 保留现有播放器并执行最小改动 |
|
|
22
|
+
| 套餐、配额和用量规则 | `get_billing_guidance` | 引导到公开价格页和控制台 |
|
|
23
|
+
| 平台能力与验收边界 | `get_platform_matrix` | 按平台选择安装、示例和验证范围 |
|
|
24
|
+
|
|
25
|
+
### 配置 MCP
|
|
26
|
+
|
|
27
|
+
在支持 MCP 的编辑器中,把下面这一项加入已有的 `mcpServers`,不要覆盖其他服务:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"meshstream-docs": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["--yes", "@meshstream/docs-mcp@0.1.0"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
配置后可以直接提问:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
调用 get_integration_plan,mode=from-zero,为 Vue 3 + hls.js + HLS 点播项目生成 MeshStream 最小接入方案,保留 CDN 回退,并列出真实 P2P 双端验收证据。
|
|
42
|
+
```
|
|
43
|
+
|
|
12
44
|
## 快速开始
|
|
13
45
|
|
|
14
46
|
在项目根目录打开 Codex、Cursor 或 Claude Code,先把下面的任务完整粘贴到对话框:
|
|
@@ -28,8 +60,37 @@ MeshStream 的 AI Coding 资料让 AI 编辑器基于官方 SDK 文档协助完
|
|
|
28
60
|
如果项目中没有可播放的媒体地址或 SDK Key,先生成需要我补充的清单,不要写入凭据。
|
|
29
61
|
```
|
|
30
62
|
|
|
63
|
+
## 已发布工具
|
|
64
|
+
|
|
65
|
+
官方工具的下一版为 `0.2.0`,包含结构化集成规划、公开计费指引和 CodeBuddy 支持:
|
|
66
|
+
|
|
67
|
+
- [`@meshstream/agent-skills`](https://www.npmjs.com/package/@meshstream/agent-skills):将接入、排错和 P2P 验收规则安装到 Codex、Cursor 或 Claude Code 项目。
|
|
68
|
+
- [`@meshstream/docs-mcp`](https://www.npmjs.com/package/@meshstream/docs-mcp):只读官方文档 MCP,不读取客户项目文件,也不执行生产操作。
|
|
69
|
+
|
|
70
|
+
在项目根目录安装编辑器规则:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx --yes @meshstream/agent-skills@0.2.0 add --ide codex
|
|
74
|
+
npx --yes @meshstream/agent-skills@0.2.0 add --ide codebuddy
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
在支持 MCP 的编辑器配置中加入:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"meshstream-docs": {
|
|
83
|
+
"command": "npx",
|
|
84
|
+
"args": ["--yes", "@meshstream/docs-mcp@0.2.0"]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
31
90
|
## Web 播放项目接入任务
|
|
32
91
|
|
|
92
|
+
除了从零接入,还可以要求 AI 执行 `demo`、`troubleshooting`、`feature-extension` 或 `docs` 模式。每种模式都必须输出实际运行证据,不能只生成代码就宣称完成。
|
|
93
|
+
|
|
33
94
|
对于 Vue、React 或原生 Web 项目,可以继续使用这段任务。它要求 AI 保持现有播放器控制权,并验证 P2P 失败时播放仍能继续:
|
|
34
95
|
|
|
35
96
|
```text
|
|
@@ -89,7 +150,7 @@ Peer 数量大于零只代表连接建立。需要两个使用同一内容标识
|
|
|
89
150
|
- SDK Key 放在本地环境变量或受限的运行时配置中,不提交仓库。
|
|
90
151
|
- 签名播放地址、Authorization、Cookie、SecretKey 和生产日志不要粘贴到 AI 对话中。
|
|
91
152
|
- AI 生成的代码必须经过构建、播放、真实互传、CDN 回退和释放验证后才能上线。
|
|
92
|
-
-
|
|
153
|
+
- 工具源码和发行记录见 [MeshStream AI Tools](https://github.com/Mesh-Stream/meshstream-ai-tools)。
|
|
93
154
|
|
|
94
155
|
## 下一步
|
|
95
156
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshstream/docs-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Read-only MCP server for the MeshStream official developer documentation.",
|
|
6
|
-
"repository": {
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Mesh-Stream/meshstream-ai-tools.git",
|
|
9
|
+
"directory": "packages/docs-mcp"
|
|
10
|
+
},
|
|
7
11
|
"homepage": "https://meshstream.net/docs/ai-coding",
|
|
8
12
|
"type": "module",
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"content",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
11
21
|
"scripts": {
|
|
12
22
|
"prepack": "node scripts/sync-content.mjs",
|
|
13
23
|
"start": "node src/server.mjs",
|
package/src/catalog.mjs
CHANGED
|
@@ -14,6 +14,7 @@ const documentFiles = [
|
|
|
14
14
|
"intro.md",
|
|
15
15
|
"quickstart.md",
|
|
16
16
|
"ai-coding.md",
|
|
17
|
+
"billing/usage.md",
|
|
17
18
|
"best-practices.md",
|
|
18
19
|
"troubleshooting.md",
|
|
19
20
|
"concepts/p2p.md",
|
|
@@ -162,3 +163,87 @@ export async function getTroubleshootingGuide(query = "") {
|
|
|
162
163
|
related: matches,
|
|
163
164
|
};
|
|
164
165
|
}
|
|
166
|
+
|
|
167
|
+
const integrationSources = {
|
|
168
|
+
web: ["sdk/web-setup.md", "sdk/web.md", "sdk/web-advanced.md"],
|
|
169
|
+
android: ["sdk/android-setup.md", "sdk/android.md", "sdk/android-advanced.md"],
|
|
170
|
+
ios: ["sdk/ios-setup.md", "sdk/ios.md", "sdk/ios-advanced.md"],
|
|
171
|
+
macos: ["sdk/ios-setup.md", "sdk/ios.md", "sdk/ios-advanced.md"],
|
|
172
|
+
windows: ["sdk/windows-setup.md", "sdk/windows.md", "sdk/windows-advanced.md"],
|
|
173
|
+
flutter: ["sdk/flutter-setup.md", "sdk/flutter.md", "sdk/flutter-advanced.md"],
|
|
174
|
+
reactnative: ["sdk/react-native-setup.md", "sdk/react-native.md", "sdk/react-native-advanced.md"],
|
|
175
|
+
"react-native": ["sdk/react-native-setup.md", "sdk/react-native.md", "sdk/react-native-advanced.md"],
|
|
176
|
+
uniapp: ["sdk/uniapp-setup.md", "sdk/uniapp.md", "sdk/uniapp-advanced.md"],
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export async function getIntegrationPlan({ platform = "web", framework = "", player = "", protocol = "", scenario = "", mode = "from-zero" } = {}) {
|
|
180
|
+
const normalizedPlatform = String(platform || "web").trim().toLowerCase();
|
|
181
|
+
const paths = integrationSources[normalizedPlatform] || integrationSources.web;
|
|
182
|
+
const guides = await Promise.all(paths.map(getDocument));
|
|
183
|
+
const normalizedFramework = String(framework || "").trim();
|
|
184
|
+
const normalizedPlayer = String(player || "").trim();
|
|
185
|
+
const normalizedProtocol = String(protocol || "").trim().toUpperCase();
|
|
186
|
+
const normalizedScenario = String(scenario || "").trim();
|
|
187
|
+
const normalizedMode = String(mode || "from-zero").trim().toLowerCase();
|
|
188
|
+
const assumptions = [];
|
|
189
|
+
if (!normalizedFramework) assumptions.push("从项目依赖和入口文件识别框架");
|
|
190
|
+
if (!normalizedPlayer) assumptions.push("保留现有播放器,由 AI 根据项目代码识别播放器");
|
|
191
|
+
if (!normalizedProtocol) assumptions.push("从媒体地址和播放器配置识别 HLS、DASH 或直链协议");
|
|
192
|
+
return {
|
|
193
|
+
request: {
|
|
194
|
+
platform: normalizedPlatform,
|
|
195
|
+
framework: normalizedFramework || undefined,
|
|
196
|
+
player: normalizedPlayer || undefined,
|
|
197
|
+
protocol: normalizedProtocol || undefined,
|
|
198
|
+
scenario: normalizedScenario || undefined,
|
|
199
|
+
},
|
|
200
|
+
assumptions,
|
|
201
|
+
plan: [
|
|
202
|
+
"扫描项目入口、播放器、媒体协议、包管理器和现有鉴权,不覆盖业务代码",
|
|
203
|
+
"安装并锁定公开 SDK 版本,从环境变量读取 SDK Key",
|
|
204
|
+
"创建播放会话,把 SDK 返回的 playbackUrl 交给现有播放器",
|
|
205
|
+
"保留 CDN 回退、ABR、DRM、源站请求头和原有播放器生命周期",
|
|
206
|
+
"在切源、页面隐藏、播放结束和销毁时释放会话与连接",
|
|
207
|
+
"运行项目构建和测试,并输出修改文件、版本和未完成验收项",
|
|
208
|
+
],
|
|
209
|
+
mode: normalizedMode,
|
|
210
|
+
modeSteps: {
|
|
211
|
+
"from-zero": ["确认 SDK 与播放器边界", "生成最小播放接入", "执行构建、播放和双端 P2P 验收"],
|
|
212
|
+
demo: ["定位对应平台的公开示例", "只配置本地环境变量和测试媒体", "运行示例并记录播放、P2P、回退和释放结果"],
|
|
213
|
+
troubleshooting: ["复现并收集错误码和时间线", "检查 Key、bootstrap、Tracker、ICE、分片命中和回退", "给出证据、修复动作和复测命令"],
|
|
214
|
+
"feature-extension": ["读取当前集成和生命周期", "只修改实现目标功能所需的文件", "补齐针对功能的测试和回退验收"],
|
|
215
|
+
docs: ["先用公开文档和版本表回答", "每个结论附来源 URL", "不确定时明确标记未知,不编造 API"],
|
|
216
|
+
}[normalizedMode] || ["先确认任务模式", "按官方平台文档生成方案", "输出构建和验收证据"],
|
|
217
|
+
p2pAcceptance: [
|
|
218
|
+
"使用相同 contentId、内容和清晰度启动发送端与接收端",
|
|
219
|
+
"记录首个 Peer、首个 P2P 字节、P2P 下载、P2P 上传、CDN 字节和 rebuffer",
|
|
220
|
+
"只有接收端下载与发送端上传同时增长才算真实 P2P 通过",
|
|
221
|
+
"停止或阻断 P2P 后验证 CDN 回退,最后验证 dispose/close 释放连接",
|
|
222
|
+
],
|
|
223
|
+
sources: guides.map(({ path: sourcePath, title, url }) => ({ path: sourcePath, title, url })),
|
|
224
|
+
starterPrompt: `在当前${normalizedPlatform}项目中执行${normalizedMode}任务:${normalizedScenario || "接入 MeshStream P2P 媒体加速"}。已知上下文:框架=${normalizedFramework || "待识别"},播放器=${normalizedPlayer || "待识别"},协议=${normalizedProtocol || "待识别"}。先识别并确认上下文,再按官方文档生成最小改动方案。保留现有播放器、CDN、DRM、ABR 和源站鉴权;SDK Key 只能从环境变量读取;输出修改文件、精确依赖版本、构建结果、CDN 回退和真实 P2P 双端证据。`,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function getPlatformMatrix() {
|
|
229
|
+
return {
|
|
230
|
+
platforms: Object.keys(integrationSources).map((platform) => ({
|
|
231
|
+
platform,
|
|
232
|
+
sources: integrationSources[platform].map((path) => ({ path, url: `https://meshstream.net/docs/${path.replace(/\.md$/, "")}` })),
|
|
233
|
+
capabilities: ["playback session", "CDN fallback", "P2P statistics", "lifecycle release"],
|
|
234
|
+
})),
|
|
235
|
+
acceptanceRule: "Peer count or WebSocket connection alone is not P2P proof; receiver download and sender upload bytes must both increase.",
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export async function getBillingGuidance(query = "") {
|
|
240
|
+
const usage = await getDocument("billing/usage.md");
|
|
241
|
+
const matches = query ? await searchDocs(query, 5) : [];
|
|
242
|
+
return {
|
|
243
|
+
source: { path: usage.path, title: usage.title, url: usage.url },
|
|
244
|
+
pricingUrl: "https://meshstream.net/pricing",
|
|
245
|
+
guidance: usage.text,
|
|
246
|
+
related: matches,
|
|
247
|
+
note: "套餐、额度和用量只返回公开规则;实时余额、订单和支付状态请在控制台查看。",
|
|
248
|
+
};
|
|
249
|
+
}
|
package/src/server.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { getIntegrationGuide, getSdkRelease, getTroubleshootingGuide, searchDocs } from "./catalog.mjs";
|
|
5
|
+
import { getBillingGuidance, getDocument, getIntegrationGuide, getIntegrationPlan, getPlatformMatrix, getSdkRelease, getTroubleshootingGuide, searchDocs } from "./catalog.mjs";
|
|
6
6
|
|
|
7
7
|
const server = new McpServer({ name: "meshstream-docs", version: "0.1.0" });
|
|
8
8
|
|
|
@@ -40,4 +40,35 @@ server.registerTool("get_troubleshooting_guide", {
|
|
|
40
40
|
},
|
|
41
41
|
}, async ({ query }) => result(await getTroubleshootingGuide(query)));
|
|
42
42
|
|
|
43
|
+
server.registerTool("get_document", {
|
|
44
|
+
description: "Read one public MeshStream documentation page by its relative path. Read-only.",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
path: z.string().min(1).describe("Relative path such as sdk/web.md or billing/usage.md"),
|
|
47
|
+
},
|
|
48
|
+
}, async ({ path }) => result(await getDocument(path)));
|
|
49
|
+
|
|
50
|
+
server.registerTool("get_integration_plan", {
|
|
51
|
+
description: "Create a structured, platform-aware MeshStream integration and P2P acceptance plan. Read-only; it does not edit customer files or use credentials.",
|
|
52
|
+
inputSchema: {
|
|
53
|
+
platform: z.string().optional().describe("web, android, ios, macos, windows, flutter, react-native, or uniapp"),
|
|
54
|
+
framework: z.string().optional().describe("Framework such as Vue, React, Flutter, or native"),
|
|
55
|
+
player: z.string().optional().describe("Existing media player such as hls.js, Shaka, Media3, or AVPlayer"),
|
|
56
|
+
protocol: z.string().optional().describe("HLS, DASH, MP4, or another actual media protocol"),
|
|
57
|
+
scenario: z.string().optional().describe("Scenario such as live playback, VOD, or add CDN fallback"),
|
|
58
|
+
mode: z.enum(["from-zero", "demo", "troubleshooting", "feature-extension", "docs"]).optional().describe("Task mode"),
|
|
59
|
+
},
|
|
60
|
+
}, async (args) => result(await getIntegrationPlan(args)));
|
|
61
|
+
|
|
62
|
+
server.registerTool("get_platform_matrix", {
|
|
63
|
+
description: "Return the supported MeshStream platform matrix and shared acceptance rules. Read-only.",
|
|
64
|
+
inputSchema: {},
|
|
65
|
+
}, async () => result(getPlatformMatrix()));
|
|
66
|
+
|
|
67
|
+
server.registerTool("get_billing_guidance", {
|
|
68
|
+
description: "Explain public MeshStream quota and plan rules and point to the pricing page. Read-only; it does not access account balance or place orders.",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
query: z.string().optional().describe("Optional billing or quota question"),
|
|
71
|
+
},
|
|
72
|
+
}, async ({ query }) => result(await getBillingGuidance(query)));
|
|
73
|
+
|
|
43
74
|
await server.connect(new StdioServerTransport());
|