@ekwo-ai/mcp 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -43
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +18 -7
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/postgrest.d.ts.map +1 -1
- package/dist/postgrest.js +14 -0
- package/dist/postgrest.js.map +1 -1
- package/dist/schema.d.ts +38 -7
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +44 -9
- package/dist/schema.js.map +1 -1
- package/dist/server.d.ts +17 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +104 -23
- package/dist/server.js.map +1 -1
- package/dist/start.d.ts.map +1 -1
- package/dist/start.js +8 -5
- package/dist/start.js.map +1 -1
- package/dist/tools/modules.d.ts.map +1 -1
- package/dist/tools/modules.js +12 -8
- package/dist/tools/modules.js.map +1 -1
- package/dist/tools/read.d.ts +30 -1
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +127 -37
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/write.d.ts +45 -1
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +95 -4
- package/dist/tools/write.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# @ekwo-ai/mcp
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
the
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Let an AI agent run your company in your own Postgres: read the ledger, raise
|
|
4
|
+
an invoice, post it, match a payment, prepare the VAT return — **as you**,
|
|
5
|
+
under the row level security of your own installation. This is the
|
|
6
|
+
[Model Context Protocol](https://modelcontextprotocol.io) server for
|
|
7
|
+
[Ekwo OS](https://github.com/Ekwo-ai/ekwo-os).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
You reach the same server in two ways.
|
|
10
10
|
|
|
11
11
|
## Hosted, at `https://mcp.ekwo.ai/mcp`
|
|
12
12
|
|
|
13
|
-
For a client that adds remote servers
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
For a client that adds remote servers by URL — claude.ai, or any other that
|
|
14
|
+
speaks **Streamable HTTP**. You install nothing, and no password or key goes
|
|
15
|
+
into a configuration file.
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
https://mcp.ekwo.ai/mcp
|
|
@@ -54,12 +54,11 @@ same environment: `"command": "ekwo", "args": ["mcp"]`.
|
|
|
54
54
|
|
|
55
55
|
## What it is, and what it is not
|
|
56
56
|
|
|
57
|
-
The server
|
|
58
|
-
or is handed their access token, and
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
decide, and this server reports what they answered.
|
|
57
|
+
The server acts with exactly the rights of the person using it. It signs in as
|
|
58
|
+
that person, or is handed their access token, and can then do what they can
|
|
59
|
+
do: a viewer reads and cannot write, a member of one company cannot see
|
|
60
|
+
another, a locked period refuses a posting. The policies and the triggers in
|
|
61
|
+
the schema decide, and this server reports what they answered.
|
|
63
62
|
|
|
64
63
|
Three things it will never do:
|
|
65
64
|
|
|
@@ -71,9 +70,9 @@ Three things it will never do:
|
|
|
71
70
|
undone the one way its country allows — back to draft where nothing about it
|
|
72
71
|
has left, otherwise by the credit note that names it — and an entry keyed by
|
|
73
72
|
hand by its reversal.
|
|
74
|
-
- **Use a `service_role` key.**
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
- **Use a `service_role` key.** Such a key bypasses every policy, so the agent
|
|
74
|
+
would answer for companies its user was never invited to. The server
|
|
75
|
+
refuses to start with one.
|
|
77
76
|
|
|
78
77
|
## Configuration
|
|
79
78
|
|
|
@@ -116,11 +115,10 @@ for tests.
|
|
|
116
115
|
}
|
|
117
116
|
```
|
|
118
117
|
|
|
119
|
-
`EKWO_ACT_AS_USER_ID` is **required
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
query runs inside a transaction that sets `request.jwt.claims` to that user
|
|
118
|
+
`EKWO_ACT_AS_USER_ID` is **required**: it keeps the policies in force on a
|
|
119
|
+
direct connection. On its own, a database connection has no user —
|
|
120
|
+
`auth.uid()` is null and row level security is bypassed. So every query runs
|
|
121
|
+
inside a transaction that sets `request.jwt.claims` to that user
|
|
124
122
|
and switches to the `authenticated` role, and the policies bind exactly as
|
|
125
123
|
they do over the API. This mode needs the `postgres` package installed
|
|
126
124
|
alongside the server; the recommended route needs no driver at all.
|
|
@@ -150,9 +148,9 @@ variables to set and where. It connects nowhere until then, and it offers the
|
|
|
150
148
|
tools of the socle only: which modules an installation carries is read from
|
|
151
149
|
its database.
|
|
152
150
|
|
|
153
|
-
|
|
154
|
-
`EKWO_ACT_AS_USER_ID` that is not a uuid are values somebody wrote, and
|
|
155
|
-
server still refuses to start with them.
|
|
151
|
+
The server accepts missing values only. A `service_role` key, in either slot,
|
|
152
|
+
and an `EKWO_ACT_AS_USER_ID` that is not a uuid are values somebody wrote, and
|
|
153
|
+
the server still refuses to start with them.
|
|
156
154
|
|
|
157
155
|
```sh
|
|
158
156
|
npm run build -w @ekwo-ai/mcp
|
|
@@ -172,8 +170,8 @@ with no session id and nothing kept — so it runs on a function platform,
|
|
|
172
170
|
behind a load balancer, or in one process. A `GET` is answered `405`: this
|
|
173
171
|
server never speaks first, so there is no stream to open.
|
|
174
172
|
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
The host decides who is calling: it authenticates the request its own way,
|
|
174
|
+
then hands in **the connection that request may use**.
|
|
177
175
|
|
|
178
176
|
```ts
|
|
179
177
|
import { handleHttpRequest } from '@ekwo-ai/mcp';
|
|
@@ -210,29 +208,34 @@ A remote MCP client expects the server to follow the [authorization part of
|
|
|
210
208
|
the MCP
|
|
211
209
|
specification](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization):
|
|
212
210
|
OAuth 2.1 with PKCE, protected resource metadata (RFC 9728), authorization
|
|
213
|
-
server metadata (RFC 8414) and dynamic client registration (RFC 7591).
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
server metadata (RFC 8414) and dynamic client registration (RFC 7591). The
|
|
212
|
+
host provides it: it signs the person in, issues its own tokens, and maps each
|
|
213
|
+
one to a connection above. The database stays
|
|
216
214
|
the only place that decides what may be read or written.
|
|
217
215
|
|
|
218
216
|
## The tools
|
|
219
217
|
|
|
220
|
-
Every write names its company explicitly.
|
|
218
|
+
Every write names its company explicitly. A list reads at most its `limit`:
|
|
219
|
+
`count` is the number of rows it returned, and `truncated` is true when more
|
|
220
|
+
rows match — ask again with a higher limit or a narrower filter before reading
|
|
221
|
+
`count` as a total.
|
|
221
222
|
|
|
222
223
|
| Tool | What it does |
|
|
223
224
|
|---|---|
|
|
224
225
|
| `list_companies` | The companies you are a member of, with your role on each |
|
|
225
226
|
| `get_company` | Financial years, lock dates, journals, default accounts |
|
|
226
227
|
| `list_accounts` | The accounts a company works with, by code prefix, type or name. `include_all` for the whole chart |
|
|
227
|
-
| `search_contacts` | Customers and suppliers, by name, type or VAT number |
|
|
228
|
+
| `search_contacts` | Customers and suppliers, by name, type or VAT number. Merged contacts are in it, inactive, with `merged_into`; `include_merged: false` leaves them out. `with_balance: true` adds each contact's `balance` at `balance_at` (today by default; debit minus credit, positive when the contact owes, as `contact_statement`'s closing balance) and its `open_items`, read from `subledger()` in one call |
|
|
228
229
|
| `suggest_duplicate_contacts` | The contacts that are probably one party, strongest first, one row per contact to absorb — the rows of one kept contact being one party: the contact to keep, a score, the evidence (the same VAT or registration number, the same bank account, the words of the name weighed by how few contacts carry them) and the simplest name the group carries, proposed for the kept contact. Writes nothing; `merge_contacts` joins a pair the user confirms |
|
|
229
230
|
| `contact_statement` | The statement of account of one contact over a period: the balance carried forward, each posted line of their receivable and payable accounts with its running balance and how far it is matched, and the closing balance |
|
|
231
|
+
| `list_tax_certificates` | The certificates the buyers handed over — resale, exemption, declarations of intent — with the territory each was given under and the days it covers |
|
|
230
232
|
| `search_products` | The catalogue: code, unit, price, account and tax of what is sold and bought |
|
|
231
|
-
| `list_documents` | Invoices, credit notes and quotes, filtered |
|
|
233
|
+
| `list_documents` | Invoices, credit notes and quotes, filtered — by type (`doc_type`, or several with `doc_types`), state, contact, dates or number. Every type unless named: drafts include quotes and orders |
|
|
232
234
|
| `get_document` | One document with its lines and the entry it produced |
|
|
235
|
+
| `list_document_files` | The pieces recorded on a document: where each is stored, its name, type, size and SHA-256 |
|
|
233
236
|
| `render_invoice_pdf` | The PDF of a sale invoice or credit note, as a PDF resource (base64) beside a JSON summary, rendered from the books by [`@ekwo-ai/invoice-pdf`](../formats/invoice-pdf/README.md). `factur_x` embeds the CII of a posted sale (Factur-X, EN 16931, PDF/A-3) and returns the rules it breaks; the words of the layout are in the document's language where a set exists for it, in English otherwise (`labels_language` says which), the words the law of the country names are the pack's (`pack_labels` lists them), and `labels` puts other words over them. The logo is fetched by the server from the company's `logo_url`, never from a local or private address. Records nothing |
|
|
234
237
|
| `list_bank_accounts` | The bank accounts of a company, with the journal and ledger account behind each and the profile of its CSV statements (`statement_profile`) when one is kept |
|
|
235
|
-
| `list_bank_transactions` | Statement lines, pending by default |
|
|
238
|
+
| `list_bank_transactions` | Statement lines, pending by default, of every bank account; `include_inactive_accounts: false` keeps the active ones |
|
|
236
239
|
| `trial_balance` | Opening, movements and closing per account |
|
|
237
240
|
| `general_ledger` | Every posted line of an account, with a running balance; `contact_ids` keeps the lines of those contacts, each with its own balance carried forward and running balance |
|
|
238
241
|
| `journal_book` | The book of one journal, or of all of them: every posted line of the period in the order a book is read, with the totals of each journal at the head |
|
|
@@ -240,6 +243,7 @@ Every write names its company explicitly.
|
|
|
240
243
|
| `suggest_item_combinations` | For each open receivable or payable line of one counterparty, the lines of the other side that settle it: an exact pair, several lines to the cent, or within the company's difference tolerance, with the difference. Writes nothing |
|
|
241
244
|
| `matching_difference_options` | The reasons a difference may be booked for, with the account the pack gives for each, and the company's tolerance |
|
|
242
245
|
| `aged_balance` | What is still owed, bucketed by age, read from the ledger |
|
|
246
|
+
| `currency_revaluation` | What a close on a day would revalue: the receivables, payables and bank accounts still open in a foreign currency, at the closing rate recorded for that day, with the currencies that have none |
|
|
243
247
|
| `subledger` | A receivable or payable account read contact by contact: per contact the balance brought forward, the debit and credit of the period, the closing balance, the lines of the period and those still open, the lines naming nobody in a row of their own; and the control of each account — its trial balance figures, the sum of its contacts and the difference, the lines naming nobody. `account_code` for one account, every receivable and payable account otherwise. Needs schema 0.26.0 |
|
|
244
248
|
| `vat_return` | The boxes for a period, summed from the ledger |
|
|
245
249
|
| `instalment_plan` | The payments on account the VAT scheme of a company asks for in a period: due, paid, outstanding |
|
|
@@ -256,15 +260,18 @@ Every write names its company explicitly.
|
|
|
256
260
|
| `get_preferences` | What you prefer, and the language chain to read labels with |
|
|
257
261
|
| `list_invitations` | Who has been invited into a company and not yet joined |
|
|
258
262
|
| `list_api_keys` | The machine keys of a company, and what each may do |
|
|
259
|
-
| `describe_pack` | Which country packs this installation holds: their version, how much anyone has read them, the register of texts each was built from — title, official publisher, link and the day it was opened — and, for a proven pack, its evidence: per scope, the kind of filing, the year, what was reproduced and what was not tested |
|
|
263
|
+
| `describe_pack` | Which country packs this installation holds: their version, how much anyone has read them, the register of texts each was built from — title, official publisher, link and the day it was opened — and, for a proven pack, its evidence: per scope, the kind of filing, the year, what was reproduced and what was not tested; and the charts of accounts each country offers, with their audience, for `create_company`'s `chart_code` |
|
|
260
264
|
| `status` | Schema version, instance, connection, companies |
|
|
261
|
-
| `create_contact` | A customer, supplier or other third party |
|
|
265
|
+
| `create_contact` | A customer, supplier or other third party, with the territory it is in below its country where the pack's taxes name territories |
|
|
266
|
+
| `set_contact_territory` | Says where a contact is below its country (`US-NY`), or takes it back with `null`. A tax that names a territory is judged on it at posting; one outside the contact's country is refused (`territory_outside_country`) |
|
|
267
|
+
| `record_tax_certificate` | Records on a contact a certificate they handed over: its reference, the territory under whose law it was given and the days it covers. A sale under a tax that applies on such a certificate posts only once its buyer holds one that covers it (`no_buyer_certificate`) |
|
|
262
268
|
| `merge_contacts` | Joins two contacts that are one party: everything naming the absorbed one, posted lines and issued documents included, names the kept one, whose empty fields are filled; the absorbed one is retired. Refused by name for two different VAT or registration numbers, a contact merged before, or a matching that would span two parties |
|
|
263
269
|
| `create_product` | A catalogue row: code, name, unit, price, account, tax |
|
|
264
270
|
| `update_product` | Changes one, or retires it with `active: false` |
|
|
265
271
|
| `pin_accounts` | Adds accounts to the working chart a company sees first, or takes one back out with `pinned: false` |
|
|
266
272
|
| `create_document` | A draft invoice, credit note or quote, with its lines. With `client_ref`, calling twice creates once |
|
|
267
273
|
| `update_document_lines` | Replaces the lines of a **draft** |
|
|
274
|
+
| `attach_document_file` | Records the piece of a document — the PDF of a supplier's invoice, a receipt, the copy a customer was sent — where the caller stored it, with its name, type, size and SHA-256. The server stores no bytes. The same file recorded again is returned (`replayed: true`), by its SHA-256 or by where it is stored |
|
|
268
275
|
| `post_document` | Books it, in review or autopilot ([below](#review-or-autopilot)): in `review`, only once a person approved the draft as it stands, refused with `approval_required` otherwise; in `autopilot`, directly. `dry_run: true` returns the entry the database would write, and writes nothing, in both |
|
|
269
276
|
| `accept_document` / `decline_document` | Records on a sale quote or a purchase order that the other party accepted it (`accepted_at`, `accepted_by`) or declined it (`declined_at`): a dated fact, nothing booked. `get_document` and `list_documents` then say `quote_status` — `draft`, `sent`, `accepted`, `declined`, `expired` or `cancelled` — derived by the database's `quote_status()`. Where the `crm` module holds a deal that carries the quote, the database moves the deal: won on an acceptance, lost on a refusal when no other quote of the deal is still alive. Held to `agent_posting` as a posting is |
|
|
270
277
|
| `undo_document_answer` | Takes back an answer recorded by mistake; a deal it had closed opens again |
|
|
@@ -276,7 +283,7 @@ Every write names its company explicitly.
|
|
|
276
283
|
| `reconcile_many` | Matches several lines of one counterparty and one account together, their open debits and credits equal to the cent, under one letter |
|
|
277
284
|
| `reconcile_with_difference` | The same with a small difference, booked on the account the pack gives for the reason (`rounding`, `exchange_difference`) within the company's tolerance, then matched |
|
|
278
285
|
| `reconcile` / `unreconcile` | Matches two ledger lines, or undoes one matching |
|
|
279
|
-
| `create_bank_account` | Registers an account from its identifier, in the scheme the company's country uses (an IBAN, a routing number and an account number, a sort code and an account number…), and wires it to the bank journal, through `create_bank_account()` of the schema. Running it twice with the same identifier creates nothing; a name another account carries is refused |
|
|
286
|
+
| `create_bank_account` | Registers an account from its identifier, in the scheme the company's country uses (an IBAN, a routing number and an account number, a sort code and an account number…), and wires it to the bank journal, through `create_bank_account()` of the schema. Its bank is `bank_scheme` and `bank_identifier` in any scheme of `bank_identifier_schemes` (`bic`, `aba`, `sort-code`, `bsb`, `ifsc`…), checked; `bic` alone is a BIC. Running it twice with the same identifier creates nothing; a name another account carries is refused |
|
|
280
287
|
| `update_bank_account` | Keeps on an account the profile of its CSV statements (`statement_profile`, the `CsvStatementProfile` of `@ekwo-ai/csv-statement`), checked as the reader checks it, or forgets it with `null`; `list_bank_accounts` returns it |
|
|
281
288
|
| `create_bank_transaction` | One statement line by hand, for an installation with no feed |
|
|
282
289
|
| `settle_from_statement` | Books a statement line as the payment it is and matches it against the documents or open items named, in one entry — with `amounts`, how much settles each; with `extra_lines`, the fee a payment provider kept or the charges of a bank, on the account and with the tax the user names. The line balances to the cent or is refused (`settlement_unbalanced`); extra lines alone settle a bank charge |
|
|
@@ -284,6 +291,7 @@ Every write names its company explicitly.
|
|
|
284
291
|
| `lock_period` | Moves the accounting and VAT lock dates. Needs `company.write`. |
|
|
285
292
|
| `opening_balance` | The trial balance of whatever kept the books before, as the opening entry — of the first day of the year, or of `opening_date`, the day inside it the books were taken over. `items` are the invoices and credit notes still open that day: each a posted document with its number, payment reference and due date, which statement matching finds like an invoice issued here; the items of an account must add up to its line |
|
|
286
293
|
| `import_books` | Books kept elsewhere — a FEC, an export of journal items, a journal report, a trial balance — whole or not at all, with `open_items` beside a trial balance. `dry_run: true` first: the correspondence proposed for every account and journal — `exact` only for the same code the files do not contradict, otherwise `suggested` with its reason, or `none` — what has no answer, and the import rehearsed by the database and taken back. Then again with the completed `mapping`, or `accept_suggestions` once the user has read every suggestion; nothing is posted while one is unconfirmed. Every entry through `post_entry()`; no tax; the same files twice refused, saying when and what. The files travel as text, 256 KiB at most: beyond, the tool answers with the `ekwo import` command that reads them from the disk. `ekwo import` is the same function |
|
|
294
|
+
| `set_closing_rate` | The rate a currency closes at on a day, which `close_fiscal_year` reads on the last day of the year for every currency still open. Needs `year_end.close` |
|
|
287
295
|
| `close_fiscal_year` / `reopen_fiscal_year` | Closes a year the way the country pack says — with `final_close`, whether the country also requires a final close and by when — or reopens it to correct it, whatever later years hold; a later closed year is reopened first |
|
|
288
296
|
| `close_fiscal_year_finally` | The final close of a closed year: nobody reopens it afterwards, the operator included. Only on the user's explicit request |
|
|
289
297
|
| `create_company` | A company on a country pack, with its chart and its first financial year. An instance-level act |
|
|
@@ -377,7 +385,7 @@ a session starts with the tools of a first session — `status`,
|
|
|
377
385
|
| `search_tools` | The tools that match a few words of the task, best first, each with its title, its first sentence, whether it reads, adds or destroys, and whether it is loaded. Filters by `effect` |
|
|
378
386
|
| `load_tools` | Adds the tools named to the session. The server tells the client its tool list changed |
|
|
379
387
|
|
|
380
|
-
A model then carries a short list
|
|
388
|
+
A model then carries a short list of descriptions. A client
|
|
381
389
|
that never reads the list again keeps the default.
|
|
382
390
|
|
|
383
391
|
## Review or autopilot
|
|
@@ -439,16 +447,21 @@ it gates nothing, and the server sends nothing to Ekwo to give it.
|
|
|
439
447
|
- **Dates are ISO**, `2026-06-15`. Identifiers are uuids.
|
|
440
448
|
- **Totals are computed by the database.** `create_document` returns the draft
|
|
441
449
|
with the totals the schema derived, not with anything the caller supplied.
|
|
450
|
+
The one figure a caller may give is the tax its source states for a line,
|
|
451
|
+
`stated_tax_amount`, for a supplier or a billing system that rounds the tax
|
|
452
|
+
line by line: on every line of a tax group, it is the group's tax, accepted
|
|
453
|
+
at posting within one unit of the currency per line of the computed one and
|
|
454
|
+
refused beyond it, `stated_tax_out_of_tolerance` (decision 0099).
|
|
442
455
|
- **Refusals travel unchanged.** `period_locked:`, `entry_unbalanced:`,
|
|
443
456
|
`document_total_mismatch:` and the rest arrive with the message the database
|
|
444
|
-
raised, plus one sentence saying what it means. They are answers
|
|
445
|
-
|
|
446
|
-
- **A product fills a line in and
|
|
457
|
+
raised, plus one sentence saying what it means. They are answers: act on
|
|
458
|
+
them.
|
|
459
|
+
- **A product fills a line in, and the line has the last word.** A line naming
|
|
447
460
|
`product_code` takes the catalogue's text, description, unit, price, account
|
|
448
461
|
and tax; anything the line carries wins over that. What is already posted is
|
|
449
462
|
never touched when the catalogue changes, and a product referenced by a line
|
|
450
463
|
is retired with `active: false` rather than deleted.
|
|
451
|
-
- **A
|
|
464
|
+
- **A line with no tax books no VAT.** A line with no tax books a base with no
|
|
452
465
|
VAT box, which is not the same as 0 %. A missing *account* is different: it
|
|
453
466
|
can only mean "resolve it", because a product line with no account is
|
|
454
467
|
refused by a check constraint. So a line may leave `account_code` out, and
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EAAgB,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAM7E,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAA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xC,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;CAC7C;AAaD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAuBhE;AAED,gEAAgE;AAChE,wBAAsB,eAAe,CACnC,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,GAAG,SAAS,CAAA;CAAO,GAC5D,OAAO,CAAC,OAAO,CAAC,CAUlB;AAmBD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,cAAc,GAAG,OAAO,EACpC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,QAAQ,CAAC,CAgEnB;AAWD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,cAAc,GAAG,OAAO,EACpC,OAAO,EAAE,kBAAkB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAC/C,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
package/dist/http.js
CHANGED
|
@@ -40,7 +40,7 @@ import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/
|
|
|
40
40
|
import { isServiceRoleKey, serviceRoleRefusal } from '@ekwo-ai/core';
|
|
41
41
|
import { EkwoMcpError } from './backend.js';
|
|
42
42
|
import { postgrestBackend } from './postgrest.js';
|
|
43
|
-
import {
|
|
43
|
+
import { readSchemaStatus } from './schema.js';
|
|
44
44
|
import { buildServer } from './server.js';
|
|
45
45
|
import { installedModules } from './tools/modules.js';
|
|
46
46
|
const SURFACE = 'this server';
|
|
@@ -103,6 +103,12 @@ function messagesOf(body) {
|
|
|
103
103
|
}
|
|
104
104
|
/** Methods whose answer depends on which tools this installation carries. */
|
|
105
105
|
const NEEDS_MODULES = new Set(['tools/list', 'tools/call']);
|
|
106
|
+
/**
|
|
107
|
+
* Methods whose answer depends on the version of the schema: the handshake,
|
|
108
|
+
* whose instructions say when the books are open for reading only, and a call,
|
|
109
|
+
* which is refused when it writes below the floor.
|
|
110
|
+
*/
|
|
111
|
+
const NEEDS_SCHEMA = new Set(['initialize', 'tools/call']);
|
|
106
112
|
/**
|
|
107
113
|
* Answers one HTTP request of the MCP Streamable HTTP transport.
|
|
108
114
|
*
|
|
@@ -140,12 +146,17 @@ export async function handleHttpRequest(request, connection, options = {}) {
|
|
|
140
146
|
return rpcError(200, -32001, error instanceof Error ? error.message : String(error), firstId);
|
|
141
147
|
}
|
|
142
148
|
try {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
// Each request builds its server, so each one that is told what the
|
|
150
|
+
// server is or calls a tool asks the schema its version: a database that
|
|
151
|
+
// is not an Ekwo database is refused, and one older than the floor is
|
|
152
|
+
// opened for reading only. On stdio this is the start of the process;
|
|
153
|
+
// here there is no such thing.
|
|
154
|
+
let belowFloor;
|
|
155
|
+
if ([...methods].some((method) => typeof method === 'string' && NEEDS_SCHEMA.has(method))) {
|
|
147
156
|
try {
|
|
148
|
-
await
|
|
157
|
+
const schema = await readSchemaStatus(backend);
|
|
158
|
+
if (schema.belowFloor)
|
|
159
|
+
belowFloor = schema.installed;
|
|
149
160
|
}
|
|
150
161
|
catch (error) {
|
|
151
162
|
return rpcError(200, -32002, error instanceof Error ? error.message : String(error), firstId);
|
|
@@ -153,7 +164,7 @@ export async function handleHttpRequest(request, connection, options = {}) {
|
|
|
153
164
|
}
|
|
154
165
|
const needsModules = [...methods].some((method) => typeof method === 'string' && NEEDS_MODULES.has(method));
|
|
155
166
|
const modules = options.modules ?? (needsModules ? await installedModules(backend) : []);
|
|
156
|
-
const server = buildServer(backend, { modules });
|
|
167
|
+
const server = buildServer(backend, { modules, ...(belowFloor === undefined ? {} : { belowFloor }) });
|
|
157
168
|
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
158
169
|
sessionIdGenerator: undefined,
|
|
159
170
|
enableJsonResponse: true,
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC;AACzH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,YAAY,EAAmC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC;AACzH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,YAAY,EAAmC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAgCtD,MAAM,OAAO,GAAG,aAAa,CAAC;AAC9B,MAAM,OAAO,GAAG,8DAA8D,CAAC;AAE/E,oFAAoF;AACpF,SAAS,QAAQ,CAAC,MAAc,EAAE,IAAY,EAAE,OAAe,EAAE,KAAc,IAAI;IACjF,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAA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index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { checkConnection, handleHttpRequest, handleNodeRequest, openHttpBackend,
|
|
|
15
15
|
export { INSTRUCTIONS, SERVER_NAME, SERVER_VERSION, buildServer, instructionsFor, type RegisterTool, type ServerOptions, } from './server.js';
|
|
16
16
|
export { TOOL_EFFECTS, annotationsFor, effectOf, type EffectAnnotations, type EffectDetails, type ToolEffect } from './tools/effect.js';
|
|
17
17
|
export { CORE_TOOLS, LOADING_TOOLS, TOOL_LOADING, loadTools, searchTools, type FoundTool, type ToolLoading } from './tools/loading.js';
|
|
18
|
-
export { SCHEMA_MIN, assertSchemaSupported, installedSchemaVersion } from './schema.js';
|
|
18
|
+
export { SCHEMA_MIN, UPGRADE_COMMAND, assertSchemaSupported, installedSchemaVersion, readSchemaStatus, type SchemaStatus } from './schema.js';
|
|
19
19
|
export { einvoiceTransportFrom, postingSummary, serverFromEnvironment, shouldInviteToRegister, type Started } from './start.js';
|
|
20
20
|
export { STDIO_HELP, runStdio, type StdioOptions } from './stdio.js';
|
|
21
21
|
export { isMissingConfiguration, unconfiguredBackend } from './unconfigured.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,YAAY,EACZ,OAAO,EACP,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACnJ,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW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AAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { checkConnection, handleHttpRequest, handleNodeRequest, openHttpBackend,
|
|
|
15
15
|
export { INSTRUCTIONS, SERVER_NAME, SERVER_VERSION, buildServer, instructionsFor, } from './server.js';
|
|
16
16
|
export { TOOL_EFFECTS, annotationsFor, effectOf } from './tools/effect.js';
|
|
17
17
|
export { CORE_TOOLS, LOADING_TOOLS, TOOL_LOADING, loadTools, searchTools } from './tools/loading.js';
|
|
18
|
-
export { SCHEMA_MIN, assertSchemaSupported, installedSchemaVersion } from './schema.js';
|
|
18
|
+
export { SCHEMA_MIN, UPGRADE_COMMAND, assertSchemaSupported, installedSchemaVersion, readSchemaStatus } from './schema.js';
|
|
19
19
|
export { einvoiceTransportFrom, postingSummary, serverFromEnvironment, shouldInviteToRegister } from './start.js';
|
|
20
20
|
export { STDIO_HELP, runStdio } from './stdio.js';
|
|
21
21
|
export { isMissingConfiguration, unconfiguredBackend } from './unconfigured.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,YAAY,EACZ,OAAO,EACP,SAAS,GAQV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAe,MAAM,aAAa,CAAC;AACnJ,OAAO,EAAE,QAAQ,EAAE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AAE,YAAY,GAAG,SAAS,CAAC;CAClC;AAED,iEAAiE;AACjE,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,+FAA+F;AAC/F,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAkB3D;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC,CAsJ9F"}
|
package/dist/postgrest.js
CHANGED
|
@@ -148,6 +148,20 @@ export async function postgrestBackend(options) {
|
|
|
148
148
|
// set-returning one as an array. Tools see an array either way.
|
|
149
149
|
return (Array.isArray(data) ? data : [data]);
|
|
150
150
|
},
|
|
151
|
+
// PostgREST cuts every answer at the `max_rows` of its server and says
|
|
152
|
+
// nothing in the body; a range with the exact count is how `readWhole()`
|
|
153
|
+
// of the core reads a long ledger to its last line.
|
|
154
|
+
async rpcPage(fn, args, schema, page) {
|
|
155
|
+
const answer = (await on(schema)
|
|
156
|
+
.rpc(identifier(fn), args, { count: 'exact' })
|
|
157
|
+
.range(page.offset, page.offset + page.limit - 1));
|
|
158
|
+
// A range past the end — rows removed since the last one — is refused
|
|
159
|
+
// (`PGRST103`): no rows and no count, which reads again from the start.
|
|
160
|
+
if (answer.error?.code === 'PGRST103')
|
|
161
|
+
return { rows: [], total: null };
|
|
162
|
+
const data = unwrap(answer, fn);
|
|
163
|
+
return { rows: (Array.isArray(data) ? data : [data]), total: answer.count ?? null };
|
|
164
|
+
},
|
|
151
165
|
async rpcVoid(fn, args = {}, schema) {
|
|
152
166
|
const answer = (await on(schema).rpc(identifier(fn), args));
|
|
153
167
|
if (answer.error !== null) {
|
package/dist/postgrest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgrest.js","sourceRoot":"","sources":["../src/postgrest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,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YACT,4DAA4D;YAC5D,MAAM,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,CAAC;KACF,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,kFAAkF;AAClF,KAAK,UAAU,eAAe,CAAC,MAAsB;IACnD,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAA0C,CAAC;IACzF,MAAM,KAAK,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChH,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,GAAG,YAAY,SAAS,CAAC,CAAC;IAC1F,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -3,26 +3,57 @@
|
|
|
3
3
|
*
|
|
4
4
|
* An MCP client is installed by whoever wants an agent, and the database
|
|
5
5
|
* it reaches was installed by whoever runs the books — two decisions, two
|
|
6
|
-
* dates. So the server asks the schema its version before it answers anything
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* is
|
|
6
|
+
* dates. So the server asks the schema its version before it answers anything.
|
|
7
|
+
*
|
|
8
|
+
* Down to the floor, `SCHEMA_MIN`, it answers in full: what a newer release
|
|
9
|
+
* added is named in `SCHEMA_FEATURES` of the core and asked for only where the
|
|
10
|
+
* schema has it. Below the floor, it still opens the installation, for
|
|
11
|
+
* reading: a newer client never locks a person out of their own books behind
|
|
12
|
+
* "update first". Every tool that writes is refused by name, with the command
|
|
13
|
+
* that upgrades the database, and a read that reaches for what the schema
|
|
14
|
+
* lacks is refused the same way rather than answered half. The alternative is
|
|
15
|
+
* what an agent does with a missing column: it improvises, and the
|
|
16
|
+
* improvisation is an accounting entry.
|
|
10
17
|
*
|
|
11
18
|
* Declared in `package.json` under `ekwo.schemaMin`, as a country pack
|
|
12
19
|
* declares it in its manifest, and repeated here as a constant so a bundle
|
|
13
20
|
* that never reads a manifest still carries it.
|
|
14
21
|
*/
|
|
15
|
-
import { type Backend } from './backend.js';
|
|
22
|
+
import { EkwoMcpError, type Backend } from './backend.js';
|
|
16
23
|
/** The oldest schema this server speaks to. */
|
|
17
24
|
export declare const SCHEMA_MIN = "0.19.0";
|
|
18
25
|
/** The version the migrations of that database define. */
|
|
19
26
|
export declare function installedSchemaVersion(backend: Backend): Promise<string | undefined>;
|
|
27
|
+
/** The command that brings a database back above the floor. */
|
|
28
|
+
export declare const UPGRADE_COMMAND = "npx -y ekwo-os@latest migrate";
|
|
29
|
+
/** The version a database is at, and whether this server writes to it. */
|
|
30
|
+
export interface SchemaStatus {
|
|
31
|
+
installed: string;
|
|
32
|
+
/** Older than `SCHEMA_MIN`: opened for reading only. */
|
|
33
|
+
belowFloor: boolean;
|
|
34
|
+
}
|
|
20
35
|
/**
|
|
21
|
-
*
|
|
36
|
+
* The version of the database, and whether it is below the floor.
|
|
22
37
|
*
|
|
23
|
-
* A database that cannot answer at all is refused
|
|
38
|
+
* A database that cannot answer at all is refused: `ekwo_schema_version()`
|
|
24
39
|
* has existed since the first migration, so a silence means the schema is not
|
|
25
40
|
* installed rather than that it is old.
|
|
26
41
|
*/
|
|
42
|
+
export declare function readSchemaStatus(backend: Backend): Promise<SchemaStatus>;
|
|
43
|
+
/**
|
|
44
|
+
* The refusal of one tool on a database below the floor: a write, or a read
|
|
45
|
+
* that asked for something the installed schema does not have.
|
|
46
|
+
*/
|
|
47
|
+
export declare function belowFloorRefusal(tool: string, installed: string, kind: 'write' | 'read'): EkwoMcpError;
|
|
48
|
+
/**
|
|
49
|
+
* What Postgres or PostgREST says when a read asked for a column, a function
|
|
50
|
+
* or a table the schema does not have.
|
|
51
|
+
*/
|
|
52
|
+
export declare const MISSING_OBJECT: RegExp;
|
|
53
|
+
/**
|
|
54
|
+
* The strict check: refuses a database older than this server, and says
|
|
55
|
+
* which way to fix it. The server itself opens such a database for reading
|
|
56
|
+
* (`readSchemaStatus`); this is for a caller that only goes on above the floor.
|
|
57
|
+
*/
|
|
27
58
|
export declare function assertSchemaSupported(backend: Backend): Promise<string>;
|
|
28
59
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE1D,+CAA+C;AAC/C,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC,0DAA0D;AAC1D,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU1F;AAED,+DAA+D;AAC/D,eAAO,MAAM,eAAe,kCAAkC,CAAC;AAE/D,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAQ9E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,CAQvG;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,QAA8I,CAAC;AAE1K;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAW7E"}
|
package/dist/schema.js
CHANGED
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* An MCP client is installed by whoever wants an agent, and the database
|
|
5
5
|
* it reaches was installed by whoever runs the books — two decisions, two
|
|
6
|
-
* dates. So the server asks the schema its version before it answers anything
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* is
|
|
6
|
+
* dates. So the server asks the schema its version before it answers anything.
|
|
7
|
+
*
|
|
8
|
+
* Down to the floor, `SCHEMA_MIN`, it answers in full: what a newer release
|
|
9
|
+
* added is named in `SCHEMA_FEATURES` of the core and asked for only where the
|
|
10
|
+
* schema has it. Below the floor, it still opens the installation, for
|
|
11
|
+
* reading: a newer client never locks a person out of their own books behind
|
|
12
|
+
* "update first". Every tool that writes is refused by name, with the command
|
|
13
|
+
* that upgrades the database, and a read that reaches for what the schema
|
|
14
|
+
* lacks is refused the same way rather than answered half. The alternative is
|
|
15
|
+
* what an agent does with a missing column: it improvises, and the
|
|
16
|
+
* improvisation is an accounting entry.
|
|
10
17
|
*
|
|
11
18
|
* Declared in `package.json` under `ekwo.schemaMin`, as a country pack
|
|
12
19
|
* declares it in its manifest, and repeated here as a constant so a bundle
|
|
@@ -29,20 +36,48 @@ export async function installedSchemaVersion(backend) {
|
|
|
29
36
|
return undefined;
|
|
30
37
|
}
|
|
31
38
|
}
|
|
39
|
+
/** The command that brings a database back above the floor. */
|
|
40
|
+
export const UPGRADE_COMMAND = 'npx -y ekwo-os@latest migrate';
|
|
32
41
|
/**
|
|
33
|
-
*
|
|
42
|
+
* The version of the database, and whether it is below the floor.
|
|
34
43
|
*
|
|
35
|
-
* A database that cannot answer at all is refused
|
|
44
|
+
* A database that cannot answer at all is refused: `ekwo_schema_version()`
|
|
36
45
|
* has existed since the first migration, so a silence means the schema is not
|
|
37
46
|
* installed rather than that it is old.
|
|
38
47
|
*/
|
|
39
|
-
export async function
|
|
48
|
+
export async function readSchemaStatus(backend) {
|
|
40
49
|
const installed = await installedSchemaVersion(backend);
|
|
41
50
|
if (installed === undefined) {
|
|
42
51
|
throw new EkwoMcpError(`schema_not_found: this database does not answer ekwo_schema_version(), so it does not carry the Ekwo schema. Run \`npx ekwo-os init\` against it first.`);
|
|
43
52
|
}
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
return { installed, belowFloor: !schemaIsAtLeast(installed, SCHEMA_MIN) };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The refusal of one tool on a database below the floor: a write, or a read
|
|
57
|
+
* that asked for something the installed schema does not have.
|
|
58
|
+
*/
|
|
59
|
+
export function belowFloorRefusal(tool, installed, kind) {
|
|
60
|
+
const what = kind === 'write'
|
|
61
|
+
? `${tool} writes, and this database is at ${installed}, below ${SCHEMA_MIN}, the oldest schema @ekwo-ai/mcp writes to. The tools that read still answer.`
|
|
62
|
+
: `${tool} reads what schema ${SCHEMA_MIN} or newer has, and this database is at ${installed}. The other tools that read still answer.`;
|
|
63
|
+
return new EkwoMcpError(`schema_too_old: ${what} Run \`${UPGRADE_COMMAND}\` against it to bring it up to date.`, {
|
|
64
|
+
hint: 'Upgrading the database is the fix, never pinning this server: the schema moves forward only, and nothing in the books is lost by the upgrade.',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* What Postgres or PostgREST says when a read asked for a column, a function
|
|
69
|
+
* or a table the schema does not have.
|
|
70
|
+
*/
|
|
71
|
+
export const MISSING_OBJECT = /\b(column|function|relation|table) [^\s]+ does not exist|could not find the (function|column|table)|\b(42703|42883|42P01|PGRST20[024])\b/i;
|
|
72
|
+
/**
|
|
73
|
+
* The strict check: refuses a database older than this server, and says
|
|
74
|
+
* which way to fix it. The server itself opens such a database for reading
|
|
75
|
+
* (`readSchemaStatus`); this is for a caller that only goes on above the floor.
|
|
76
|
+
*/
|
|
77
|
+
export async function assertSchemaSupported(backend) {
|
|
78
|
+
const { installed, belowFloor } = await readSchemaStatus(backend);
|
|
79
|
+
if (belowFloor) {
|
|
80
|
+
throw new EkwoMcpError(`schema_too_old: this database is at ${installed} and @ekwo-ai/mcp needs ${SCHEMA_MIN} or newer. Run \`${UPGRADE_COMMAND}\` against it, then start this server again.`, {
|
|
46
81
|
hint: 'Upgrading the database is the fix, never pinning this server: the schema moves forward only, and an older client would be reading rows that no longer mean what it thinks.',
|
|
47
82
|
});
|
|
48
83
|
}
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAgB,MAAM,cAAc,CAAC;AAE1D,+CAA+C;AAC/C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAEnC,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,OAAgB;IAC3D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAS,qBAAqB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;QACvE,8DAA8D;QAC9D,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,+DAA+D;AAC/D,MAAM,CAAC,M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