mirror of
https://github.com/Sea-Haven-Industries/sh-mcp.git
synced 2026-10-05 09:32:04 +00:00
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
|
|
/**
|
||
|
|
* @sh-mcp/tasks — public entry point.
|
||
|
|
*
|
||
|
|
* Exports the tool definitions built against a DynamoDBTasksClient.
|
||
|
|
* The MCP server imports `tools` (the live array) and the tool factory
|
||
|
|
* `buildTaskTools` for cases where an alternate client must be injected
|
||
|
|
* (e.g. local dev, custom test harnesses).
|
||
|
|
*
|
||
|
|
* Wire transport (OpenAPI / Streamable-HTTP MCP) is generated from the tool
|
||
|
|
* registry in packages/shared; this package only defines the tools.
|
||
|
|
*/
|
||
|
|
|
||
|
|
export { buildTaskTools } from './tools.js';
|
||
|
|
export type { TasksClient, Task, CreateTaskInput, ListTasksInput, CompleteTaskInput, DeleteTaskInput } from './client.js';
|
||
|
|
export { DynamoDBTasksClient } from './client.js';
|
||
|
|
|
||
|
|
// The `tools` export is the live array used by the MCP server at runtime.
|
||
|
|
// It is constructed with the real DynamoDB client, which guard-throws in test
|
||
|
|
// environments to ensure tests always go through buildTaskTools(mockClient).
|
||
|
|
import { buildTaskTools } from './tools.js';
|
||
|
|
import { DynamoDBTasksClient } from './client.js';
|
||
|
|
|
||
|
|
// Only instantiate the real client outside of test environments.
|
||
|
|
// In test environments, tests import buildTaskTools directly and inject a mock.
|
||
|
|
const _client =
|
||
|
|
process.env['NODE_ENV'] === 'test'
|
||
|
|
? null
|
||
|
|
: new DynamoDBTasksClient();
|
||
|
|
|
||
|
|
export const tools =
|
||
|
|
_client !== null
|
||
|
|
? buildTaskTools(_client)
|
||
|
|
: ([] as unknown as ReturnType<typeof buildTaskTools>);
|