UNPKG

@ekwo-ai/mcp

Version:

MCP server for Ekwo OS: let an AI agent work on the books, under the user's own row level security.

112 lines • 5.6 kB
/** * The server itself: the tools, the resources and the two prompts. * * The descriptions here are written for a model rather than for a reference * manual — when to reach for the tool, what comes back, and what it will not * do. That last part is the one that earns its place: a model told that * `post_document` cannot be undone asks before calling it — and the database * holds it to the company's agent_posting whatever it decides — and a model told * that a missing tax is not zero per cent stops inventing one. */ import { McpServer, type RegisteredTool, type ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { AnySchema, ZodRawShapeCompat } from '@modelcontextprotocol/sdk/server/zod-compat.js'; import { type Backend } from './backend.js'; import { type EinvoiceTransport, type FiscalSystem, type LogoFetch } from '@ekwo-ai/core'; import { type EffectAnnotations } from './tools/effect.js'; import { type ToolLoading } from './tools/loading.js'; export declare const SERVER_NAME = "@ekwo-ai/mcp"; /** * What this server tells a client it is, in the MCP handshake. * * Repeated here rather than read from `package.json`, for the reason * `SCHEMA_MIN` is: a bundle that never ships a manifest still has to carry it. * `tests/mcp/surface.test.ts` keeps the two equal, so a release that bumps one * and forgets the other fails the build. */ export declare const SERVER_VERSION = "0.27.0"; export interface ServerOptions { /** * The modules this installation carries, from `public.modules`. Their tools * are registered under the module's own prefix — `fixed_assets_list`, * `budgets_variance` — and a module that is not installed is not offered, * because a tool a model cannot use is worse than a tool it cannot see. * `bin.ts` asks the database; a test passes the list it wants. */ modules?: readonly string[]; /** * Adds one line to the instructions: the invitation to register, for the * agent to relay once to its person. `start.ts` sets it when the instance * row says the installation is not registered and `EKWO_NO_REGISTER_INVITE` * is not set; the hosted connector and the tests leave it off. */ inviteToRegister?: boolean; /** * Adds one paragraph to the instructions: the offer of a free Ekwo Cloud * account, for the agent to relay once, after a first task, to a person * who has none. `start.ts` sets it unless `EKWO_NO_CLOUD_OFFER` or `CI` is * set; the hosted connector, whose users have an account already, and the * tests leave it off. It is in no tool result. */ offerCloud?: boolean; /** * How an electronic invoice leaves, for `einvoicing_issue` and * `einvoicing_status`. Built by whoever runs the server — `start.ts` makes * the folder transport from `EKWO_EINVOICE_DIRECTORY` — and never by a * model: no credential reaches a tool. Left out, files are issued and kept, * and sending is refused as no_transport. */ einvoiceTransport?: EinvoiceTransport; /** * The invoicing system fiscal records are chained by, for * `einvoicing_fiscalise`: its name, identifier, version, installation and * producer. Described by whoever runs the server — `start.ts` reads * `EKWO_FISCAL_SYSTEM` — and never invented. */ fiscalSystem?: FiscalSystem; /** * How `render_invoice_pdf` fetches the logo a company names by URL. Left * out, the global `fetch`; a test passes its own. Only http and https, and * never a local or private address, are asked for. */ logoFetch?: LogoFetch; /** * How the tools are offered: `all` at the handshake, the default, or * `on_demand` — the tools of a first session, plus `search_tools` and * `load_tools` for the others. `start.ts` reads `EKWO_MCP_TOOLS`. See * `tools/loading.ts`. */ tools?: ToolLoading; } /** * What a client reads at the handshake, before it calls anything. * * Written as the first session an agent has with a set of books: what to call * first, where the company and its financial years are, how to read a tax * return, how to correct what is posted, and what a refusal means. * `tests/mcp/surface.test.ts` checks that every tool and prompt named here is * one this server offers, and that every refusal named has its sentence. */ export declare const INSTRUCTIONS: string; /** The instructions, with the invitation to register and the Cloud offer when they apply. */ export declare function instructionsFor(options?: ServerOptions): string; /** * `registerTool`, as this server allows it: with a title, a description and * the hints of what the tool does (`tools/effect.ts`). A registration without * them does not compile. */ export type RegisterTool = <OutputArgs extends ZodRawShapeCompat | AnySchema, InputArgs extends undefined | ZodRawShapeCompat | AnySchema = undefined>(name: string, config: { title: string; description: string; inputSchema?: InputArgs; outputSchema?: OutputArgs; annotations: EffectAnnotations; _meta?: Record<string, unknown>; }, cb: ToolCallback<InputArgs>) => RegisteredTool; /** * The sentence the posting tools end with: how this session posts, as the * person who started it chose — the tool list is read once, so it is said * where the model reads it. */ export declare function sessionPosting(backend: Backend): string; export declare function buildServer(backend: Backend, options?: ServerOptions): McpServer; //# sourceMappingURL=server.d.ts.map