@stratta/mcp 0.1.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 +113 -0
- package/dist/auth.d.ts +7 -0
- package/dist/auth.js +42 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +142 -0
- package/dist/tools/get-cross-refs.d.ts +24 -0
- package/dist/tools/get-cross-refs.js +24 -0
- package/dist/tools/get-figure.d.ts +24 -0
- package/dist/tools/get-figure.js +50 -0
- package/dist/tools/get-methodology.d.ts +18 -0
- package/dist/tools/get-methodology.js +23 -0
- package/dist/tools/get-section.d.ts +24 -0
- package/dist/tools/get-section.js +35 -0
- package/dist/tools/get-subtree.d.ts +29 -0
- package/dist/tools/get-subtree.js +40 -0
- package/dist/tools/get-toc.d.ts +24 -0
- package/dist/tools/get-toc.js +33 -0
- package/dist/tools/ingest.d.ts +243 -0
- package/dist/tools/ingest.js +251 -0
- package/dist/tools/list-norms.d.ts +11 -0
- package/dist/tools/list-norms.js +18 -0
- package/dist/tools/search-in-norm.d.ts +29 -0
- package/dist/tools/search-in-norm.js +32 -0
- package/package.json +58 -0
- package/skills/ingest-norm/SKILL.md +75 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ingest-norm
|
|
3
|
+
description: Use when the user wants to add an engineering norm (SIA, Eurocode, etc.) they are licensed for into THEIR Stratta workspace. Reads the PDF, builds a hierarchical tree, enriches sections (LaTeX formulas, tables, figures, cross-references), and writes everything to Stratta via the MCP `ingest_*` tools — scoped to the user's own organization. Trigger phrases: "ingère cette norme", "ingest SIA", "ajoute la norme X à Stratta".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ingest a norm into your Stratta workspace
|
|
7
|
+
|
|
8
|
+
This skill turns a norm PDF **you are licensed to use** into a queryable TreeRAG
|
|
9
|
+
inside **your own** Stratta workspace. Everything runs on your machine through
|
|
10
|
+
the Stratta MCP server (authenticated by your `STRATTA_API_KEY`); the norm is
|
|
11
|
+
stored privately and scoped to your organization — no one else can see it.
|
|
12
|
+
|
|
13
|
+
> ⚠️ **Licence**: only ingest norms your organization holds a valid licence for.
|
|
14
|
+
> You are responsible for your usage rights (see Stratta's Terms).
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
- The Stratta MCP server is installed and `STRATTA_API_KEY` is set.
|
|
18
|
+
- The norm PDF is available locally.
|
|
19
|
+
- (Optional, for figures) `poppler` tools (`pdftoppm`, `pdfimages`) to rasterize
|
|
20
|
+
pages/extract images.
|
|
21
|
+
|
|
22
|
+
## Tools used (all scoped to your workspace)
|
|
23
|
+
`ingest_status` · `ingest_create_document` · `ingest_create_sections` ·
|
|
24
|
+
`ingest_attach_formula` · `ingest_attach_table` · `ingest_attach_cross_ref` ·
|
|
25
|
+
`ingest_upload_figure` · `ingest_normalize_cross_refs` · `ingest_publish` ·
|
|
26
|
+
`ingest_delete`.
|
|
27
|
+
|
|
28
|
+
## Workflow
|
|
29
|
+
|
|
30
|
+
### 1. Check for an existing copy
|
|
31
|
+
Call `ingest_status { code }` (e.g. `"SIA 261"`). If it already exists and you
|
|
32
|
+
want to re-ingest, call `ingest_delete { documentId }` first.
|
|
33
|
+
|
|
34
|
+
### 2. Read the PDF and plan the tree
|
|
35
|
+
Read the PDF natively. Build a PageIndex-style hierarchy: chapters (depth 0),
|
|
36
|
+
sections (depth 1), sub-sections (depth 2+), plus annexes. For each node decide
|
|
37
|
+
a stable `nodeId`, a human `path` (e.g. `"4.2.1"`, `"Annexe B.1"`), `title`,
|
|
38
|
+
a 1-3 sentence `summary` (used for navigation), `pageStart`/`pageEnd`, and an
|
|
39
|
+
`orderIndex`. **Never skip annexes** — they hold key numeric values.
|
|
40
|
+
|
|
41
|
+
### 3. Create the document
|
|
42
|
+
`ingest_create_document { code, year, title, language, totalPages }` →
|
|
43
|
+
returns `documentId`. Keep it for all subsequent calls.
|
|
44
|
+
|
|
45
|
+
### 4. Insert sections (in batches)
|
|
46
|
+
`ingest_create_sections { documentId, sections: [...] }`. Each section carries
|
|
47
|
+
`nodeId`, optional `parentNodeId` (must already exist in this or a prior batch),
|
|
48
|
+
`path`, `title`, `summary`, `depth`, `content` (full enriched text, LaTeX inline
|
|
49
|
+
OK), `rawContent`, `pageStart`, `pageEnd`, `orderIndex`. The call returns a
|
|
50
|
+
`nodeId → sectionId` map — **use those sectionIds** to attach formulas, tables,
|
|
51
|
+
figures and cross-refs. Batch large docs (e.g. 30-50 sections per call).
|
|
52
|
+
|
|
53
|
+
### 5. Enrich sections
|
|
54
|
+
- `ingest_attach_formula { sectionId, latex, description, formulaNumber }`
|
|
55
|
+
- `ingest_attach_table { sectionId, data: { headers, rows }, caption, tableNumber }`
|
|
56
|
+
- `ingest_attach_cross_ref { sourceSectionId, targetDocumentCode, targetSectionPath?, refText, refType }`
|
|
57
|
+
|
|
58
|
+
### 6. Figures
|
|
59
|
+
For each relevant figure: rasterize/extract the image, read its bytes, base64-encode,
|
|
60
|
+
then `ingest_upload_figure { sectionId, base64, mimeType, caption, figureNumber }`
|
|
61
|
+
(png/jpeg/webp, ≤ 8 MB). The tool stores the image and links it in one call.
|
|
62
|
+
|
|
63
|
+
### 7. Auto cross-references (optional)
|
|
64
|
+
`ingest_normalize_cross_refs { documentId }` scans every section's text for
|
|
65
|
+
references to other norms (SIA / SN EN / EN / ISO / DIN …) and rebuilds the
|
|
66
|
+
cross-ref index. Idempotent.
|
|
67
|
+
|
|
68
|
+
### 8. Publish
|
|
69
|
+
`ingest_publish { documentId }`. The norm is now queryable in your workspace via
|
|
70
|
+
`list_norms`, `get_toc`, `get_section`, `search_in_norm`, `get_figure`, etc.
|
|
71
|
+
|
|
72
|
+
## Quality bar
|
|
73
|
+
- Citations depend on accurate `path` + `pageStart/pageEnd` — get them right.
|
|
74
|
+
- Summaries drive navigation — make them specific (mention formulas/values when present).
|
|
75
|
+
- Keep `content` faithful to the source; don't invent values.
|