Files
deepseek-harness/apps/cli/tests/profile-mcp.spec.ts
T
gengruilin 5a30774840 refactor(mcp): keep only plugin-registered servers in the MCP manager
The Settings management page this manager was built for is not shipping, and
every connector plugin registers its server. Remove what only that page used:

- mcp-manager: the volatile `servers` configuration and its write-time
  validation, stdio entries, the `enabled` flag, the `probe` operation, and the
  `mcp-manager/status` event. A registration takes a Streamable HTTP `url`, and
  a `startupTimeoutMs` setting bounds each registered server's startup.
- mcp-client: `${credential:REF}` templates (`expandTemplates`), the
  `waiting-credentials` state, `probeServer`, and the exports that existed only
  for the manager's write-time validation.

The Web profile mounts the manager without injecting credentials, and the
`mcp-template-error` snapshot goes with the templates.
2026-10-20 11:19:40 +08:00

57 lines
2.4 KiB
TypeScript

/** MCP resource and server-manager ownership across the resolved shipped profile templates. */
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { composeEntries, loadProfile, PROFILE_TEMPLATES } from '@deepseek-ai/dsh-app-boot'
const installAnchor = fileURLToPath(new URL('../package.json', import.meta.url))
const resourcePackage = '@deepseek-ai/dsh-mcp-resources'
describe('shipped MCP resource composition', () => {
it.each(Object.keys(PROFILE_TEMPLATES))('%s carries one shared resource consumer without a server', (name) => {
const home = mkdtempSync(join(tmpdir(), 'dsh-profile-mcp-'))
try {
const profile = loadProfile('dsh', name, installAnchor, home)
const warnings: string[] = []
const rows = composeEntries([
...profile.layers.map(layer => layer.patches),
profile.patches,
], message => warnings.push(message))
expect(rows.filter(row => row.name === resourcePackage)).toEqual([
{ id: 'mcp-resources', name: resourcePackage },
])
expect(rows.filter(row => row.name === '@deepseek-ai/dsh-mcp-client')).toEqual([])
expect(warnings).toEqual([])
const owners = profile.layers.filter((layer) => {
const manifest = JSON.parse(readFileSync(join(layer.packageDir, 'package.json'), 'utf8')) as {
dependencies?: Record<string, string>
}
return manifest.dependencies?.[resourcePackage] !== undefined
})
expect(owners.map(owner => owner.packageName)).toEqual([
name === 'sdk-minimal' ? '@deepseek-ai/dsh-sdk-minimal' : '@deepseek-ai/dsh-base',
])
} finally {
rmSync(home, { recursive: true, force: true })
}
})
it.each(Object.keys(PROFILE_TEMPLATES))('%s mounts the server manager only with the Web application', (name) => {
const home = mkdtempSync(join(tmpdir(), 'dsh-profile-mcp-'))
try {
const profile = loadProfile('dsh', name, installAnchor, home)
const rows = composeEntries([...profile.layers.map(layer => layer.patches), profile.patches])
expect(rows.filter(row => row.name === '@deepseek-ai/dsh-mcp-manager')).toEqual(name === 'web'
? [{ id: 'mcp-manager', name: '@deepseek-ai/dsh-mcp-manager' }]
: [])
} finally {
rmSync(home, { recursive: true, force: true })
}
})
})