caelario-mcp 0.1.5 → 0.1.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/README.md +47 -42
- package/package.json +55 -55
- package/server.json +32 -32
- package/src/install.js +107 -105
- package/src/server.js +242 -195
package/README.md
CHANGED
|
@@ -1,42 +1,47 @@
|
|
|
1
|
-
# Caelario MCP
|
|
2
|
-
|
|
3
|
-
MCP server for social media data from Instagram, TikTok, YouTube, X and
|
|
4
|
-
Facebook. Run extractions, search and discovery, batches, schedules, saved
|
|
5
|
-
results and usage workflows through Caelario.
|
|
6
|
-
|
|
7
|
-
Source: <https://github.com/chunkydonut21/caelario-mcp>
|
|
8
|
-
|
|
9
|
-
The official local server gives Codex and Claude Code typed tools for capability
|
|
10
|
-
discovery, immediate and durable extraction, result pagination, and credit
|
|
11
|
-
estimates.
|
|
12
|
-
|
|
13
|
-
## Install for Codex
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npx -y caelario-mcp install codex
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Install for Claude Code
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npx -y caelario-mcp install claude
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
The installer prompts for a Caelario workspace API key and registers the stdio
|
|
26
|
-
server at user scope. It does not ask for Instagram, TikTok, YouTube, X, or
|
|
27
|
-
Facebook credentials; provider identities are managed by Caelario.
|
|
28
|
-
|
|
29
|
-
After installation, restart the client and ask:
|
|
30
|
-
|
|
31
|
-
> Use Caelario to get Nike's Instagram profile and 10 recent posts.
|
|
32
|
-
|
|
33
|
-
The package requires Node.js 20 or newer. See
|
|
34
|
-
<https://caelario.com/mcp-server> for security, billing, and tool details.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
# Caelario MCP
|
|
2
|
+
|
|
3
|
+
MCP server for social media data from Instagram, TikTok, YouTube, X and
|
|
4
|
+
Facebook. Run extractions, search and discovery, batches, schedules, saved
|
|
5
|
+
results and usage workflows through Caelario.
|
|
6
|
+
|
|
7
|
+
Source: <https://github.com/chunkydonut21/caelario-mcp>
|
|
8
|
+
|
|
9
|
+
The official local server gives Codex and Claude Code typed tools for capability
|
|
10
|
+
discovery, immediate and durable extraction, result pagination, and credit
|
|
11
|
+
estimates.
|
|
12
|
+
|
|
13
|
+
## Install for Codex
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx -y caelario-mcp install codex
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Install for Claude Code
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx -y caelario-mcp install claude
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The installer prompts for a Caelario workspace API key and registers the stdio
|
|
26
|
+
server at user scope. It does not ask for Instagram, TikTok, YouTube, X, or
|
|
27
|
+
Facebook credentials; provider identities are managed by Caelario.
|
|
28
|
+
|
|
29
|
+
After installation, restart the client and ask:
|
|
30
|
+
|
|
31
|
+
> Use Caelario to get Nike's Instagram profile and 10 recent posts.
|
|
32
|
+
|
|
33
|
+
The package requires Node.js 20 or newer. See
|
|
34
|
+
<https://caelario.com/mcp-server> for security, billing, and tool details.
|
|
35
|
+
|
|
36
|
+
If a request times out, reuse the `idempotency_key` returned in the tool error
|
|
37
|
+
with identical arguments. This recovers the original request instead of starting
|
|
38
|
+
another paid extraction. The default HTTP timeout is 120 seconds; failed job
|
|
39
|
+
results include their error and remain marked as not ready.
|
|
40
|
+
|
|
41
|
+
The connector is released under the MIT License. Caelario's hosted API,
|
|
42
|
+
provider implementations, acquisition infrastructure, and managed identities
|
|
43
|
+
are separate proprietary services and are not included in this package.
|
|
44
|
+
|
|
45
|
+
The npm artifact also includes official MCP Registry metadata under
|
|
46
|
+
`io.github.chunkydonut21/caelario`. npm publication must happen before the
|
|
47
|
+
separate Registry publication step.
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "caelario-mcp",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"mcpName": "io.github.chunkydonut21/caelario",
|
|
5
|
-
"description": "MCP server for social media data from Instagram, TikTok, YouTube, X and Facebook. Run extractions, batches, schedules, saved results and usage workflows through Caelario.",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"homepage": "https://caelario.com/mcp-server",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/chunkydonut21/caelario-mcp.git"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/chunkydonut21/caelario-mcp/issues"
|
|
15
|
-
},
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
},
|
|
19
|
-
"bin": {
|
|
20
|
-
"caelario-mcp": "bin/caelario-mcp.js"
|
|
21
|
-
},
|
|
22
|
-
"files": [
|
|
23
|
-
"bin",
|
|
24
|
-
"src",
|
|
25
|
-
"README.md",
|
|
26
|
-
"server.json"
|
|
27
|
-
],
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=20"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"test": "node --test test/*.test.js",
|
|
33
|
-
"pack:check": "npm pack --dry-run --cache .npm-cache"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@modelcontextprotocol/server": "^2.
|
|
37
|
-
"zod": "^4.
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@modelcontextprotocol/client": "^2.
|
|
41
|
-
},
|
|
42
|
-
"keywords": [
|
|
43
|
-
"caelario",
|
|
44
|
-
"mcp",
|
|
45
|
-
"model-context-protocol",
|
|
46
|
-
"social-data",
|
|
47
|
-
"instagram",
|
|
48
|
-
"tiktok",
|
|
49
|
-
"youtube",
|
|
50
|
-
"facebook",
|
|
51
|
-
"twitter",
|
|
52
|
-
"codex",
|
|
53
|
-
"claude"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "caelario-mcp",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"mcpName": "io.github.chunkydonut21/caelario",
|
|
5
|
+
"description": "MCP server for social media data from Instagram, TikTok, YouTube, X and Facebook. Run extractions, batches, schedules, saved results and usage workflows through Caelario.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://caelario.com/mcp-server",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/chunkydonut21/caelario-mcp.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/chunkydonut21/caelario-mcp/issues"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"caelario-mcp": "bin/caelario-mcp.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"bin",
|
|
24
|
+
"src",
|
|
25
|
+
"README.md",
|
|
26
|
+
"server.json"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "node --test test/*.test.js",
|
|
33
|
+
"pack:check": "npm pack --dry-run --cache .npm-cache"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
37
|
+
"zod": "^4.6.7"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@modelcontextprotocol/client": "^2.4.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"caelario",
|
|
44
|
+
"mcp",
|
|
45
|
+
"model-context-protocol",
|
|
46
|
+
"social-data",
|
|
47
|
+
"instagram",
|
|
48
|
+
"tiktok",
|
|
49
|
+
"youtube",
|
|
50
|
+
"facebook",
|
|
51
|
+
"twitter",
|
|
52
|
+
"codex",
|
|
53
|
+
"claude"
|
|
54
|
+
]
|
|
55
|
+
}
|
package/server.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
-
"name": "io.github.chunkydonut21/caelario",
|
|
4
|
-
"title": "Caelario",
|
|
5
|
-
"description": "MCP server for Instagram, TikTok, YouTube, X and Facebook data extraction and automation.",
|
|
6
|
-
"websiteUrl": "https://caelario.com/mcp-server",
|
|
7
|
-
"repository": {
|
|
8
|
-
"url": "https://github.com/chunkydonut21/caelario-mcp",
|
|
9
|
-
"source": "github",
|
|
10
|
-
"id": "1346708115"
|
|
11
|
-
},
|
|
12
|
-
"version": "0.1.
|
|
13
|
-
"packages": [
|
|
14
|
-
{
|
|
15
|
-
"registryType": "npm",
|
|
16
|
-
"identifier": "caelario-mcp",
|
|
17
|
-
"version": "0.1.
|
|
18
|
-
"transport": {
|
|
19
|
-
"type": "stdio"
|
|
20
|
-
},
|
|
21
|
-
"environmentVariables": [
|
|
22
|
-
{
|
|
23
|
-
"description": "A revocable Caelario workspace API key from the Developers page.",
|
|
24
|
-
"isRequired": true,
|
|
25
|
-
"format": "string",
|
|
26
|
-
"isSecret": true,
|
|
27
|
-
"name": "CAELARIO_API_KEY"
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.chunkydonut21/caelario",
|
|
4
|
+
"title": "Caelario",
|
|
5
|
+
"description": "MCP server for Instagram, TikTok, YouTube, X and Facebook data extraction and automation.",
|
|
6
|
+
"websiteUrl": "https://caelario.com/mcp-server",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/chunkydonut21/caelario-mcp",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"id": "1346708115"
|
|
11
|
+
},
|
|
12
|
+
"version": "0.1.6",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"identifier": "caelario-mcp",
|
|
17
|
+
"version": "0.1.6",
|
|
18
|
+
"transport": {
|
|
19
|
+
"type": "stdio"
|
|
20
|
+
},
|
|
21
|
+
"environmentVariables": [
|
|
22
|
+
{
|
|
23
|
+
"description": "A revocable Caelario workspace API key from the Developers page.",
|
|
24
|
+
"isRequired": true,
|
|
25
|
+
"format": "string",
|
|
26
|
+
"isSecret": true,
|
|
27
|
+
"name": "CAELARIO_API_KEY"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
package/src/install.js
CHANGED
|
@@ -1,105 +1,107 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import readline from "node:readline";
|
|
4
|
-
|
|
5
|
-
const CLIENTS = new Set(["codex", "claude"]);
|
|
6
|
-
const KEY_PATTERN = /^[A-Za-z0-9._-]{16,256}$/;
|
|
7
|
-
|
|
8
|
-
export function registrationCommand(client, apiKey, apiUrl = "https://api.caelario.com", platform = process.platform) {
|
|
9
|
-
if (!CLIENTS.has(client)) throw new Error("client must be codex or claude");
|
|
10
|
-
if (!KEY_PATTERN.test(apiKey)) throw new Error("the Caelario API key format is invalid");
|
|
11
|
-
const origin = new URL(apiUrl);
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"mcp", "
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"--
|
|
27
|
-
"
|
|
28
|
-
"--",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
process.
|
|
68
|
-
process.stdin.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
process.stdin.
|
|
75
|
-
process.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (character === "\
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
" npx -y caelario-mcp
|
|
100
|
-
"",
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import readline from "node:readline";
|
|
4
|
+
|
|
5
|
+
const CLIENTS = new Set(["codex", "claude"]);
|
|
6
|
+
const KEY_PATTERN = /^[A-Za-z0-9._-]{16,256}$/;
|
|
7
|
+
|
|
8
|
+
export function registrationCommand(client, apiKey, apiUrl = "https://api.caelario.com", platform = process.platform) {
|
|
9
|
+
if (!CLIENTS.has(client)) throw new Error("client must be codex or claude");
|
|
10
|
+
if (!KEY_PATTERN.test(apiKey)) throw new Error("the Caelario API key format is invalid");
|
|
11
|
+
const origin = new URL(apiUrl);
|
|
12
|
+
if (!["http:", "https:"].includes(origin.protocol)) throw new Error("the Caelario API URL requires HTTP or HTTPS");
|
|
13
|
+
if (/[&|<>^%!()\r\n]/.test(origin.origin)) throw new Error("the Caelario API origin contains unsafe launcher characters");
|
|
14
|
+
if (origin.protocol !== "https:" && !["localhost", "127.0.0.1", "[::1]"].includes(origin.hostname)) {
|
|
15
|
+
throw new Error("the Caelario API URL must use HTTPS");
|
|
16
|
+
}
|
|
17
|
+
if (origin.pathname !== "/" || origin.search || origin.hash || origin.username || origin.password) {
|
|
18
|
+
throw new Error("the Caelario API URL must contain only an origin");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const launcher = platform === "win32"
|
|
22
|
+
? ["cmd", "/c", "npx", "-y", "caelario-mcp", "serve"]
|
|
23
|
+
: ["npx", "-y", "caelario-mcp", "serve"];
|
|
24
|
+
const common = [
|
|
25
|
+
"mcp", "add",
|
|
26
|
+
...(client === "claude" ? ["--scope", "user"] : []),
|
|
27
|
+
"caelario",
|
|
28
|
+
"--env", `CAELARIO_API_URL=${origin.origin}`,
|
|
29
|
+
"--env", `CAELARIO_API_KEY=${apiKey}`,
|
|
30
|
+
"--",
|
|
31
|
+
...launcher,
|
|
32
|
+
];
|
|
33
|
+
return { command: client, args: common };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function installClient(
|
|
37
|
+
client,
|
|
38
|
+
{
|
|
39
|
+
apiKey = process.env.CAELARIO_API_KEY,
|
|
40
|
+
apiUrl = process.env.CAELARIO_API_URL || "https://api.caelario.com",
|
|
41
|
+
platform = process.platform,
|
|
42
|
+
spawn = spawnSync,
|
|
43
|
+
} = {},
|
|
44
|
+
) {
|
|
45
|
+
if (!CLIENTS.has(client)) throw new Error("client must be codex or claude");
|
|
46
|
+
const key = apiKey?.trim() || await promptSecret("Paste your Caelario API key: ");
|
|
47
|
+
const registration = registrationCommand(client, key, apiUrl, platform);
|
|
48
|
+
const completed = spawn(registration.command, registration.args, {
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
windowsHide: true,
|
|
51
|
+
shell: platform === "win32",
|
|
52
|
+
});
|
|
53
|
+
if (completed.error?.code === "ENOENT") {
|
|
54
|
+
throw new Error(`${client === "codex" ? "Codex" : "Claude Code"} CLI was not found. Install it, then run this command again.`);
|
|
55
|
+
}
|
|
56
|
+
if (completed.error) throw completed.error;
|
|
57
|
+
if (completed.status !== 0) {
|
|
58
|
+
throw new Error(`${client === "codex" ? "Codex" : "Claude Code"} rejected the MCP registration (exit ${completed.status ?? "unknown"})`);
|
|
59
|
+
}
|
|
60
|
+
process.stderr.write(`Caelario is connected to ${client === "codex" ? "Codex" : "Claude Code"}. Restart the client, then ask it to use Caelario.\n`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function promptSecret(prompt) {
|
|
64
|
+
if (!process.stdin.isTTY || !process.stderr.isTTY) {
|
|
65
|
+
throw new Error("set CAELARIO_API_KEY when running the installer non-interactively");
|
|
66
|
+
}
|
|
67
|
+
process.stderr.write(prompt);
|
|
68
|
+
process.stdin.setRawMode?.(true);
|
|
69
|
+
process.stdin.resume();
|
|
70
|
+
process.stdin.setEncoding("utf8");
|
|
71
|
+
let value = "";
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
const finish = (error) => {
|
|
74
|
+
process.stdin.setRawMode?.(false);
|
|
75
|
+
process.stdin.pause();
|
|
76
|
+
process.stdin.removeListener("data", onData);
|
|
77
|
+
process.stderr.write("\n");
|
|
78
|
+
if (error) reject(error); else resolve(value);
|
|
79
|
+
};
|
|
80
|
+
const onData = (chunk) => {
|
|
81
|
+
for (const character of chunk) {
|
|
82
|
+
if (character === "\r" || character === "\n") return finish();
|
|
83
|
+
if (character === "\u0003") return finish(new Error("installation cancelled"));
|
|
84
|
+
if (character === "\u007f" || character === "\b") {
|
|
85
|
+
value = value.slice(0, -1);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
value += character;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
process.stdin.on("data", onData);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function printHelp() {
|
|
96
|
+
const output = [
|
|
97
|
+
"Caelario MCP",
|
|
98
|
+
"",
|
|
99
|
+
" npx -y caelario-mcp install codex Register for Codex (user-wide)",
|
|
100
|
+
" npx -y caelario-mcp install claude Register for Claude Code (user-wide)",
|
|
101
|
+
" npx -y caelario-mcp serve Run the stdio server",
|
|
102
|
+
"",
|
|
103
|
+
"The guided installer securely prompts for CAELARIO_API_KEY.",
|
|
104
|
+
];
|
|
105
|
+
readline.clearLine(process.stderr, 0);
|
|
106
|
+
process.stderr.write(`${output.join("\n")}\n`);
|
|
107
|
+
}
|
package/src/server.js
CHANGED
|
@@ -1,195 +1,242 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (baseUrl.
|
|
20
|
-
throw new Error("CAELARIO_API_URL
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
tool("
|
|
185
|
-
tool("
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
5
|
+
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
6
|
+
import * as z from "zod/v4";
|
|
7
|
+
|
|
8
|
+
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
9
|
+
const TERMINAL = new Set(["completed", "failed", "cancelled"]);
|
|
10
|
+
const operation = z.string().min(1).max(64).describe("Operation returned by discover_platforms");
|
|
11
|
+
const platform = z.string().min(1).max(32).describe("Platform returned by discover_platforms");
|
|
12
|
+
const id = z.string().regex(/^[A-Za-z0-9_-]{1,128}$/);
|
|
13
|
+
|
|
14
|
+
function apiConfiguration() {
|
|
15
|
+
const apiKey = (process.env.CAELARIO_API_KEY || "").trim();
|
|
16
|
+
if (!apiKey) throw new Error("CAELARIO_API_KEY is required; run `npx -y caelario-mcp install codex` or `install claude`");
|
|
17
|
+
const baseUrl = new URL(process.env.CAELARIO_API_URL || "https://api.caelario.com");
|
|
18
|
+
if (!["https:", "http:"].includes(baseUrl.protocol)) throw new Error("CAELARIO_API_URL requires HTTP or HTTPS");
|
|
19
|
+
if (baseUrl.protocol !== "https:" && !["localhost", "127.0.0.1", "[::1]"].includes(baseUrl.hostname)) {
|
|
20
|
+
throw new Error("CAELARIO_API_URL requires HTTPS except on loopback");
|
|
21
|
+
}
|
|
22
|
+
if (baseUrl.pathname !== "/" || baseUrl.search || baseUrl.hash || baseUrl.username || baseUrl.password) {
|
|
23
|
+
throw new Error("CAELARIO_API_URL must contain only an API origin");
|
|
24
|
+
}
|
|
25
|
+
return { apiKey, baseUrl: baseUrl.origin };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class ApiError extends Error {
|
|
29
|
+
constructor(message, metadata = {}) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.metadata = metadata;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function api(method, path, { body, params, idempotencyKey } = {}) {
|
|
36
|
+
const { apiKey, baseUrl } = apiConfiguration();
|
|
37
|
+
const timeout = Number(process.env.CAELARIO_MCP_TIMEOUT_MS || 120_000);
|
|
38
|
+
if (!Number.isSafeInteger(timeout) || timeout <= 0 || timeout > 2_147_483_647) {
|
|
39
|
+
throw new Error("CAELARIO_MCP_TIMEOUT_MS must be a positive integer");
|
|
40
|
+
}
|
|
41
|
+
const url = new URL(path, `${baseUrl}/`);
|
|
42
|
+
for (const [key, value] of Object.entries(params || {})) {
|
|
43
|
+
if (value !== undefined && value !== null) url.searchParams.set(key, String(value));
|
|
44
|
+
}
|
|
45
|
+
const recovery = idempotencyKey ? {
|
|
46
|
+
idempotency_key: idempotencyKey,
|
|
47
|
+
retry_instruction: "Use this idempotency_key with identical arguments to recover the original request; check its job status before starting a new request.",
|
|
48
|
+
} : {};
|
|
49
|
+
let response;
|
|
50
|
+
try {
|
|
51
|
+
response = await fetch(url, {
|
|
52
|
+
method,
|
|
53
|
+
redirect: "manual",
|
|
54
|
+
headers: {
|
|
55
|
+
Accept: "application/json",
|
|
56
|
+
"Content-Type": "application/json",
|
|
57
|
+
"X-API-Key": apiKey,
|
|
58
|
+
...(idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}),
|
|
59
|
+
},
|
|
60
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
61
|
+
signal: AbortSignal.timeout(timeout),
|
|
62
|
+
});
|
|
63
|
+
} catch {
|
|
64
|
+
throw new ApiError("The Caelario API request could not complete. Its outcome is unknown.", {
|
|
65
|
+
error: "api_transport_error", retryable: true, outcome_unknown: true, ...recovery,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (response.status === 204) return null;
|
|
69
|
+
let payload;
|
|
70
|
+
try {
|
|
71
|
+
payload = await response.json();
|
|
72
|
+
} catch {
|
|
73
|
+
throw new ApiError("The Caelario API returned an invalid response. Check the request before retrying.", {
|
|
74
|
+
error: "invalid_api_response", status_code: response.status,
|
|
75
|
+
retryable: true, outcome_unknown: Boolean(idempotencyKey), ...recovery,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
const detail = payload?.detail;
|
|
80
|
+
const code = typeof detail === "object" ? detail?.error : undefined;
|
|
81
|
+
const message = typeof detail === "object" ? detail?.message : typeof detail === "string" ? detail : undefined;
|
|
82
|
+
const safeMessage = typeof message === "string" ? message.replaceAll(apiKey, "[redacted]") : undefined;
|
|
83
|
+
const jobId = typeof detail?.job_id === "string" && /^[A-Za-z0-9_-]{1,128}$/.test(detail.job_id) ? detail.job_id : undefined;
|
|
84
|
+
throw new ApiError(`Caelario API request failed (${response.status})${safeMessage ? `: ${safeMessage}` : ""}`, {
|
|
85
|
+
error: typeof code === "string" && /^[a-z0-9_]{1,64}$/.test(code) ? code : "api_request_failed",
|
|
86
|
+
status_code: response.status, retryable: Boolean(detail?.retryable),
|
|
87
|
+
outcome_unknown: false, ...(jobId ? { job_id: jobId } : {}), ...recovery,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return payload;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function response(value) {
|
|
94
|
+
return {
|
|
95
|
+
content: [{ type: "text", text: JSON.stringify(value) }],
|
|
96
|
+
structuredContent: { result: value },
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function withoutResult(job) {
|
|
101
|
+
if (!job || typeof job !== "object") return job;
|
|
102
|
+
const { result: _result, ...summary } = job;
|
|
103
|
+
return summary;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function capabilityFor(catalog, platformName, operationName) {
|
|
107
|
+
const definition = catalog.find((item) => item.platform === platformName.toLowerCase());
|
|
108
|
+
const capability = definition?.operations?.find((item) => item.operation === operationName);
|
|
109
|
+
if (!definition || !capability) throw new Error(`Unsupported operation: ${platformName}/${operationName}`);
|
|
110
|
+
return { definition, capability };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function billing(capability) {
|
|
114
|
+
if (capability.base_credits && !capability.credits_per_result) {
|
|
115
|
+
return `${capability.base_credits} credits for a non-empty collection; valid empty results cost 0.`;
|
|
116
|
+
}
|
|
117
|
+
if (capability.results_per_credit > 1) {
|
|
118
|
+
return `${capability.credits_per_result} credits per ${capability.results_per_credit} delivered results, rounded up.`;
|
|
119
|
+
}
|
|
120
|
+
return `${capability.credits_per_result} credit${capability.credits_per_result === 1 ? "" : "s"} per delivered result.`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function pagedResult(job, offset, limit, textOffset, textLimit) {
|
|
124
|
+
const page = (value) => Array.isArray(value) ? value.slice(offset, offset + limit) : value;
|
|
125
|
+
let result = job.result;
|
|
126
|
+
const pagination = {};
|
|
127
|
+
if (Array.isArray(result)) {
|
|
128
|
+
pagination.result = pageInfo(result.length, offset, limit);
|
|
129
|
+
result = page(result);
|
|
130
|
+
} else if (result && typeof result === "object") {
|
|
131
|
+
result = { ...result };
|
|
132
|
+
for (const [key, value] of Object.entries(result)) {
|
|
133
|
+
if (Array.isArray(value)) {
|
|
134
|
+
pagination[key] = pageInfo(value.length, offset, limit);
|
|
135
|
+
result[key] = page(value);
|
|
136
|
+
} else if (typeof value === "string" && (textOffset || value.length > textLimit)) {
|
|
137
|
+
pagination[key] = pageInfo(value.length, textOffset, textLimit);
|
|
138
|
+
result[key] = value.slice(textOffset, textOffset + textLimit);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { job_id: job.id, status: job.status, error: job.error ?? null, request_cursor: job.request_cursor ?? null, ready: job.status === "completed" && job.result != null, result_count: job.result_count, billed_credits: job.billed_credits, source_exhausted: Boolean(job.source_exhausted), next_cursor: job.next_cursor ?? null, result, pagination };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function pageInfo(total, offset, limit) {
|
|
146
|
+
const returned = Math.max(0, Math.min(limit, total - offset));
|
|
147
|
+
return { offset, limit, returned, total, next_offset: offset + returned < total ? offset + returned : null };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function requestBody(input) {
|
|
151
|
+
return { platform: input.platform, operation: input.operation, target: input.target, limit: input.limit, include_posts: input.include_posts, cursor: input.cursor ?? null };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const extractionSchema = z.object({
|
|
155
|
+
platform,
|
|
156
|
+
operation,
|
|
157
|
+
target: z.string().min(1).max(2_000),
|
|
158
|
+
limit: z.number().int().min(1).max(25_000).default(12),
|
|
159
|
+
include_posts: z.number().int().min(0).max(200).default(0),
|
|
160
|
+
cursor: z.string().max(8_000).optional(),
|
|
161
|
+
idempotency_key: z.string().min(1).max(128).optional(),
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export function createServer() {
|
|
165
|
+
const server = new McpServer(
|
|
166
|
+
{ name: "Caelario", version: VERSION },
|
|
167
|
+
{ instructions: "Use discover_platforms and get_operation_guide before unfamiliar or expensive work. Prefer extract_now for one bounded target. Use durable jobs or batches for larger work, then wait and page the result. Only a Caelario workspace API key is needed; never ask users for social-network credentials." },
|
|
168
|
+
);
|
|
169
|
+
const tool = (name, description, inputSchema, handler) => server.registerTool(name, { description, inputSchema }, async (input) => {
|
|
170
|
+
try {
|
|
171
|
+
return response(await handler(input));
|
|
172
|
+
} catch (error) {
|
|
173
|
+
const failure = { message: error.message, ...(error instanceof ApiError ? error.metadata : { error: "mcp_request_failed" }) };
|
|
174
|
+
return { isError: true, content: [{ type: "text", text: JSON.stringify(failure) }] };
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
tool("discover_platforms", "List every Caelario platform, operation, limit, and price.", z.object({}), () => api("GET", "/v1/platforms"));
|
|
179
|
+
tool("get_operation_guide", "Explain and validate one operation before spending credits.", z.object({ platform, operation }), async (input) => {
|
|
180
|
+
const catalog = await api("GET", "/v1/platforms");
|
|
181
|
+
const { capability } = capabilityFor(catalog, input.platform, input.operation);
|
|
182
|
+
return { platform: input.platform.toLowerCase(), operation: input.operation, capability, billing: billing(capability) };
|
|
183
|
+
});
|
|
184
|
+
tool("get_account", "Return workspace identity and extraction limits.", z.object({}), () => api("GET", "/v1/account"));
|
|
185
|
+
tool("get_credit_usage", "Return available, reserved, promotional, purchased, and spent credits.", z.object({}), () => api("GET", "/v1/usage/current"));
|
|
186
|
+
tool("estimate_credits", "Estimate the maximum reservation for one or many targets before starting work.", z.object({ platform, operation, limit: z.number().int().min(1).max(25_000).default(12), include_posts: z.number().int().min(0).max(200).default(0), target_count: z.number().int().min(1).max(100).default(1) }), async (input) => {
|
|
187
|
+
const catalog = await api("GET", "/v1/platforms");
|
|
188
|
+
const { definition, capability } = capabilityFor(catalog, input.platform, input.operation);
|
|
189
|
+
const single = new Set(["profile", "post", "video", "transcript", "adlibrary_ad", "adlibrary_ad_transcript", "profile_analytics", "playlist"]);
|
|
190
|
+
const fixedCollection = input.platform.toLowerCase() === "instagram" && new Set(["highlights", "highlight_items", "stories"]).has(input.operation);
|
|
191
|
+
const normalizedLimit = single.has(input.operation) ? 1 : fixedCollection ? capability.max_results : input.limit;
|
|
192
|
+
if (normalizedLimit > capability.max_results) throw new Error(`limit exceeds the platform maximum of ${capability.max_results}`);
|
|
193
|
+
if (input.include_posts && input.operation !== "profile") throw new Error("include_posts is supported only for profile requests");
|
|
194
|
+
const posts = input.include_posts ? definition.operations.find((item) => item.operation === "posts") : null;
|
|
195
|
+
if (input.include_posts > (posts?.max_results || 0)) throw new Error(`include_posts exceeds the platform maximum of ${posts?.max_results || 0}`);
|
|
196
|
+
// Profile bundles use the backend's included_credit_rate. Standalone post
|
|
197
|
+
// list grouping does not apply to posts embedded in a profile request.
|
|
198
|
+
const included = input.include_posts * (posts?.credits_per_result || 0);
|
|
199
|
+
const perTarget = capability.base_credits + Math.ceil(normalizedLimit * capability.credits_per_result / Math.max(1, capability.results_per_credit)) + Math.ceil(included);
|
|
200
|
+
return { ...input, normalized_limit: normalizedLimit, maximum_reserved_credits_per_target: perTarget, maximum_reserved_credits_total: perTarget * input.target_count, settlement: "Actual billing uses delivered results and releases unused reservation." };
|
|
201
|
+
});
|
|
202
|
+
tool("extract_now", "Run one bounded target synchronously and return a model-safe result page.", extractionSchema.extend({ result_offset: z.number().int().min(0).default(0), result_limit: z.number().int().min(1).max(100).default(50), text_offset: z.number().int().min(0).default(0), text_limit: z.number().int().min(1).max(50_000).default(20_000) }), async (input) => {
|
|
203
|
+
const idempotencyKey = input.idempotency_key || randomUUID();
|
|
204
|
+
const job = await api("POST", "/v1/extract", { body: requestBody(input), idempotencyKey });
|
|
205
|
+
return { idempotency_key: idempotencyKey, ...pagedResult(job, input.result_offset, input.result_limit, input.text_offset, input.text_limit) };
|
|
206
|
+
});
|
|
207
|
+
tool("create_extraction", "Create one durable extraction job for work that may continue in the background.", extractionSchema, async (input) => {
|
|
208
|
+
const idempotencyKey = input.idempotency_key || randomUUID();
|
|
209
|
+
return { idempotency_key: idempotencyKey, job: withoutResult(await api("POST", "/v1/jobs", { body: requestBody(input), idempotencyKey })) };
|
|
210
|
+
});
|
|
211
|
+
tool("list_extractions", "List recent durable extraction jobs without embedding their large results.", z.object({ limit: z.number().int().min(1).max(100).default(25) }), (input) => api("GET", "/v1/jobs", { params: input }));
|
|
212
|
+
tool("get_extraction", "Get one job's progress, billing, and error metadata.", z.object({ job_id: id }), async ({ job_id }) => withoutResult(await api("GET", `/v1/jobs/${job_id}`)));
|
|
213
|
+
tool("get_extraction_result", "Page through a completed job's structured result without flooding model context.", z.object({ job_id: id, offset: z.number().int().min(0).default(0), limit: z.number().int().min(1).max(100).default(50), text_offset: z.number().int().min(0).default(0), text_limit: z.number().int().min(1).max(50_000).default(20_000) }), async (input) => pagedResult(await api("GET", `/v1/jobs/${input.job_id}`), input.offset, input.limit, input.text_offset, input.text_limit));
|
|
214
|
+
tool("wait_for_extraction", "Wait briefly for a durable job to become terminal without returning its large result.", z.object({ job_id: id, timeout_seconds: z.number().min(1).max(120).default(60), poll_interval_seconds: z.number().min(.5).max(10).default(2) }), async (input) => {
|
|
215
|
+
const deadline = Date.now() + input.timeout_seconds * 1_000;
|
|
216
|
+
while (true) {
|
|
217
|
+
const job = await api("GET", `/v1/jobs/${input.job_id}`);
|
|
218
|
+
if (TERMINAL.has(job.status)) return { timed_out: false, job: withoutResult(job) };
|
|
219
|
+
if (Date.now() >= deadline) return { timed_out: true, job: withoutResult(job) };
|
|
220
|
+
await new Promise((resolve) => setTimeout(resolve, input.poll_interval_seconds * 1_000));
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
tool("cancel_extraction", "Cancel a queued job or request cancellation of a running job.", z.object({ job_id: id }), ({ job_id }) => api("POST", `/v1/jobs/${job_id}/cancel`));
|
|
224
|
+
tool("create_batch", "Run one operation for up to 100 targets as an expandable durable batch.", z.object({ platform, operation, targets: z.array(z.string().min(1).max(2_000)).min(1).max(100), limit: z.number().int().min(1).max(25_000).default(12), include_posts: z.number().int().min(0).max(200).default(0), idempotency_key: z.string().min(1).max(128).optional() }), async ({ idempotency_key, ...input }) => {
|
|
225
|
+
const idempotencyKey = idempotency_key || randomUUID();
|
|
226
|
+
return { idempotency_key: idempotencyKey, batch: await api("POST", "/v1/batches", { body: input, idempotencyKey }) };
|
|
227
|
+
});
|
|
228
|
+
tool("list_batches", "List recent batches and optionally their child jobs.", z.object({ limit: z.number().int().min(1).max(100).default(25), include_jobs: z.boolean().default(false) }), (input) => api("GET", "/v1/batches", { params: input }));
|
|
229
|
+
tool("get_batch", "Get aggregate status and child jobs for one batch.", z.object({ batch_id: id }), ({ batch_id }) => api("GET", `/v1/batches/${batch_id}`));
|
|
230
|
+
tool("cancel_batch", "Cancel queued batch children and request cancellation of running children.", z.object({ batch_id: id }), ({ batch_id }) => api("POST", `/v1/batches/${batch_id}/cancel`));
|
|
231
|
+
tool("list_schedules", "List active and paused extraction schedules.", z.object({ limit: z.number().int().min(1).max(100).default(50) }), (input) => api("GET", "/v1/schedules", { params: input }));
|
|
232
|
+
tool("get_schedule", "Get one schedule and its recent run history.", z.object({ schedule_id: id }), ({ schedule_id }) => api("GET", `/v1/schedules/${schedule_id}`));
|
|
233
|
+
const scheduleSchema = z.object({ name: z.string().min(1).max(120), platform, operation, targets: z.array(z.string().min(1).max(2_000)).min(1).max(100), frequency: z.enum(["once", "daily", "weekly", "monthly"]), timezone: z.string().min(1).max(100), starts_at: z.iso.datetime({ offset: true }), limit: z.number().int().min(1).max(25_000).default(12), include_posts: z.number().int().min(0).max(200).default(0) });
|
|
234
|
+
tool("create_schedule", "Create a timezone-aware once, daily, weekly, or monthly extraction schedule.", scheduleSchema, (input) => api("POST", "/v1/schedules", { body: { ...input, overlap_policy: "skip" } }));
|
|
235
|
+
tool("update_schedule", "Replace a schedule definition while preserving its run history.", scheduleSchema.extend({ schedule_id: id }), ({ schedule_id, ...input }) => api("PUT", `/v1/schedules/${schedule_id}`, { body: { ...input, overlap_policy: "skip" } }));
|
|
236
|
+
tool("manage_schedule", "Pause, resume, run now, or delete an extraction schedule.", z.object({ schedule_id: id, action: z.enum(["pause", "resume", "run", "delete"]) }), ({ schedule_id, action }) => action === "delete" ? api("DELETE", `/v1/schedules/${schedule_id}`) : api("POST", `/v1/schedules/${schedule_id}/${action}`));
|
|
237
|
+
return server;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export async function runServer() {
|
|
241
|
+
await serveStdio(createServer);
|
|
242
|
+
}
|