@meshstream/docs-mcp 0.3.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.
@@ -30,7 +30,7 @@ AI Coding 分成两个层次:MCP 负责查事实和生成结构化集成方案
30
30
  {
31
31
  "meshstream-docs": {
32
32
  "command": "npx",
33
- "args": ["--yes", "@meshstream/docs-mcp@0.3.0"]
33
+ "args": ["--yes", "@meshstream/docs-mcp@0.4.0"]
34
34
  }
35
35
  }
36
36
  ```
@@ -102,7 +102,7 @@ Android、iOS / macOS、Windows、Flutter、React Native 和 uni-app 使用相
102
102
 
103
103
  ## 已发布工具
104
104
 
105
- 官方工具的当前版本为 `0.3.0`,包含结构化集成规划、公开计费指引和 CodeBuddy 支持:
105
+ 官方工具的当前版本为 `0.4.0`,包含结构化集成规划、公开计费指引和 CodeBuddy 支持:
106
106
 
107
107
  - [`@meshstream/agent-skills`](https://www.npmjs.com/package/@meshstream/agent-skills):将接入、排错和 P2P 验收规则安装到 Codex、Cursor 或 Claude Code 项目。
108
108
  - [`@meshstream/docs-mcp`](https://www.npmjs.com/package/@meshstream/docs-mcp):只读官方文档 MCP,不读取客户项目文件,也不执行生产操作。
@@ -110,8 +110,33 @@ Android、iOS / macOS、Windows、Flutter、React Native 和 uni-app 使用相
110
110
  在项目根目录安装编辑器规则:
111
111
 
112
112
  ```bash
113
- npx --yes @meshstream/agent-skills@0.3.0 add --ide codex
114
- npx --yes @meshstream/agent-skills@0.3.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 回退和释放证据。
115
140
  ```
116
141
 
117
142
  在支持 MCP 的编辑器配置中加入:
@@ -121,7 +146,7 @@ npx --yes @meshstream/agent-skills@0.3.0 add --ide codebuddy
121
146
  "mcpServers": {
122
147
  "meshstream-docs": {
123
148
  "command": "npx",
124
- "args": ["--yes", "@meshstream/docs-mcp@0.3.0"]
149
+ "args": ["--yes", "@meshstream/docs-mcp@0.4.0"]
125
150
  }
126
151
  }
127
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshstream/docs-mcp",
3
- "version": "0.3.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) }] };