@stratta/mcp 1.16.1 → 1.17.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 CHANGED
@@ -46,6 +46,21 @@ This package is what you want when:
46
46
  uploads a file from your disk to a project dossier;
47
47
  - you would simply rather run the server yourself.
48
48
 
49
+ ## Lighter setup: `--simple`
50
+
51
+ By default the server announces all 59 tools (about 67,000 characters of
52
+ schemas). `--simple` announces only the 10 norm-reading tools (about 11,000),
53
+ which is enough for an agent that just reads norms:
54
+
55
+ ```bash
56
+ claude mcp add stratta --scope user -- npx -y @stratta/mcp --simple
57
+ ```
58
+
59
+ `--toolsets dossiers,sites` adds families (`norms` is always on; `dossiers`,
60
+ `sites`, `ingest`), `--full` restores everything, and the `STRATTA_TOOLSETS`
61
+ environment variable does the same. An unknown family is ignored. For the
62
+ remote connector, use the **Tools** menu on https://stratta.ch/connections.
63
+
49
64
  ## Install
50
65
 
51
66
  ### Claude Code (recommended)
@@ -347,14 +362,14 @@ Requires Python ≥ 3.10 with PyMuPDF (`python -m pip install --user pymupdf`).
347
362
  Your organization reached one of its limits. The error names the dimension, your
348
363
  current count and the plan limit. Retrying will fail identically.
349
364
 
350
- | Limit | Free | Pro | Max | Team |
351
- | --------------- | ----- | ------ | ------ | ------ |
352
- | Norms | 1 | 15 | 60 | 75 |
353
- | Sections | 1,000 | 15,000 | 60,000 | 75,000 |
354
- | Figures | 60 | 750 | 3,000 | 3,750 |
355
- | Queries / month | 500 | 15,000 | 60,000 | 75,000 |
356
- | Members | 1 | 1 | 1 | 5 |
357
- | Site sheet | – | – | ✓ | ✓ |
365
+ | Limit | Free | Pro | Max |
366
+ | --------------- | ----- | ------ | ------ |
367
+ | Norms | 1 | 15 | 60 |
368
+ | Sections | 1,000 | 15,000 | 60,000 |
369
+ | Figures | 60 | 750 | 3,000 |
370
+ | Queries / month | 500 | 10,000 | 40,000 |
371
+ | Members | 1 | 1 | 1 |
372
+ | Site sheet | – | – | ✓ |
358
373
 
359
374
  Beyond the included queries, paid plans bill the overage per thousand. An
360
375
  Enterprise contract scales seats, norms and queries further and includes the
package/dist/index.js CHANGED
@@ -18,6 +18,8 @@ import { SESSION_ID, usageDigest } from './usage.js';
18
18
  import { SERVER_INSTRUCTIONS } from './tools/catalog.gen.js';
19
19
  import { registerResources } from './resources.js';
20
20
  import { registerPrompts } from './prompts.js';
21
+ import { TOOLSET_CHOICE } from './mode.js';
22
+ import { toolInChoice } from './tools/toolsets.gen.js';
21
23
  /**
22
24
  * Read from package.json rather than repeated in a literal. The previous
23
25
  * version announced `0.3.0` while the published package was `0.6.0`, so every
@@ -108,13 +110,15 @@ async function call(def, args) {
108
110
  };
109
111
  }
110
112
  }
113
+ // `--simple` or `--toolsets` (ADR 57): an agent that only reads norms is
114
+ // shown ten tools instead of fifty-nine.
111
115
  for (const def of [
112
116
  ...readTools,
113
117
  ...siteTools,
114
118
  ...dossierTools,
115
119
  ...libraryTools,
116
120
  ...ingestTools,
117
- ]) {
121
+ ].filter((d) => toolInChoice(d.name, TOOLSET_CHOICE))) {
118
122
  server.registerTool(def.name, {
119
123
  title: def.title,
120
124
  description: def.description,
@@ -154,10 +158,17 @@ COMMANDES
154
158
  --version Version installée
155
159
  --help Cet écran
156
160
 
161
+ OPTIONS DU SERVEUR
162
+ --simple Normes seules : dix outils, démarrage plus léger
163
+ --toolsets dossiers,sites Normes plus les familles choisies
164
+ (dossiers, sites, ingest)
165
+ STRATTA_TOOLSETS=... Même réglage par variable d'environnement
166
+
157
167
  Sans commande, le serveur MCP démarre sur stdio : c'est ce que fait votre
158
168
  agent, vous n'avez pas à le lancer vous-même.
159
169
 
160
170
  Installation claude mcp add stratta --scope user -- npx -y @stratta/mcp
171
+ Mode simple claude mcp add stratta --scope user -- npx -y @stratta/mcp --simple
161
172
  Raccourci npm install -g @stratta/mcp puis stratta doctor
162
173
  Documentation https://stratta.ch/docs`);
163
174
  }
package/dist/mode.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { type ToolsetChoice } from './tools/toolsets.gen.js';
2
+ /**
3
+ * Which tool families this server shows (ADR 57).
4
+ *
5
+ * npx -y @stratta/mcp --simple norms only, ten tools
6
+ * npx -y @stratta/mcp --toolsets dossiers norms and dossiers
7
+ * STRATTA_TOOLSETS=sites npx -y @stratta/mcp
8
+ *
9
+ * The flag wins over the variable. Nothing set: every tool, as before 1.17.
10
+ * An unknown word is dropped, never fatal: a server that refuses to start on
11
+ * a typo looks, from the agent, exactly like a server that hangs.
12
+ */
13
+ export declare function readToolsetChoice(argv: ReadonlyArray<string>, env: Readonly<Record<string, string | undefined>>): ToolsetChoice;
14
+ /** The choice as the server's `get_methodology` reads it; absent for full. */
15
+ export declare function toolsetsParam(choice: ToolsetChoice): string | undefined;
16
+ export declare const TOOLSET_CHOICE: ToolsetChoice;
package/dist/mode.js ADDED
@@ -0,0 +1,32 @@
1
+ import { parseToolsets } from './tools/toolsets.gen.js';
2
+ /**
3
+ * Which tool families this server shows (ADR 57).
4
+ *
5
+ * npx -y @stratta/mcp --simple norms only, ten tools
6
+ * npx -y @stratta/mcp --toolsets dossiers norms and dossiers
7
+ * STRATTA_TOOLSETS=sites npx -y @stratta/mcp
8
+ *
9
+ * The flag wins over the variable. Nothing set: every tool, as before 1.17.
10
+ * An unknown word is dropped, never fatal: a server that refuses to start on
11
+ * a typo looks, from the agent, exactly like a server that hangs.
12
+ */
13
+ export function readToolsetChoice(argv, env) {
14
+ if (argv.includes('--simple'))
15
+ return parseToolsets('simple');
16
+ if (argv.includes('--full'))
17
+ return null;
18
+ for (let i = 0; i < argv.length; i++) {
19
+ const arg = argv[i];
20
+ if (arg.startsWith('--toolsets=')) {
21
+ return parseToolsets(arg.slice('--toolsets='.length));
22
+ }
23
+ if (arg === '--toolsets')
24
+ return parseToolsets(argv[i + 1]);
25
+ }
26
+ return parseToolsets(env.STRATTA_TOOLSETS);
27
+ }
28
+ /** The choice as the server's `get_methodology` reads it; absent for full. */
29
+ export function toolsetsParam(choice) {
30
+ return choice === null ? undefined : choice.join(',');
31
+ }
32
+ export const TOOLSET_CHOICE = readToolsetChoice(process.argv.slice(2), process.env);
package/dist/prompts.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { PROMPTS } from './tools/catalog.gen.js';
3
+ import { choiceHas } from './tools/toolsets.gen.js';
4
+ import { TOOLSET_CHOICE } from './mode.js';
3
5
  /**
4
6
  * Prompts: the three ways a user starts a conversation with Stratta, as
5
7
  * slash commands in the clients that support them (Claude Code, Claude
@@ -20,6 +22,10 @@ export function renderPrompt(p, args) {
20
22
  }
21
23
  export function registerPrompts(server) {
22
24
  for (const p of PROMPTS) {
25
+ // A prompt that drives dossier tools is not offered without them.
26
+ if (p.name === 'resume-dossier' && !choiceHas(TOOLSET_CHOICE, 'dossiers')) {
27
+ continue;
28
+ }
23
29
  const shape = {};
24
30
  for (const a of p.args) {
25
31
  const s = z.string().describe(a.description);
@@ -1,3 +1,4 @@
1
+ import { TOOLSET_CHOICE, toolsetsParam } from '../mode.js';
1
2
  import { z } from 'zod';
2
3
  import { api } from '../client.js';
3
4
  import { requireApiKey } from '../auth.js';
@@ -31,7 +32,11 @@ const edition = (tool) => z.string().optional().describe(param(tool, 'edition'))
31
32
  export const getMethodology = defineTool({
32
33
  ...headOf('get_methodology'),
33
34
  inputSchema: {},
34
- run: (client) => client.action(api._mcp.getMethodology, { apiKey: requireApiKey() }),
35
+ run: (client) => client.action(api._mcp.getMethodology, {
36
+ apiKey: requireApiKey(),
37
+ // The dossier policy only when the dossier tools are shown (ADR 57).
38
+ toolsets: toolsetsParam(TOOLSET_CHOICE),
39
+ }),
35
40
  // One Markdown document, read at the start of every conversation.
36
41
  toContent: (result) => ({
37
42
  content: [{ type: 'text', text: result.text }],
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Tool families: which MCP tools an agent is shown (ADR 57).
3
+ *
4
+ * Fifty-nine tools cost a client that loads every schema up front about
5
+ * 13 500 tokens before the first question, and a long menu makes a model
6
+ * pick worse. Most conversations only read norms. So the catalogue is cut
7
+ * into families, the way GitHub's MCP server cuts its own into toolsets:
8
+ *
9
+ * - `norms` is always there: the method, the account, and the norm reader.
10
+ * - `dossiers` adds the project work: questions, findings, decisions,
11
+ * attachments, templates, deliverables and the office's methods.
12
+ * - `sites` adds the site scan and its readings.
13
+ * - `ingest` adds the ingestion tools (stdio only: they read a local PDF).
14
+ *
15
+ * "Simple" is `norms` alone. "Full" is everything the transport serves, and
16
+ * stays the default: the published ChatGPT plugin is a snapshot of the full
17
+ * list, and changing what a connection sees is the user's choice, never ours.
18
+ *
19
+ * ⚠️ Read by the browser (the connections page) and by the generator of the
20
+ * npm package's catalogue: imports nothing, erasable TypeScript only. The
21
+ * npm package gets a verbatim copy (`toolsets.gen.ts`).
22
+ * `mcpToolsets.test.ts` checks that every catalogue tool has a family.
23
+ */
24
+ export type Toolset = 'norms' | 'dossiers' | 'sites' | 'ingest';
25
+ export declare const TOOLSETS: ReadonlyArray<Toolset>;
26
+ /** The families a user can turn on or off; `norms` cannot be turned off. */
27
+ export declare const OPTIONAL_TOOLSETS: ReadonlyArray<Toolset>;
28
+ export declare const TOOLSET_OF: Readonly<Record<string, Toolset>>;
29
+ /** A tool with no family is shown only in full mode, never hidden by mistake. */
30
+ export declare function toolsetOf(name: string): Toolset | null;
31
+ /**
32
+ * What a connection was set to. `null` means full: every tool the transport
33
+ * serves, the behaviour of every connection made before families existed.
34
+ */
35
+ export type ToolsetChoice = ReadonlyArray<Toolset> | null;
36
+ export declare const SIMPLE_TOOLSETS: ReadonlyArray<Toolset>;
37
+ /**
38
+ * Read a choice written by a person or a flag: `simple`, `full`, `all`, or a
39
+ * comma list such as `dossiers,sites`. Unknown words are dropped rather than
40
+ * refused, so a typo degrades to fewer tools, never to a server that does not
41
+ * start. `norms` is always added back.
42
+ */
43
+ export declare function parseToolsets(raw: string | null | undefined): ToolsetChoice;
44
+ /** Whether a tool is shown under a choice. */
45
+ export declare function toolInChoice(name: string, choice: ToolsetChoice): boolean;
46
+ /** Whether the choice carries a family (a full choice carries all of them). */
47
+ export declare function choiceHas(choice: ToolsetChoice, family: Toolset): boolean;
48
+ /** The stored form: a sorted list, or `undefined` for full. */
49
+ export declare function normalizeChoice(choice: ToolsetChoice): Toolset[] | undefined;
@@ -0,0 +1,130 @@
1
+ // Generated by scripts/build-mcp-catalog.mjs from convex/mcpToolsets.ts.
2
+ // Do not edit: change the source and run the script.
3
+ export const TOOLSETS = [
4
+ 'norms',
5
+ 'dossiers',
6
+ 'sites',
7
+ 'ingest',
8
+ ];
9
+ /** The families a user can turn on or off; `norms` cannot be turned off. */
10
+ export const OPTIONAL_TOOLSETS = [
11
+ 'dossiers',
12
+ 'sites',
13
+ 'ingest',
14
+ ];
15
+ export const TOOLSET_OF = {
16
+ get_methodology: 'norms',
17
+ whoami: 'norms',
18
+ list_norms: 'norms',
19
+ get_toc: 'norms',
20
+ get_subtree: 'norms',
21
+ get_section: 'norms',
22
+ search_in_norm: 'norms',
23
+ search_corpus: 'norms',
24
+ get_cross_refs: 'norms',
25
+ get_figure: 'norms',
26
+ list_dossiers: 'dossiers',
27
+ open_dossier: 'dossiers',
28
+ load_dossier: 'dossiers',
29
+ open_question: 'dossiers',
30
+ save_finding: 'dossiers',
31
+ record_decision: 'dossiers',
32
+ resolve_question: 'dossiers',
33
+ list_attachments: 'dossiers',
34
+ read_attachment: 'dossiers',
35
+ search_in_dossier: 'dossiers',
36
+ add_attachment: 'dossiers',
37
+ list_templates: 'dossiers',
38
+ apply_template: 'dossiers',
39
+ draft_deliverable: 'dossiers',
40
+ write_section: 'dossiers',
41
+ list_skills: 'dossiers',
42
+ get_skill: 'dossiers',
43
+ list_questions: 'dossiers',
44
+ get_question: 'dossiers',
45
+ get_dossier_activity: 'dossiers',
46
+ list_exports: 'dossiers',
47
+ update_question: 'dossiers',
48
+ add_option: 'dossiers',
49
+ update_option: 'dossiers',
50
+ delete_option: 'dossiers',
51
+ delete_question: 'dossiers',
52
+ add_comment: 'dossiers',
53
+ update_entry: 'dossiers',
54
+ attach_entry: 'dossiers',
55
+ scan_site: 'sites',
56
+ get_boreholes: 'sites',
57
+ get_site_context: 'sites',
58
+ list_sites: 'sites',
59
+ get_site: 'sites',
60
+ get_site_section: 'sites',
61
+ list_site_overlays: 'sites',
62
+ get_groundwater_contours: 'sites',
63
+ list_site_photos: 'sites',
64
+ list_site_neighbours: 'sites',
65
+ ingest_status: 'ingest',
66
+ ingest_create_document: 'ingest',
67
+ ingest_create_sections: 'ingest',
68
+ ingest_attach_formula: 'ingest',
69
+ ingest_attach_table: 'ingest',
70
+ ingest_attach_cross_ref: 'ingest',
71
+ ingest_upload_figure: 'ingest',
72
+ ingest_normalize_cross_refs: 'ingest',
73
+ ingest_publish: 'ingest',
74
+ ingest_delete: 'ingest',
75
+ };
76
+ /** A tool with no family is shown only in full mode, never hidden by mistake. */
77
+ export function toolsetOf(name) {
78
+ return TOOLSET_OF[name] ?? null;
79
+ }
80
+ export const SIMPLE_TOOLSETS = ['norms'];
81
+ /**
82
+ * Read a choice written by a person or a flag: `simple`, `full`, `all`, or a
83
+ * comma list such as `dossiers,sites`. Unknown words are dropped rather than
84
+ * refused, so a typo degrades to fewer tools, never to a server that does not
85
+ * start. `norms` is always added back.
86
+ */
87
+ export function parseToolsets(raw) {
88
+ const text = (raw ?? '').trim().toLowerCase();
89
+ if (!text || text === 'full' || text === 'all')
90
+ return null;
91
+ if (text === 'simple')
92
+ return SIMPLE_TOOLSETS;
93
+ const picked = new Set(['norms']);
94
+ for (const word of text.split(/[\s,]+/)) {
95
+ const alias = {
96
+ norm: 'norms',
97
+ normes: 'norms',
98
+ dossier: 'dossiers',
99
+ deliverables: 'dossiers',
100
+ livrables: 'dossiers',
101
+ site: 'sites',
102
+ ingestion: 'ingest',
103
+ };
104
+ const name = (alias[word] ?? word);
105
+ if (TOOLSETS.includes(name))
106
+ picked.add(name);
107
+ }
108
+ return TOOLSETS.filter((t) => picked.has(t));
109
+ }
110
+ /** Whether a tool is shown under a choice. */
111
+ export function toolInChoice(name, choice) {
112
+ if (choice === null)
113
+ return true;
114
+ const family = toolsetOf(name);
115
+ return family !== null && choice.includes(family);
116
+ }
117
+ /** Whether the choice carries a family (a full choice carries all of them). */
118
+ export function choiceHas(choice, family) {
119
+ return choice === null || choice.includes(family);
120
+ }
121
+ /** The stored form: a sorted list, or `undefined` for full. */
122
+ export function normalizeChoice(choice) {
123
+ if (choice === null)
124
+ return undefined;
125
+ const set = new Set(['norms', ...choice]);
126
+ // Every family turned on is the same as full, and full is how it is stored.
127
+ if (TOOLSETS.every((t) => set.has(t)))
128
+ return undefined;
129
+ return TOOLSETS.filter((t) => set.has(t));
130
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stratta/mcp",
3
3
  "mcpName": "ch.stratta/mcp",
4
- "version": "1.16.1",
4
+ "version": "1.17.0",
5
5
  "description": "MCP server exposing the engineering norms your firm is licensed for (SIA / Eurocodes) to any MCP client, via Stratta TreeRAG.",
6
6
  "license": "UNLICENSED",
7
7
  "author": "SmartFlow <hello@stratta.ch>",
@@ -68,4 +68,4 @@ Before drafting a document (project basis, use agreement, terrain chapter, verif
68
68
  - Do not expose internal identifiers unless the next Stratta tool call requires them.
69
69
  - Ingesting a new norm starts from a PDF on the user's own machine: it goes through the local `@stratta/mcp` server and its `ingest-norm` skill, never through the remote connector.
70
70
 
71
- methodology: v3
71
+ methodology: v4