From f64d96f5e49dbae2d0fbc34a87394272b4680f27 Mon Sep 17 00:00:00 2001 From: newbie Date: Fri, 13 Nov 2026 11:17:38 +0800 Subject: [PATCH] feat(mcp): drop the embedded MCP marketplace panel (host catalog answers 405) (0.9.6) --- client/index.js | 77 +++----------------------------------- docs/management-surface.md | 6 +-- lib/index.js | 2 +- lib/mnemon/index.js | 2 +- package.json | 2 +- src/index.ts | 2 +- src/mnemon/index.ts | 2 +- verify-card-render.mjs | 1 + verify-full-load.mjs | 2 +- verify-upgrade.mjs | 2 +- 10 files changed, 16 insertions(+), 82 deletions(-) diff --git a/client/index.js b/client/index.js index 9e436ca..92a99ca 100644 --- a/client/index.js +++ b/client/index.js @@ -982,77 +982,11 @@ window.__ModuleLoader__.load({ ) } - // ---- P4: MCP market / custom connection / edit / scope / policy ------- - function McpMarketSection(props) { - var tuple = React.useState({ status: 'loading', items: [], keyword: '', busy: '', notice: null, credValue: '' }) - var s = tuple[0] - var set = tuple[1] - function patch(next) { set(function (prev) { return Object.assign({}, prev, next) }) } - React.useEffect(function () { load() }, []) - function load() { - patch({ status: 'loading' }) - bridgeCall('catalog', { keyword: s.keyword }).then(function (res) { - if (res.status === 200 && res.body !== null && res.body.ok === true) { - var items = res.body.detail !== undefined && Array.isArray(res.body.detail.items) ? res.body.detail.items : [] - patch({ status: 'ready', items: items }) - } else { - patch({ status: 'error', notice: { tone: 'bad', text: '读取 MCP 市场失败:' + bridgeMessage(res) } }) - } - }) - } - function connect(item) { - var credential = item.authMode === 'bearer' || item.authMode === 'api-key' - var method = credential ? 'configure' : 'connect' - var params = { connectorId: item.id } - if (credential) { - if (String(s.credValue).trim() === '') { patch({ notice: { tone: 'warn', text: '请先填写凭据。' } }); return } - if (item.authMode === 'api-key') params.apiKeyValue = String(s.credValue).trim() - else params.bearerToken = String(s.credValue).trim() - } - patch({ busy: item.id, notice: null }) - bridgeCall(method, params).then(function (res) { - var ok = res.status === 200 && res.body !== null && res.body.ok === true - patch({ busy: '', notice: ok ? { tone: 'ok', text: (item.name || item.id) + ':' + bridgeMessage(res) } : { tone: 'bad', text: (item.name || item.id) + ':' + bridgeMessage(res) } }) - if (typeof props.onChanged === 'function') props.onChanged() - }) - } - var rows = s.items.map(function (item) { - var connected = Array.isArray(item.connected) ? item.connected.length : 0 - var credential = item.authMode === 'bearer' || item.authMode === 'api-key' - return h('div', { key: item.id, style: styles.row }, - h('div', { style: styles.rowHead }, - h('span', { style: styles.rowTitle }, String(item.name || item.id)), - h('div', { style: styles.pills }, - h(Pill, { label: '分类', value: String(item.category || '—'), tone: 'muted' }), - h(Pill, { label: '鉴权', value: String(item.authMode || 'none'), tone: 'muted' }), - connected > 0 ? h(Pill, { label: '已连接', value: connected, tone: 'ok' }) : null, - h(Pill, { label: '状态', value: String(item.connectionLabel || item.connectionState || '未连接'), tone: connected > 0 ? 'ok' : 'muted' }), - ), - ), - h('p', { style: styles.hint }, String(item.summary || item.description || '')), - credential - ? h('div', { style: { display: 'flex', gap: '8px', alignItems: 'flex-end', flexWrap: 'wrap', marginTop: '6px' } }, - h('div', { style: { flex: '1 1 200px', minWidth: 0 } }, h(Field, { label: '凭据(' + String(item.authMode) + ',只保存到宿主)', type: 'password', value: s.credValue, placeholder: String(item.credentialPlaceholder || '填入 ' + String(item.authMode) + ' 凭据'), onChange: function (value) { patch({ credValue: value }) } })), - h(Btn, { variant: 'primary', label: s.busy === item.id ? '连接中…' : '配置并连接', disabled: s.busy !== '', onClick: function () { connect(item) } }), - ) - : h('div', { style: styles.actions }, h(Btn, { variant: 'primary', label: s.busy === item.id ? '连接中…' : (String(item.authMode) === 'oauth2-pkce' ? '授权并连接(浏览器)' : '连接'), disabled: s.busy !== '', onClick: function () { connect(item) } })), - ) - }) - return h(Section, { - title: 'MCP 市场', - hint: '目录来自宿主 dsh-mcp-connector 的公开接口;条目、示例与远端文本均为不可信内容。凭据只写宿主,本卡不回显。', - aside: h(Btn, { label: '刷新目录', variant: 'small', disabled: s.busy !== '', onClick: load }), - }, - h('div', { style: { display: 'flex', gap: '8px', alignItems: 'flex-end', flexWrap: 'wrap' } }, - h('div', { style: { flex: '1 1 220px', minWidth: 0 } }, h(Field, { label: '搜索目录', value: s.keyword, placeholder: '关键词 / 分类', onChange: function (value) { patch({ keyword: value }) } })), - h(Btn, { label: '搜索', disabled: s.status === 'loading', onClick: load }), - ), - s.notice === null ? null : h(Banner, { tone: s.notice.tone }, s.notice.text), - s.status === 'loading' ? h('p', { style: styles.hint }, '正在读取目录…') : null, - s.status === 'ready' && s.items.length === 0 ? h('p', { style: styles.hint }, '目录没有匹配条目。') : null, - h('div', { style: { display: 'flex', flexDirection: 'column', gap: '10px' } }, rows), - ) - } + // ---- P4: custom connection / edit / scope / policy --------------------- + // The MCP marketplace section was removed in 0.9.6: the host's `catalog` + // method answers 405 on current dsh-mcp-connector builds, so the card only + // rendered an error banner. Discover/install stays in the host's own + // plugin market instead of a broken embedded panel. function McpCustomSection(props) { var tuple = React.useState({ transport: 'streamable-http', name: '', serverName: '', url: '', command: '', args: '', cwd: '', authMode: 'none', bearerToken: '', apiKeyHeader: 'X-Api-Key', apiKeyValue: '', importJson: '', busy: '', notice: null }) @@ -3365,7 +3299,6 @@ window.__ModuleLoader__.load({ : null, ), - h(McpMarketSection, { onChanged: probeMcp }), h(McpCustomSection, { onChanged: probeMcp }), h(McpConfigSection, { items: items, onChanged: probeMcp }), ) diff --git a/docs/management-surface.md b/docs/management-surface.md index 8ca64ce..f09b5b8 100644 --- a/docs/management-surface.md +++ b/docs/management-surface.md @@ -74,7 +74,7 @@ POST /mcp-connector/api { "method": "status" | "healthCheck" | "toolsList" | " - 技能市场:无经验证来源,`features.skillsMarketplace=false`。 - 云端同步冲突的交互式处理(保留本地/采用云端/手动合并):仍由现有引擎按原策略暂停冲突项,界面只读展示。 - 自动更新与版本回退:未实现(无来源清单与制品基线)。 -- MCP 市场的内嵌浏览与安装:未实现,只给宿主面板位置。 +- MCP 市场的内嵌浏览与安装:**0.9.6 起从卡片移除**(宿主 `catalog` 返回 405,只留错误条没有意义),目录浏览回到宿主插件市场。 - 跨软件(Codex / Claude Code / OpenCode)适配与工作区级作用域:未实现,仍在方案 P0/P4 调研项。 - 浏览器端实机验收(375/574/1280 宽、深色模式、真实上报):需要重启 DSH 后由用户在界面确认。 @@ -199,8 +199,8 @@ refreshCatalog, toolsList, toolSearch, toolExplorer, toolDetail` | 区块 | 能力 | |---|---| -| 我的连接 | 读取连接(名称/传输/鉴权/启用/状态/注入方式/范围/健康时间/最近错误)、健康检查、工具缓存、启停、重连、两段式移除 | -| MCP 市场 | `catalog` 目录浏览与搜索;无认证直接 `connect`;OAuth 走浏览器授权 `connect`;bearer / api-key 通过 `configure` 填凭据(只写宿主,不回显) | +| 我的连接 | 搜索(名称/key/传输/鉴权/状态/最近错误)、状态筛选、多选与全选、批量健康检查/启用/停用/重连/两段式批量移除;单条连接的读取、健康检查、工具缓存、启停、重连、两段式移除 | +| ~~MCP 市场~~ | **0.9.6 已删除**:宿主的 `catalog` 方法在当前 dsh-mcp-connector 上返回 `HTTP 405`,内嵌面板只能显示错误条。目录浏览与安装回到宿主自己的插件市场,本卡不再渲染该区块 | | 新增 / 导入 | 自定义 Streamable HTTP 与 stdio 连接(显示实际启动命令,云端不执行)、`importJson` 批量导入 | | 配置编辑 | `editableConnectionConfig` 读取(敏感值以 `` 保留标记返回),`reconfigureConnection` 保存;空输入不清除已有密钥 | | 范围 | `previewConnectionScope` → `applyConnectionScope`,带 `expectedRevision`,`mode=move`,凭据不复制 | diff --git a/lib/index.js b/lib/index.js index bfa7474..3faf73a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -26,7 +26,7 @@ export const name = 'dsh-brain'; /** Services required before `apply` runs. */ export const inject = ['webServer']; /** Version reported by the status card. */ -const VERSION = '0.9.5'; +const VERSION = '0.9.6'; /** How often the skill directory is reconciled with the cloud center. */ const SKILL_SYNC_INTERVAL_MS = 15 * 60_000; /** How often queued reports are retried. */ diff --git a/lib/mnemon/index.js b/lib/mnemon/index.js index 02de124..55a76bc 100644 --- a/lib/mnemon/index.js +++ b/lib/mnemon/index.js @@ -17,7 +17,7 @@ import { descriptor } from "./descriptor.js"; import { LongMemoryProvider } from "./driver.js"; export { LongMemoryProvider, descriptor }; /** Keep in sync with the package version (asserted by the verify script). */ -const PROVIDER_VERSION = '0.9.5'; +const PROVIDER_VERSION = '0.9.6'; export const definition = defineMemorySpaceProviderDefinition({ manifest: { apiVersion: MEMORY_SPACE_PROVIDER_API_VERSION, diff --git a/package.json b/package.json index 8e51248..87dda56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-brain", - "version": "0.9.5", + "version": "0.9.6", "description": "Cloud memory for DSH: report one activity turn per conversation round and expose memory_search / memory_read / memory_add tools against a LongMemory cloud endpoint.", "type": "module", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index da2a94b..4e7d9cf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,7 +30,7 @@ export const name = 'dsh-brain' export const inject = ['webServer'] /** Version reported by the status card. */ -const VERSION = '0.9.5' +const VERSION = '0.9.6' /** How often the skill directory is reconciled with the cloud center. */ const SKILL_SYNC_INTERVAL_MS = 15 * 60_000 diff --git a/src/mnemon/index.ts b/src/mnemon/index.ts index 32b5e34..53d3711 100644 --- a/src/mnemon/index.ts +++ b/src/mnemon/index.ts @@ -23,7 +23,7 @@ import { LongMemoryProvider } from './driver.ts' export { LongMemoryProvider, descriptor } /** Keep in sync with the package version (asserted by the verify script). */ -const PROVIDER_VERSION = '0.9.5' +const PROVIDER_VERSION = '0.9.6' export const definition = defineMemorySpaceProviderDefinition({ manifest: { diff --git a/verify-card-render.mjs b/verify-card-render.mjs index 65d4095..b8976b3 100644 --- a/verify-card-render.mjs +++ b/verify-card-render.mjs @@ -517,6 +517,7 @@ check('the MCP list has search, filters and select-all', const mcpChosen = await drive('mcp', true, '全选匹配结果(1)') check('selecting all matched connections reveals the batch removal confirm', mcpChosen.includes('批量移除…') && mcpChosen.includes('批量停用')) +check('the removed MCP marketplace panel no longer renders', !mcpText.includes('MCP 市场') && !mcpText.includes('读取 MCP 市场失败')) const missing = await drive('mcp', false) check('a missing bridge becomes a stated capability gap', missing.includes('MCP 管理当前不可用') && missing.includes('MCP 服务器配置')) diff --git a/verify-full-load.mjs b/verify-full-load.mjs index 25a149d..929f0e9 100644 --- a/verify-full-load.mjs +++ b/verify-full-load.mjs @@ -57,7 +57,7 @@ async function post(path, body) { } const caps = await get('/dsh-brain/capabilities') -check('capabilities answers with 0.9.5', caps.body?.version === '0.9.5', String(caps.body?.version)) +check('capabilities answers with 0.9.6', caps.body?.version === '0.9.6', String(caps.body?.version)) check('P3 market is advertised with one provider', caps.body?.features?.skillsMarketplace === true && caps.body?.features?.marketProviders === 1) check('P3 update and sync-resolve are advertised', caps.body?.features?.skillUpdate === true && caps.body?.features?.syncResolve === true) check('P4/P5/v1.1 flags are advertised', caps.body?.features?.multiClient === true && caps.body?.features?.brainMigration === 'ready') diff --git a/verify-upgrade.mjs b/verify-upgrade.mjs index 584de12..b131eac 100644 --- a/verify-upgrade.mjs +++ b/verify-upgrade.mjs @@ -74,7 +74,7 @@ for (const name of readdirSync(libDir)) { } check('no personal domain remains in shipped lib/', leaked.length === 0, leaked.join(',')) const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8')) -check('package version is the delivery version', pkg.version === '0.9.5', pkg.version) +check('package version is the delivery version', pkg.version === '0.9.6', pkg.version) const passed = results.filter((r) => r.ok).length console.log(`\n${passed}/${results.length} passed`)