import { Cli as incur_Cli, Fetch, type Openapi } from 'incur' import type { mcp } from '../apps/mcp.js' import * as Admin from './commands/admin.js' /** Tool patterns hidden from MCP clients: super admin, partner-shaped gecko mirrors, browser session flows. */ const excludedTools = ['admin_*', 'gecko_*', 'v1_auth_*'] /** Usage guidance surfaced to MCP clients on initialize (` --mcp`). */ const instructions = 'Tempo MCP provides access to the hosted Tempo API and documentation. Authenticated tools accept an `authorization` input (`Bearer `). List endpoints paginate via `cursor`/`nextCursor`. `docs_*` tools search the Tempo documentation.' /** * Creates an incur CLI backed by a hosted Tempo API, plus the super admin * commands (` admin …`) and the remote Tempo docs tools (` docs …`). */ export function from(url: string | URL, options: from.Options = {}) { const { description = 'Tempo API CLI', docs = 'https://mcp.tempo.xyz/mcp', name = 'tapimo', openapi = 'openapi.json', request, version = '0.0.0', } = options const cli = incur_Cli .create(name, { description, fetch: Fetch.fromRequest(url, request), mcp: { instructions, name: 'tempo', title: 'Tempo MCP', tools: { exclude: excludedTools }, }, openapi, openapiConfig: options.openapiConfig ?? { mode: 'namespace' }, version, }) .command(Admin.admin) if (docs !== false) cli.command('docs', { description: 'Search the Tempo documentation.', mcp: docs }) return cli } export declare namespace from { /** Options for creating a Tempo API CLI from a hosted API. */ type Options = { /** CLI description. */ description?: string | undefined /** Remote docs MCP source mounted as the `docs` command group, or `false` to omit it. @default 'https://mcp.tempo.xyz/mcp' */ docs?: mcp.Source | false | undefined /** CLI name. */ name?: string | undefined /** OpenAPI document source. Relative paths resolve from the API URL. */ openapi?: Openapi.OpenAPISource | undefined /** OpenAPI command generation configuration. Defaults to namespace mode. */ openapiConfig?: Openapi.Config | undefined /** Request options applied to API calls. */ request?: Fetch.fromRequest.Options | undefined /** CLI version. */ version?: string | undefined } }