@usegraft/mcp 1.0.0-beta.2 → 1.0.0-beta.3
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/dist/index.js +30 -14
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -184,7 +184,7 @@ var ERROR_KNOWLEDGE = {
|
|
|
184
184
|
},
|
|
185
185
|
NEEDS_DATABASE: {
|
|
186
186
|
code: "NEEDS_DATABASE",
|
|
187
|
-
meaning: 'This project runs
|
|
187
|
+
meaning: 'This project runs on the static storage engine (index = "static" in graft.config), and the requested feature needs the Postgres engine: db-authoritative collections, typed functions, or database branching.',
|
|
188
188
|
typicalCauses: [
|
|
189
189
|
"A db-authoritative collection or a defineFunction was added to a static-mode project",
|
|
190
190
|
"graft compile --branch <name> was run in static mode (branches are git branches there)"
|
|
@@ -238,6 +238,14 @@ var ERROR_KNOWLEDGE = {
|
|
|
238
238
|
typicalCauses: ["Node older than 22.16 running the CLI or the app server"],
|
|
239
239
|
howToRecover: 'Upgrade Node to 22.16+ (24 LTS recommended), or switch the project to the Postgres index (DATABASE_URL + `export const index = "postgres"`).'
|
|
240
240
|
},
|
|
241
|
+
FRAMEWORK_VERSION_UNSUPPORTED: {
|
|
242
|
+
code: "FRAMEWORK_VERSION_UNSUPPORTED",
|
|
243
|
+
meaning: "An adapter API needs a newer version of the framework than the app has installed. The rest of the adapter still works.",
|
|
244
|
+
typicalCauses: [
|
|
245
|
+
"Calling `updateContent` from @usegraft/sdk-next on Next.js 15. It needs `updateTag`, which Next.js added in 16"
|
|
246
|
+
],
|
|
247
|
+
howToRecover: "Use the fallback the error's `fix` names. For `updateContent` that is `revalidateContent(branch, changes)`, which works on Next.js 15 and 16. Or upgrade the framework."
|
|
248
|
+
},
|
|
241
249
|
SLUG_NOT_UNIQUE: {
|
|
242
250
|
code: "SLUG_NOT_UNIQUE",
|
|
243
251
|
meaning: "Two documents in the same collection resolve to the same slug.",
|
|
@@ -389,7 +397,7 @@ var ERROR_KNOWLEDGE = {
|
|
|
389
397
|
meaning: "`graft add` was asked for a registry item (a copy-in primitive) that does not exist.",
|
|
390
398
|
typicalCauses: [
|
|
391
399
|
"A typo in the item name",
|
|
392
|
-
"Expecting a community/remote item \u2014 only the bundled
|
|
400
|
+
"Expecting a community/remote item \u2014 only the bundled core registry ships today",
|
|
393
401
|
"The item was renamed or removed"
|
|
394
402
|
],
|
|
395
403
|
howToRecover: "The error's `details.available` lists every item you can add. Run `graft add <name>` with one of those, or build the primitive by hand as owned code under graft/."
|
|
@@ -420,7 +428,7 @@ var ERROR_KNOWLEDGE = {
|
|
|
420
428
|
"Re-uploading with the same key instead of picking a new one",
|
|
421
429
|
"Two documents' assets colliding on a generic key like assets/hero.png"
|
|
422
430
|
],
|
|
423
|
-
howToRecover: "Pick a distinct key (e.g. prefix it with the document: pages/pricing/hero.png) \u2014 that is almost always right. Only pass `overwrite: true` when replacing the existing binary is the actual intent; every document referencing that key will show the new bytes."
|
|
431
|
+
howToRecover: "Pick a distinct key (e.g. prefix it with the document: pages/pricing/hero.png) \u2014 that is almost always right. Only pass `overwrite: true` (put_asset) or `--overwrite` (graft asset put) when replacing the existing binary is the actual intent; every document referencing that key will show the new bytes."
|
|
424
432
|
},
|
|
425
433
|
NOT_IMPLEMENTED: {
|
|
426
434
|
code: "NOT_IMPLEMENTED",
|
|
@@ -498,6 +506,10 @@ var DESTROYS = {
|
|
|
498
506
|
idempotentHint: false,
|
|
499
507
|
openWorldHint: false
|
|
500
508
|
};
|
|
509
|
+
var RUNS_PROJECT_CODE = {
|
|
510
|
+
...DESTROYS,
|
|
511
|
+
openWorldHint: true
|
|
512
|
+
};
|
|
501
513
|
|
|
502
514
|
// src/tools/outputs.ts
|
|
503
515
|
import { FunctionDescriptor, RegistryItemDescriptor, SchemaDescription } from "@usegraft/contracts";
|
|
@@ -739,7 +751,7 @@ var registerApprovalTools = (server, deps) => {
|
|
|
739
751
|
|
|
740
752
|
// src/tools/assets.ts
|
|
741
753
|
import { readFileSync } from "fs";
|
|
742
|
-
import { contentTypeFor, defaultKeyFor } from "@usegraft/assets";
|
|
754
|
+
import { AssetKeyTakenError, contentTypeFor, defaultKeyFor } from "@usegraft/assets";
|
|
743
755
|
import { AssetRef } from "@usegraft/core";
|
|
744
756
|
import { resolveContained } from "@usegraft/compiler";
|
|
745
757
|
import { GraftError as GraftError3 } from "@usegraft/contracts";
|
|
@@ -827,16 +839,20 @@ var registerAssetTools = (server, deps) => {
|
|
|
827
839
|
});
|
|
828
840
|
}
|
|
829
841
|
const storage = await getStorage();
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
842
|
+
const keyTaken = () => new GraftError3({
|
|
843
|
+
code: "ASSET_EXISTS",
|
|
844
|
+
message: `Asset key "${key}" already holds a binary.`,
|
|
845
|
+
fix: "Pick a distinct key (the store keeps no version history), or pass overwrite: true if replacing the existing binary is the actual intent.",
|
|
846
|
+
details: { key }
|
|
847
|
+
});
|
|
848
|
+
if (overwrite !== true && await storage.exists(key)) throw keyTaken();
|
|
838
849
|
const type = contentType ?? contentTypeFor(key);
|
|
839
|
-
|
|
850
|
+
try {
|
|
851
|
+
await storage.put(key, bytes, type, { ifAbsent: overwrite !== true });
|
|
852
|
+
} catch (error) {
|
|
853
|
+
if (error instanceof AssetKeyTakenError) throw keyTaken();
|
|
854
|
+
throw error;
|
|
855
|
+
}
|
|
840
856
|
return {
|
|
841
857
|
key,
|
|
842
858
|
contentType: type,
|
|
@@ -1527,7 +1543,7 @@ var registerFunctionTools = (server, deps) => {
|
|
|
1527
1543
|
"run_function",
|
|
1528
1544
|
{
|
|
1529
1545
|
title: "Run a typed function",
|
|
1530
|
-
annotations:
|
|
1546
|
+
annotations: RUNS_PROJECT_CODE,
|
|
1531
1547
|
description: "Invoke a defineFunction by name with a JSON input object. Same pipeline as POST /api/fn/<name>: Zod validation, access rules, rate limits, audit log, and the human gate for destructive ops. The server may already act with a configured identity (graft mcp uses GRAFT_DEV_TOKEN; over HTTP your connection's bearer is forwarded) \u2014 only pass authorization to override it. Pass approval after a human runs `graft approve <id>` for gated calls \u2014 or, where the server has opted into elicited approvals and your client supports elicitation, expect to be asked to confirm in-band and the call completes in one step. The gate is the same either way. Success returns { data, correlationId }; failures are GraftError JSON with a fix.",
|
|
1532
1548
|
inputSchema: {
|
|
1533
1549
|
name: z8.string().describe("Function name (defineFunction name, not the export key)"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usegraft/mcp",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"description": "An MCP server over your content, schema and typed functions, with errors an agent can act on.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
42
|
-
"@usegraft/assets": "1.0.0-beta.
|
|
43
|
-
"@usegraft/compiler": "1.0.0-beta.
|
|
44
|
-
"@usegraft/contracts": "1.0.0-beta.
|
|
45
|
-
"@usegraft/core": "1.0.0-beta.
|
|
46
|
-
"@usegraft/db": "1.0.0-beta.
|
|
47
|
-
"@usegraft/mdx-safety": "1.0.0-beta.
|
|
48
|
-
"@usegraft/registry": "1.0.0-beta.
|
|
42
|
+
"@usegraft/assets": "1.0.0-beta.3",
|
|
43
|
+
"@usegraft/compiler": "1.0.0-beta.3",
|
|
44
|
+
"@usegraft/contracts": "1.0.0-beta.3",
|
|
45
|
+
"@usegraft/core": "1.0.0-beta.3",
|
|
46
|
+
"@usegraft/db": "1.0.0-beta.3",
|
|
47
|
+
"@usegraft/mdx-safety": "1.0.0-beta.3",
|
|
48
|
+
"@usegraft/registry": "1.0.0-beta.3",
|
|
49
49
|
"gray-matter": "^4.0.3",
|
|
50
50
|
"zod": "^4.5.4"
|
|
51
51
|
},
|