sh-mcp/packages/payments/src/index.ts
Adam Moussa 2e16c306b0 Add in-memory dev clients; make package tool exports lazy
Add an in-memory Client implementation per integration package (seeded fake
data, no network) selected when SH_MCP_ENV=local (build-plan §4). Gmail/calendar/
tasks dev clients partition by ctx.sub; payments/qbo seed sensitive-looking
fields so the redaction egress path has real targets to mask.

Make the eager default-tool exports in tasks/reminders/qbo LAZY (getDefaultTools)
so importing a package barrel no longer constructs an AWS client at module load
(build-plan §7 'no I/O at import time') — the previous eager construction broke
server startup. Fix payments tsconfig rootDir (src, was '.') so its declarations
resolve under dist/index.d.ts like the other 8 packages.
2026-06-26 12:48:26 -04:00

45 lines
1.5 KiB
TypeScript

/**
* @sh-mcp/payments public API
*
* Exports the payments tool factory functions and the tool array builder.
* The wire transport (OpenAPI / MCP) is generated from the registry; this
* package only defines tools.
*
* Usage:
* import { makePaymentsTools } from '@sh-mcp/payments';
* import { DynamoPaymentsClient } from '@sh-mcp/payments/client';
*
* const tools = makePaymentsTools(new DynamoPaymentsClient());
* // register tools with the server registry
*/
export type { PaymentsClient, Payment, PaymentsQueryOptions } from './client.js';
export { DynamoPaymentsClient } from './client.js';
export { InMemoryPaymentsClient } from './dev-client.js';
export type {
LookupByVendorInput,
LookupByVendorOutput,
LookupByInvoiceInput,
LookupByInvoiceOutput,
LookupByCheckInput,
LookupByCheckOutput,
} from './tools.js';
export { makeLookupByVendorTool, makeLookupByInvoiceTool, makeLookupByCheckTool } from './tools.js';
import type { PaymentsClient } from './client.js';
import { makeLookupByVendorTool, makeLookupByInvoiceTool, makeLookupByCheckTool } from './tools.js';
/**
* Build the full payments tool array for a given client.
*
* @param client - A PaymentsClient implementation (real or mock).
* @returns Array of ToolDef objects ready for registration with the server.
*/
export function makePaymentsTools(client: PaymentsClient) {
return [
makeLookupByVendorTool(client),
makeLookupByInvoiceTool(client),
makeLookupByCheckTool(client),
] as const;
}