The manager's OAuth tests imported mcp-client's OAuth world through a relative path into another package, which the package surface rules forbid for fixtures. The OAuth world and the manager profile fixture move into the new test-support library @deepseek-ai/dsh-mcp-testkit. The MCP client and manager tests import it by name, and both packages drop the development dependencies that only the moved fixtures needed.
description, kind
| description | kind |
|---|---|
| Run MCP OAuth flows against a loopback authorization server and mount the MCP manager through a real profile in repository tests. | package-library |
@deepseek-ai/dsh-mcp-testkit
English | 中文
Summary
Use this package in tests that need a real MCP OAuth exchange or a profile-composed MCP manager. It serves a loopback OAuth authorization server and MCP endpoint, and mounts the MCP client host and the manager through a real profile, ConfigEditor, and Loader. Tests import it as a development dependency; each fixture registers its own teardown with the running test.
Table of Contents
- Use this package
- Understand the implementation
- Further Exploration
- Model Experience
- Known Limitations and Deferred Work
- Dev Note
Use this package
Add @deepseek-ai/dsh-mcp-testkit to the consuming package's devDependencies. Start an OAuth world, mount the manager on its context, and drive authorization through the manager:
import { callback, managerProfile, oauthWorld, phase } from '@deepseek-ai/dsh-mcp-testkit'
const world = await oauthWorld()
await managerProfile(world.ctx, { base: { servers: { oauth: { ...world.config, enabled: true } } } })
const attempt = await world.ctx.mcpManager.startAuthorization('oauth')
oauthWorld() returns the world's context with credential, authorization, Web server, and tool services, a Streamable HTTP configuration that uses OAuth, an authorization owner factory, and switches that change the protocol server's token, rejection, and metadata answers. phase() waits for an attempt phase, callback() delivers the browser callback, and authorize() completes one authorization through an owner. managerProfile() composes the MCP client host and the manager from an inherited bundle and an optional user patch; its context must already carry the tool services.
Understand the implementation
Implementation internals — click to expand
src/oauth-world.ts answers OAuth discovery, dynamic registration, token, and MCP requests from one loopback HTTP server and records each request. src/manager-profile.ts writes a temporary profile whose bundle inserts the host and manager entries, then mounts it through the Loader. Both register teardown through onTestFinished, so they run only inside a test.
Further Exploration
- MCP client — OAuth connections, explicit authorization, and the MCP client host.
- MCP manager — the server fleet the profile fixture mounts.
- Test-support group map — sibling test utilities.
Model Experience
None, as these fixtures serve OAuth and MCP protocol traffic without assembling or sending model requests.
KV Cache effect
None; the package itself sends no provider request.
Known Limitations and Deferred Work
- The authorization server always grants the request: it does not render consent or check the client secret, and tests change its answers through the world's switches.
- The fixtures call
onTestFinishedand therefore run only inside a Vitest test.
Dev Note
Working context for maintainers — click to expand
None.