@cloudgrid-io/mcp 0.2.5 → 0.2.6
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 +1 -1
- package/src/tools.js +16 -12
- package/src/web.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudgrid-io/mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "MCP server for CloudGrid. Two editions: a local stdio server (full toolset) and a hosted web server (light, CLI-free toolset) over MCP Streamable HTTP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/tools.js
CHANGED
|
@@ -139,10 +139,12 @@ async function runDrop(ctx, { html, path: filePath, filename, anonymous, org, fr
|
|
|
139
139
|
|
|
140
140
|
const form = new FormData();
|
|
141
141
|
// Redrop (anon-redrop spec §6): a re-drop in the same session updates the previous
|
|
142
|
-
// drop in place — same URL, new version. `fresh: true` forces a new drop.
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
|
|
142
|
+
// drop in place — same URL, new version. `fresh: true` forces a new drop. Sent for
|
|
143
|
+
// BOTH anonymous and authed callers: the platform validates ownership and silently
|
|
144
|
+
// falls back to create, so this never hard-fails (authed in-place lands when the
|
|
145
|
+
// platform extends the gate; until then the fallback equals today's behavior).
|
|
146
|
+
// Field appended before the artifact so streaming parsers see it.
|
|
147
|
+
if (fresh !== true && ctx.state.lastDrop?.entity_id) {
|
|
146
148
|
form.append("previous_id", ctx.state.lastDrop.entity_id);
|
|
147
149
|
}
|
|
148
150
|
form.append("artifact", new Blob([bytes], { type }), name);
|
|
@@ -177,14 +179,7 @@ async function runDrop(ctx, { html, path: filePath, filename, anonymous, org, fr
|
|
|
177
179
|
.find((c) => c.startsWith("cg_anon_session="));
|
|
178
180
|
if (anonCookie) ctx.state.anonCookie = anonCookie;
|
|
179
181
|
|
|
180
|
-
|
|
181
|
-
ctx.state.lastAnonClaim = null;
|
|
182
|
-
const lines = [`Published to your org: ${data.url}`, "Owned by you."];
|
|
183
|
-
if (data.expires_at) lines.push(`Expires ${data.expires_at}.`);
|
|
184
|
-
return lines.join("\n");
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Anonymous: remember the drop for redrop continuity (any 2xx outcome).
|
|
182
|
+
// Remember the drop for redrop continuity — any caller class, any 2xx outcome.
|
|
188
183
|
if (data.entity_id || data.url) {
|
|
189
184
|
ctx.state.lastDrop = {
|
|
190
185
|
entity_id: data.entity_id ?? ctx.state.lastDrop?.entity_id ?? null,
|
|
@@ -200,7 +195,16 @@ async function runDrop(ctx, { html, path: filePath, filename, anonymous, org, fr
|
|
|
200
195
|
if (res.status === 200) {
|
|
201
196
|
// Updated in place: same URL, new version, views/reactions intact.
|
|
202
197
|
const lines = [`Updated in place — same link: ${data.url ?? ctx.state.lastDrop?.url ?? ""}`.trim()];
|
|
198
|
+
if (data.owned_by === "authenticated") lines.push("Owned by you.");
|
|
199
|
+
if (data.expires_at) lines.push(`Expires ${data.expires_at}.`);
|
|
200
|
+
return lines.join("\n");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (data.owned_by === "authenticated") {
|
|
204
|
+
ctx.state.lastAnonClaim = null;
|
|
205
|
+
const lines = [`Published to your org: ${data.url}`, "Owned by you."];
|
|
203
206
|
if (data.expires_at) lines.push(`Expires ${data.expires_at}.`);
|
|
207
|
+
lines.push("Drop again in this session to update it in place (same link); pass fresh to start a new one.");
|
|
204
208
|
return lines.join("\n");
|
|
205
209
|
}
|
|
206
210
|
|
package/src/web.js
CHANGED
|
@@ -128,7 +128,7 @@ app.post("/mcp", async (req, res) => {
|
|
|
128
128
|
delete sessionAuth[transport.sessionId];
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
const server = new McpServer({ name: "cloudgrid-mcp-web", version: "0.2.
|
|
131
|
+
const server = new McpServer({ name: "cloudgrid-mcp-web", version: "0.2.6" });
|
|
132
132
|
registerTools(server, makeWebContext(newSessionId));
|
|
133
133
|
await server.connect(transport);
|
|
134
134
|
await transport.handleRequest(req, res, req.body);
|