@meshstream/docs-mcp 0.2.0 → 0.4.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.
@@ -7,7 +7,7 @@ description: 使用 Codex、Cursor 或 Claude Code,通过官方任务模板完
7
7
 
8
8
  # AI Coding
9
9
 
10
- MeshStream 的 AI Coding 资料让 AI 编辑器基于官方 SDK 文档协助完成接入。当前页面提供可直接复制的任务模板;执行结果仍以本地构建、播放和真实 P2P 互传证据为准。
10
+ MeshStream 的 AI Coding 资料让 AI 编辑器基于官方 SDK 文档协助完成接入。Web、Android、iOS / macOS、Windows、Flutter、React Native 和 uni-app 均可使用同一套 MCP 与 Skills 工作流;执行结果仍以本地构建、播放和真实 P2P 互传证据为准。
11
11
 
12
12
  ## 现在能做什么
13
13
 
@@ -30,7 +30,7 @@ AI Coding 分成两个层次:MCP 负责查事实和生成结构化集成方案
30
30
  {
31
31
  "meshstream-docs": {
32
32
  "command": "npx",
33
- "args": ["--yes", "@meshstream/docs-mcp@0.1.0"]
33
+ "args": ["--yes", "@meshstream/docs-mcp@0.4.0"]
34
34
  }
35
35
  }
36
36
  ```
@@ -41,28 +41,68 @@ AI Coding 分成两个层次:MCP 负责查事实和生成结构化集成方案
41
41
  调用 get_integration_plan,mode=from-zero,为 Vue 3 + hls.js + HLS 点播项目生成 MeshStream 最小接入方案,保留 CDN 回退,并列出真实 P2P 双端验收证据。
42
42
  ```
43
43
 
44
+ ## 平台支持
45
+
46
+ MCP 会根据 `platform`、`framework`、播放器和协议返回对应的安装、接入、高级用法和验收来源。Skills 会先识别当前项目,再选择对应平台的公开 SDK;不会把原生项目降级成 Web 示例。
47
+
48
+ | 平台 | 适用项目 | 官方接入文档 |
49
+ | --- | --- | --- |
50
+ | Web | Vue、React、原生 Web;hls.js、Shaka、dash.js | [Web 安装](./sdk/web-setup.md) · [快速接入](./sdk/web.md) |
51
+ | Android | Kotlin / Java 原生应用 | [Android 安装](./sdk/android-setup.md) · [快速接入](./sdk/android.md) |
52
+ | iOS / macOS | Swift / Objective-C、AVPlayer | [Apple 安装](./sdk/ios-setup.md) · [快速接入](./sdk/ios.md) |
53
+ | Windows | C++ / Windows 原生播放器 | [Windows 安装](./sdk/windows-setup.md) · [快速接入](./sdk/windows.md) |
54
+ | Flutter | Flutter/Dart,调用 iOS 和 Android 原生 SDK | [Flutter 安装](./sdk/flutter-setup.md) · [快速接入](./sdk/flutter.md) |
55
+ | React Native | React Native,调用 iOS 和 Android 原生 SDK | [React Native 安装](./sdk/react-native-setup.md) · [快速接入](./sdk/react-native.md) |
56
+ | uni-app | Vue 3 + UTS,自定义基座或云打包 | [uni-app 安装](./sdk/uniapp-setup.md) · [快速接入](./sdk/uniapp.md) |
57
+
58
+ 可以直接让 MCP 生成其他端方案,例如:
59
+
60
+ ```text
61
+ 调用 get_integration_plan,platform=android,framework=Kotlin,player=Media3,protocol=HLS,mode=from-zero。
62
+ 输出依赖、播放器连接、Android 回环代理配置、CDN 回退,以及两台真实 Android 设备的 P2P 上传/下载字节验收。
63
+ ```
64
+
44
65
  ## 快速开始
45
66
 
46
67
  在项目根目录打开 Codex、Cursor 或 Claude Code,先把下面的任务完整粘贴到对话框:
47
68
 
48
69
  ```text
49
- 请在当前项目中集成 MeshStream Web SDK。
70
+ 请在当前项目中集成 MeshStream SDK。
50
71
 
51
72
  执行顺序:
52
- 1. 识别项目框架、播放器、媒体协议和包管理器。
53
- 2. 阅读 MeshStream 官方 Web SDK 安装、快速接入、统计和故障排查文档。
73
+ 1. 识别目标平台、项目框架、播放器、媒体协议、包管理器和现有播放生命周期。
74
+ 2. 阅读该平台对应的 MeshStream 官方安装、快速接入、统计和故障排查文档。
54
75
  3. 使用当前公开渠道可安装的精确 SDK 版本,不猜测不存在的 API、版本或配置项。
55
- 4. 复用现有播放器,不替换源站、CDN、DRM 或业务鉴权。
56
- 5. 保留 CDN 回退,并在播放结束、切源和页面销毁时释放 MeshStream 会话。
57
- 6. 修改代码后运行项目已有的构建和测试命令。
58
- 7. 报告修改文件、实际 SDK 版本、构建结果和仍未验证的事项。
76
+ 4. 复用现有播放器,不替换源站、CDN、DRM 或业务鉴权;原生端使用对应平台的本地播放代理配置。
77
+ 5. 保留 CDN 回退,并在播放结束、切源、页面隐藏或原生控制器销毁时释放 MeshStream 会话。
78
+ 6. 修改代码后运行项目已有的构建和测试命令;移动端优先连接真实设备验证。
79
+ 7. 报告目标平台、修改文件、实际 SDK 版本、构建结果、播放结果和仍未验证的设备/网络条件。
59
80
 
60
81
  如果项目中没有可播放的媒体地址或 SDK Key,先生成需要我补充的清单,不要写入凭据。
61
82
  ```
62
83
 
84
+ ## 原生与跨端项目接入任务
85
+
86
+ Android、iOS / macOS、Windows、Flutter、React Native 和 uni-app 使用相同的任务模式,但必须读取对应平台文档并保留平台播放器生命周期:
87
+
88
+ ```text
89
+ 在当前项目中接入 MeshStream:
90
+
91
+ - 先识别平台、框架、播放器、媒体协议和现有播放控制器。
92
+ - 使用对应平台官方安装页和快速接入页中的精确公开版本。
93
+ - 原生/跨端项目保留现有播放器、DRM、ABR、源站鉴权和 CDN 回退;不要把 Web API 或 Service Worker 代码移植到原生端。
94
+ - Android、iOS / macOS 使用 SDK 返回的本地播放代理地址,并完成对应网络安全配置。
95
+ - Flutter、React Native、uni-app 只调用已发布的原生依赖,不引用本地 AAR、Pod 或内部源码路径。
96
+ - Windows 按官方 C++ 头文件、库和播放器示例接入,检查 x64 架构和关闭释放。
97
+ - 在切源、后台、播放结束和控制器销毁时释放会话与连接。
98
+ - 先运行构建和单元测试,再用真实设备或目标架构验证播放、P2P 上传/下载字节和 CDN 回退。
99
+
100
+ 输出平台、依赖版本、修改文件、构建结果、设备/系统、P2P 双端字节证据、回退结果和未执行项。
101
+ ```
102
+
63
103
  ## 已发布工具
64
104
 
65
- 官方工具的下一版为 `0.2.0`,包含结构化集成规划、公开计费指引和 CodeBuddy 支持:
105
+ 官方工具的当前版本为 `0.4.0`,包含结构化集成规划、公开计费指引和 CodeBuddy 支持:
66
106
 
67
107
  - [`@meshstream/agent-skills`](https://www.npmjs.com/package/@meshstream/agent-skills):将接入、排错和 P2P 验收规则安装到 Codex、Cursor 或 Claude Code 项目。
68
108
  - [`@meshstream/docs-mcp`](https://www.npmjs.com/package/@meshstream/docs-mcp):只读官方文档 MCP,不读取客户项目文件,也不执行生产操作。
@@ -70,8 +110,33 @@ AI Coding 分成两个层次:MCP 负责查事实和生成结构化集成方案
70
110
  在项目根目录安装编辑器规则:
71
111
 
72
112
  ```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
113
+ npx --yes @meshstream/agent-skills@0.4.0 add --ide codex
114
+ npx --yes @meshstream/agent-skills@0.4.0 add --ide codebuddy
115
+ ```
116
+
117
+ ### 四种编辑器怎么使用
118
+
119
+ 命令必须在你的业务项目根目录执行;它只写入项目级规则,不会上传代码或读取凭据。安装后重新打开项目或新建一个对话,让编辑器加载规则:
120
+
121
+ | 编辑器 | 安装命令 | 生成文件 | 使用方式 |
122
+ | --- | --- | --- | --- |
123
+ | Codex | `npx --yes @meshstream/agent-skills@0.4.0 add --ide codex` | `.codex/skills/meshstream-sdk-integration/SKILL.md` | 在项目中直接描述接入、排错或验收任务 |
124
+ | Cursor | `npx --yes @meshstream/agent-skills@0.4.0 add --ide cursor` | `.cursor/rules/meshstream-sdk-integration.mdc` | 新建 Chat,按项目规则执行;需要时在 Rules 中启用该规则 |
125
+ | Claude Code | `npx --yes @meshstream/agent-skills@0.4.0 add --ide claude` | `.claude/skills/meshstream-sdk-integration/SKILL.md` | 新建会话后直接提问,或使用 `/meshstream-sdk-integration` 调用技能 |
126
+ | CodeBuddy | `npx --yes @meshstream/agent-skills@0.4.0 add --ide codebuddy` | `.codebuddy/skills/meshstream-sdk-integration/SKILL.md` | 重启项目会话后直接提问,技能会按平台选择文档 |
127
+
128
+ 一次安装全部编辑器规则:
129
+
130
+ ```bash
131
+ npx --yes @meshstream/agent-skills@0.4.0 add --ide all --project .
132
+ ```
133
+
134
+ 已有规则不会被覆盖;确认要更新时显式加 `--force`。安装完成后可以这样开始:
135
+
136
+ ```text
137
+ 读取 MeshStream SDK integration skill。先识别当前项目是 Android + Kotlin + Media3,
138
+ 再调用 get_integration_plan 生成 from-zero 方案。不要套用 Web API;完成构建后列出真实设备的
139
+ P2P 上传/下载字节、CDN 回退和释放证据。
75
140
  ```
76
141
 
77
142
  在支持 MCP 的编辑器配置中加入:
@@ -81,7 +146,7 @@ npx --yes @meshstream/agent-skills@0.2.0 add --ide codebuddy
81
146
  "mcpServers": {
82
147
  "meshstream-docs": {
83
148
  "command": "npx",
84
- "args": ["--yes", "@meshstream/docs-mcp@0.2.0"]
149
+ "args": ["--yes", "@meshstream/docs-mcp@0.4.0"]
85
150
  }
86
151
  }
87
152
  }
@@ -155,7 +220,7 @@ Peer 数量大于零只代表连接建立。需要两个使用同一内容标识
155
220
  ## 下一步
156
221
 
157
222
  - [选择 SDK](./sdk/overview.md)
158
- - [Web SDK 安装与配置](./sdk/web-setup.md)
159
- - [Web SDK 快速接入](./sdk/web.md)
223
+ - [Web SDK 安装与配置](./sdk/web-setup.md) · [Android](./sdk/android-setup.md) · [iOS / macOS](./sdk/ios-setup.md)
224
+ - [Windows](./sdk/windows-setup.md) · [Flutter](./sdk/flutter-setup.md) · [React Native](./sdk/react-native-setup.md) · [uni-app](./sdk/uniapp-setup.md)
160
225
  - [统计与用量](./concepts/statistics.md)
161
226
  - [故障排查](./troubleshooting.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshstream/docs-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "description": "Read-only MCP server for the MeshStream official developer documentation.",
6
6
  "repository": {
package/src/catalog.mjs CHANGED
@@ -10,6 +10,79 @@ const defaultDocsRoot = existsSync(bundledDocsRoot)
10
10
  : path.join(packageRoot, "apps", "developer-site", "docs");
11
11
  const maxDocumentChars = 18_000;
12
12
 
13
+ const platformAliases = {
14
+ web: "web",
15
+ browser: "web",
16
+ android: "android",
17
+ kotlin: "android",
18
+ java: "android",
19
+ ios: "ios",
20
+ "ios/ipados": "ios",
21
+ macos: "macos",
22
+ mac: "macos",
23
+ apple: "ios",
24
+ windows: "windows",
25
+ win: "windows",
26
+ c: "windows",
27
+ cpp: "windows",
28
+ "c++": "windows",
29
+ flutter: "flutter",
30
+ dart: "flutter",
31
+ reactnative: "reactnative",
32
+ "react-native": "reactnative",
33
+ "react native": "reactnative",
34
+ uniapp: "uniapp",
35
+ "uni-app": "uniapp",
36
+ };
37
+
38
+ const platformProfiles = {
39
+ web: {
40
+ label: "Web",
41
+ capabilities: ["browser playback session", "MSE/WebRTC or Service Worker transport", "CDN fallback", "P2P statistics", "page lifecycle release"],
42
+ acceptance: "Use two browsers or browser profiles; verify Service Worker activation when using iOS Safari or direct MP4/MP3 playback.",
43
+ },
44
+ android: {
45
+ label: "Android",
46
+ capabilities: ["native playback session", "local HTTP playback proxy", "CDN fallback", "P2P statistics", "activity/background release"],
47
+ acceptance: "Use two real Android devices when possible; simulator results do not replace device or cross-network acceptance.",
48
+ },
49
+ ios: {
50
+ label: "iOS / macOS",
51
+ capabilities: ["Apple playback session", "local HTTP playback proxy", "CDN fallback", "P2P statistics", "controller/background release"],
52
+ acceptance: "Verify iOS arm64 and the required macOS architectures separately; record AVPlayer playback and both P2P byte directions.",
53
+ },
54
+ macos: {
55
+ label: "macOS",
56
+ capabilities: ["Apple playback session", "local HTTP playback proxy", "CDN fallback", "P2P statistics", "controller release"],
57
+ acceptance: "Verify the target macOS architecture and AVPlayer or host-player lifecycle; do not infer Intel support from an Apple Silicon run.",
58
+ },
59
+ windows: {
60
+ label: "Windows",
61
+ capabilities: ["C ABI playback session", "x64 native player integration", "CDN fallback", "P2P statistics", "client/session release"],
62
+ acceptance: "Verify the published x64 DLL, import library, target player, and shutdown cleanup on Windows x64.",
63
+ },
64
+ flutter: {
65
+ label: "Flutter",
66
+ capabilities: ["Dart playback session", "Android/iOS native bridge", "CDN fallback", "P2P statistics", "widget/controller release"],
67
+ acceptance: "Verify the Flutter example on real Android and iOS devices and record the Flutter package plus native SDK versions.",
68
+ },
69
+ reactnative: {
70
+ label: "React Native",
71
+ capabilities: ["JavaScript playback session", "Android/iOS native bridge", "CDN fallback", "P2P statistics", "screen/controller release"],
72
+ acceptance: "Verify the example on real Android and iOS devices and keep the npm bridge and native SDK versions pinned together.",
73
+ },
74
+ uniapp: {
75
+ label: "uni-app",
76
+ capabilities: ["UTS playback session", "Android/iOS native plugin", "CDN fallback", "P2P statistics", "page/base release"],
77
+ acceptance: "Use a custom base or cloud build on real Android and iOS devices; standard HBuilderX base alone is insufficient evidence.",
78
+ },
79
+ };
80
+
81
+ function normalizePlatform(platform = "web") {
82
+ const raw = String(platform || "web").trim().toLowerCase().replaceAll("_", " ");
83
+ return platformAliases[raw] || raw;
84
+ }
85
+
13
86
  const documentFiles = [
14
87
  "intro.md",
15
88
  "quickstart.md",
@@ -116,23 +189,27 @@ export async function getDocument(relativePath) {
116
189
 
117
190
  export async function getSdkRelease(platform = "all") {
118
191
  const overview = await getDocument("sdk/overview.md");
119
- const rows = overview.text.split("\n")
120
- .filter((line) => /^\|/.test(line) && !/^\|\s*-/.test(line))
192
+ const headingIndex = overview.text.split("\n").findIndex((line) => /原生与跨平台 SDK 版本对照|native.*cross-platform.*version/i.test(line));
193
+ const tableText = (headingIndex >= 0 ? overview.text.split("\n").slice(headingIndex + 1) : overview.text.split("\n"))
194
+ .filter((line) => !/^##\s/.test(line))
195
+ .filter((line) => /^\|/.test(line) && !/^\|\s*-/.test(line));
196
+ const rows = tableText
121
197
  .map((line) => line.split("|").slice(1, -1).map((cell) => cell.trim()))
122
- .filter((cells) => cells.length >= 4 && cells[0] !== "SDK")
198
+ .filter((cells) => cells.length >= 4 && !/^(SDK|应用|Application)/i.test(cells[0]))
123
199
  .map(([sdk, version, android, apple]) => ({ sdk, version, android, apple }));
124
200
  const normalized = String(platform || "all").trim().toLowerCase();
125
- const filtered = normalized === "all" ? rows : rows.filter((row) => row.sdk.toLowerCase().includes(normalized));
201
+ const canonical = normalized === "all" ? "all" : normalizePlatform(normalized);
202
+ const filtered = canonical === "all" ? rows : rows.filter((row) => normalizePlatform(row.sdk) === canonical || row.sdk.toLowerCase().includes(normalized));
126
203
  return {
127
204
  source: { path: overview.path, url: overview.url },
128
- platform: normalized,
205
+ platform: canonical,
129
206
  releases: filtered,
130
- note: "仅返回官网公开版本表;发布前仍需从公共渠道验证精确包、哈希和兼容性。",
207
+ note: "仅返回官网版本对照表中的公开版本;Web 和 Windows 若没有独立版本行,应继续以对应安装页和公开发行渠道为准。发布前仍需验证精确包、哈希和兼容性。",
131
208
  };
132
209
  }
133
210
 
134
211
  export async function getIntegrationGuide(platform = "web", framework = "") {
135
- const normalized = String(platform || "web").trim().toLowerCase();
212
+ const normalized = normalizePlatform(platform);
136
213
  const map = {
137
214
  web: ["sdk/web-setup.md", "sdk/web.md", "sdk/web-advanced.md"],
138
215
  android: ["sdk/android-setup.md", "sdk/android.md", "sdk/android-advanced.md"],
@@ -141,7 +218,6 @@ export async function getIntegrationGuide(platform = "web", framework = "") {
141
218
  windows: ["sdk/windows-setup.md", "sdk/windows.md", "sdk/windows-advanced.md"],
142
219
  flutter: ["sdk/flutter-setup.md", "sdk/flutter.md", "sdk/flutter-advanced.md"],
143
220
  reactnative: ["sdk/react-native-setup.md", "sdk/react-native.md", "sdk/react-native-advanced.md"],
144
- "react-native": ["sdk/react-native-setup.md", "sdk/react-native.md", "sdk/react-native-advanced.md"],
145
221
  uniapp: ["sdk/uniapp-setup.md", "sdk/uniapp.md", "sdk/uniapp-advanced.md"],
146
222
  };
147
223
  const paths = map[normalized] || map.web;
@@ -172,12 +248,11 @@ const integrationSources = {
172
248
  windows: ["sdk/windows-setup.md", "sdk/windows.md", "sdk/windows-advanced.md"],
173
249
  flutter: ["sdk/flutter-setup.md", "sdk/flutter.md", "sdk/flutter-advanced.md"],
174
250
  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
251
  uniapp: ["sdk/uniapp-setup.md", "sdk/uniapp.md", "sdk/uniapp-advanced.md"],
177
252
  };
178
253
 
179
254
  export async function getIntegrationPlan({ platform = "web", framework = "", player = "", protocol = "", scenario = "", mode = "from-zero" } = {}) {
180
- const normalizedPlatform = String(platform || "web").trim().toLowerCase();
255
+ const normalizedPlatform = normalizePlatform(platform);
181
256
  const paths = integrationSources[normalizedPlatform] || integrationSources.web;
182
257
  const guides = await Promise.all(paths.map(getDocument));
183
258
  const normalizedFramework = String(framework || "").trim();
@@ -220,6 +295,11 @@ export async function getIntegrationPlan({ platform = "web", framework = "", pla
220
295
  "只有接收端下载与发送端上传同时增长才算真实 P2P 通过",
221
296
  "停止或阻断 P2P 后验证 CDN 回退,最后验证 dispose/close 释放连接",
222
297
  ],
298
+ platformGuidance: platformProfiles[normalizedPlatform] || {
299
+ label: normalizedPlatform,
300
+ capabilities: platformProfiles.web.capabilities,
301
+ acceptance: "先确认平台是否在公开支持矩阵中,再执行对应平台验收。",
302
+ },
223
303
  sources: guides.map(({ path: sourcePath, title, url }) => ({ path: sourcePath, title, url })),
224
304
  starterPrompt: `在当前${normalizedPlatform}项目中执行${normalizedMode}任务:${normalizedScenario || "接入 MeshStream P2P 媒体加速"}。已知上下文:框架=${normalizedFramework || "待识别"},播放器=${normalizedPlayer || "待识别"},协议=${normalizedProtocol || "待识别"}。先识别并确认上下文,再按官方文档生成最小改动方案。保留现有播放器、CDN、DRM、ABR 和源站鉴权;SDK Key 只能从环境变量读取;输出修改文件、精确依赖版本、构建结果、CDN 回退和真实 P2P 双端证据。`,
225
305
  };
@@ -229,8 +309,10 @@ export function getPlatformMatrix() {
229
309
  return {
230
310
  platforms: Object.keys(integrationSources).map((platform) => ({
231
311
  platform,
312
+ label: platformProfiles[platform]?.label || platform,
232
313
  sources: integrationSources[platform].map((path) => ({ path, url: `https://meshstream.net/docs/${path.replace(/\.md$/, "")}` })),
233
- capabilities: ["playback session", "CDN fallback", "P2P statistics", "lifecycle release"],
314
+ capabilities: platformProfiles[platform]?.capabilities || [],
315
+ acceptance: platformProfiles[platform]?.acceptance,
234
316
  })),
235
317
  acceptanceRule: "Peer count or WebSocket connection alone is not P2P proof; receiver download and sender upload bytes must both increase.",
236
318
  };
package/src/server.mjs CHANGED
@@ -4,7 +4,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
4
4
  import { z } from "zod";
5
5
  import { getBillingGuidance, getDocument, getIntegrationGuide, getIntegrationPlan, getPlatformMatrix, getSdkRelease, getTroubleshootingGuide, searchDocs } from "./catalog.mjs";
6
6
 
7
- const server = new McpServer({ name: "meshstream-docs", version: "0.1.0" });
7
+ const server = new McpServer({ name: "meshstream-docs", version: "0.3.0" });
8
8
 
9
9
  function result(value) {
10
10
  return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };