mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 05:56:53 +00:00
15 lines
601 B
TypeScript
15 lines
601 B
TypeScript
import { McpRegistry, type McpRegistryOptions } from './registry';
|
|
|
|
/**
|
|
* Builds a registry from hand-constructed `@McpController()` instances —
|
|
* no Nest app required. For test harnesses that assemble a bare `McpServer`
|
|
* (e.g. over an in-memory transport).
|
|
*/
|
|
export function createTestRegistry(instances: readonly object[], options: McpRegistryOptions = {}): McpRegistry {
|
|
const registry = new McpRegistry(options);
|
|
for (const instance of instances) registry.register(instance);
|
|
// Same fail-fast contract as McpRegistryService.onModuleInit.
|
|
registry.validate();
|
|
return registry;
|
|
}
|