suppa-mcp-2 1.21.0 → 1.21.1
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/package.json +63 -63
- package/dist/schemaCache.js +0 -112
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "suppa-mcp-2",
|
|
3
|
-
"version": "1.21.
|
|
4
|
-
"description": "MCP server for the Suppa platform (modern.suppa.me) — Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments, with multi-tenant Google auth. Node port of PyPI suppa-mcp.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"suppa-mcp": "dist/bin.js",
|
|
8
|
-
"suppa-entity-guards": "skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
|
|
9
|
-
},
|
|
10
|
-
"main": "dist/bin.js",
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"skills",
|
|
14
|
-
"README.md",
|
|
15
|
-
"LICENSE"
|
|
16
|
-
],
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=18"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
23
|
-
"rebuild": "npm run clean && npm run build",
|
|
24
|
-
"start": "node dist/bin.js",
|
|
25
|
-
"dev": "tsc --watch",
|
|
26
|
-
"test": "node scripts/check-version-literals.mjs && vitest run",
|
|
27
|
-
"postinstall": "node skills/suppa-entity-code/scripts/postinstall.mjs",
|
|
28
|
-
"test:watch": "vitest",
|
|
29
|
-
"prepublishOnly": "npm run
|
|
30
|
-
"inspect": "npx @modelcontextprotocol/inspector node dist/bin.js",
|
|
31
|
-
"schema:gate": "node skills/suppa-entity-code/scripts/entity-code-guard.mjs --ci .",
|
|
32
|
-
"guards:install": "node skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
|
|
33
|
-
},
|
|
34
|
-
"keywords": [
|
|
35
|
-
"mcp",
|
|
36
|
-
"model-context-protocol",
|
|
37
|
-
"suppa",
|
|
38
|
-
"modern-expo",
|
|
39
|
-
"ai",
|
|
40
|
-
"llm",
|
|
41
|
-
"tools",
|
|
42
|
-
"claude",
|
|
43
|
-
"copilot",
|
|
44
|
-
"cursor"
|
|
45
|
-
],
|
|
46
|
-
"license": "MIT",
|
|
47
|
-
"repository": {
|
|
48
|
-
"type": "git",
|
|
49
|
-
"url": "https://git.modern-expo.com/asu/me-development/skills.git",
|
|
50
|
-
"directory": "suppa-mcp-node"
|
|
51
|
-
},
|
|
52
|
-
"homepage": "https://modern.suppa.me",
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
55
|
-
"@napi-rs/keyring": "^1.1.0",
|
|
56
|
-
"zod": "^3.23.8"
|
|
57
|
-
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"@types/node": "^20.0.0",
|
|
60
|
-
"typescript": "^5.6.0",
|
|
61
|
-
"vitest": "^2.1.0"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "suppa-mcp-2",
|
|
3
|
+
"version": "1.21.1",
|
|
4
|
+
"description": "MCP server for the Suppa platform (modern.suppa.me) — Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments, with multi-tenant Google auth. Node port of PyPI suppa-mcp.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"suppa-mcp": "dist/bin.js",
|
|
8
|
+
"suppa-entity-guards": "skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/bin.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"skills",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
23
|
+
"rebuild": "npm run clean && npm run build",
|
|
24
|
+
"start": "node dist/bin.js",
|
|
25
|
+
"dev": "tsc --watch",
|
|
26
|
+
"test": "node scripts/check-version-literals.mjs && vitest run",
|
|
27
|
+
"postinstall": "node skills/suppa-entity-code/scripts/postinstall.mjs",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"prepublishOnly": "npm run rebuild && npm test",
|
|
30
|
+
"inspect": "npx @modelcontextprotocol/inspector node dist/bin.js",
|
|
31
|
+
"schema:gate": "node skills/suppa-entity-code/scripts/entity-code-guard.mjs --ci .",
|
|
32
|
+
"guards:install": "node skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"mcp",
|
|
36
|
+
"model-context-protocol",
|
|
37
|
+
"suppa",
|
|
38
|
+
"modern-expo",
|
|
39
|
+
"ai",
|
|
40
|
+
"llm",
|
|
41
|
+
"tools",
|
|
42
|
+
"claude",
|
|
43
|
+
"copilot",
|
|
44
|
+
"cursor"
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://git.modern-expo.com/asu/me-development/skills.git",
|
|
50
|
+
"directory": "suppa-mcp-node"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://modern.suppa.me",
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
55
|
+
"@napi-rs/keyring": "^1.1.0",
|
|
56
|
+
"zod": "^3.23.8"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^20.0.0",
|
|
60
|
+
"typescript": "^5.6.0",
|
|
61
|
+
"vitest": "^2.1.0"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/dist/schemaCache.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A short-lived, per-tenant cache for entity schema reads.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS EXISTS
|
|
5
|
-
*
|
|
6
|
-
* Every record write pays for the schema twice before it does any work:
|
|
7
|
-
* `GET /api/core/schema` to resolve the entity name, then
|
|
8
|
-
* `GET /api/core/schema/<entity>` to check the field names against the real
|
|
9
|
-
* columns. Measured on suppa_create_record and suppa_update_record, that is two
|
|
10
|
-
* of three requests — and the second one averages ~24 KB. An agent creating ten
|
|
11
|
-
* records in a row fetched the identical schema twenty times.
|
|
12
|
-
*
|
|
13
|
-
* Those two reads are what make the write path SAFE (the platform silently drops
|
|
14
|
-
* unknown keys, so a write that skipped validation would create a record quietly
|
|
15
|
-
* missing its data). They are not optional. They are just repetitive.
|
|
16
|
-
*
|
|
17
|
-
* WHY IT IS SAFE
|
|
18
|
-
*
|
|
19
|
-
* A cache trades freshness for speed, and a stale schema is not a harmless
|
|
20
|
-
* slowdown — it is a wrong answer. Three things bound that:
|
|
21
|
-
*
|
|
22
|
-
* 1. Anything this server does that CHANGES a schema clears the tenant's cache,
|
|
23
|
-
* and the clearing happens in makeRequest, where every builder request must
|
|
24
|
-
* pass. No call site can forget to invalidate, because no call site does it.
|
|
25
|
-
* 2. A short TTL bounds a change made ELSEWHERE — another session, the UI, or
|
|
26
|
-
* the platform's own convergence on application start.
|
|
27
|
-
* 3. The one place staleness could produce a wrong ANSWER rather than a slow
|
|
28
|
-
* one — refusing a write because a field looks unknown — re-reads with
|
|
29
|
-
* `fresh` before it refuses. See _validateRecordWrites.
|
|
30
|
-
*
|
|
31
|
-
* Set SUPPA_SCHEMA_CACHE_TTL=0 to switch it off entirely.
|
|
32
|
-
*/
|
|
33
|
-
/** Seconds a cached schema read stays usable. 0 disables the cache. */
|
|
34
|
-
export const SCHEMA_CACHE_TTL = (() => {
|
|
35
|
-
const raw = process.env.SUPPA_SCHEMA_CACHE_TTL;
|
|
36
|
-
if (raw === undefined || raw === "") {
|
|
37
|
-
return 30;
|
|
38
|
-
}
|
|
39
|
-
const n = Number.parseInt(raw, 10);
|
|
40
|
-
return Number.isFinite(n) && n >= 0 ? n : 30;
|
|
41
|
-
})();
|
|
42
|
-
/** host → (path → entry). Keyed by tenant, because suppa_use_tenant switches. */
|
|
43
|
-
const store = new Map();
|
|
44
|
-
/**
|
|
45
|
-
* Schema READS, and only reads.
|
|
46
|
-
*
|
|
47
|
-
* `/api/core/schema`, `/api/core/schema/<entity>` and the tabular-parts listing
|
|
48
|
-
* hanging off it. Deliberately not `/api/core/builder/...`: those are writes,
|
|
49
|
-
* and a write is what invalidates.
|
|
50
|
-
*/
|
|
51
|
-
export function isCacheableSchemaRead(method, path) {
|
|
52
|
-
if (method.toUpperCase() !== "GET") {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
return /^\/api\/core\/schema(\/|$|\?)/.test(path);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Does this request change what a schema read would return?
|
|
59
|
-
*
|
|
60
|
-
* The entity builder is the whole surface: add-fields, update-field,
|
|
61
|
-
* create-entity, update-options, remove. Data writes (`/api/core/data/...`) move
|
|
62
|
-
* rows, not columns, and leave the schema alone.
|
|
63
|
-
*/
|
|
64
|
-
export function invalidatesSchema(method, path) {
|
|
65
|
-
if (method.toUpperCase() === "GET") {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return path.includes("/api/core/builder/");
|
|
69
|
-
}
|
|
70
|
-
/** A cached value, or MISS. `undefined` is a legal cached value, so use MISS. */
|
|
71
|
-
export const MISS = Symbol("schema-cache-miss");
|
|
72
|
-
export function get(host, path) {
|
|
73
|
-
if (SCHEMA_CACHE_TTL <= 0) {
|
|
74
|
-
return MISS;
|
|
75
|
-
}
|
|
76
|
-
const byPath = store.get(host);
|
|
77
|
-
const entry = byPath?.get(path);
|
|
78
|
-
if (!entry) {
|
|
79
|
-
return MISS;
|
|
80
|
-
}
|
|
81
|
-
if (Date.now() >= entry.expires) {
|
|
82
|
-
byPath.delete(path);
|
|
83
|
-
return MISS;
|
|
84
|
-
}
|
|
85
|
-
return entry.value;
|
|
86
|
-
}
|
|
87
|
-
export function set(host, path, value) {
|
|
88
|
-
if (SCHEMA_CACHE_TTL <= 0) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
let byPath = store.get(host);
|
|
92
|
-
if (!byPath) {
|
|
93
|
-
byPath = new Map();
|
|
94
|
-
store.set(host, byPath);
|
|
95
|
-
}
|
|
96
|
-
byPath.set(path, { value, expires: Date.now() + SCHEMA_CACHE_TTL * 1000 });
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Drop everything cached for one tenant — or, with no argument, for all of them.
|
|
100
|
-
*
|
|
101
|
-
* Coarse on purpose. A builder call can change an entity this server never named
|
|
102
|
-
* (a back-reference lands a column on the OTHER side of a relation), so clearing
|
|
103
|
-
* only the entity in the URL would leave a stale entry behind that nothing would
|
|
104
|
-
* ever correct. The cache refills in one request.
|
|
105
|
-
*/
|
|
106
|
-
export function invalidate(host) {
|
|
107
|
-
if (host === undefined) {
|
|
108
|
-
store.clear();
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
store.delete(host);
|
|
112
|
-
}
|