@anaella/mcp 0.2.2 → 0.4.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.
@@ -27,9 +27,14 @@ var fail = (err) => {
27
27
  if (err instanceof AnaellaApiError) {
28
28
  const detail = err.details?.length ? `
29
29
  Details: ${JSON.stringify(err.details)}` : "";
30
+ const next = err.next ? `
31
+ Next: ${JSON.stringify(err.next)}` : "";
30
32
  return {
31
33
  content: [
32
- { type: "text", text: `Error [${err.code}] (HTTP ${err.status}): ${err.message}${detail}` }
34
+ {
35
+ type: "text",
36
+ text: `Error [${err.code}] (HTTP ${err.status}): ${err.message}${detail}${next}`
37
+ }
33
38
  ],
34
39
  isError: true
35
40
  };
@@ -48,10 +53,26 @@ function buildTools(client) {
48
53
  {
49
54
  name: "list_channels",
50
55
  config: {
51
- description: "List the connected social channels for your organization. Call this FIRST to get the channel ids you pass to create_post.",
56
+ description: "List the channels you can post to (connected social channels with publishing). Call this FIRST to get the channel ids you pass to create_post.",
52
57
  inputSchema: {}
53
58
  },
54
- handler: wrap(() => client.listChannels())
59
+ handler: wrap(
60
+ async () => (await client.listChannels()).filter((c) => c.features.includes("publish"))
61
+ )
62
+ },
63
+ {
64
+ name: "create_connect_link",
65
+ config: {
66
+ description: "Create a link that lets a person connect one of their accounts (e.g. google-search-console) to this organization without an Anaella login. Give them the url; when they finish, their browser returns to returnUrl with ?status=connected&channelId=\u2026 (or ?status=error&code=\u2026). returnUrl must be on an origin allowed under Settings \u2192 API keys \u2192 Connect. Links work once, for 30 minutes. To call the connected account afterwards use do with a typed capability (e.g. gsc.queries.list).",
67
+ inputSchema: {
68
+ platform: z.string().describe("Account type, e.g. google-search-console"),
69
+ externalUserId: z.string().max(255).describe("Your own id for this person"),
70
+ returnUrl: z.string().url().describe("Where to send them back")
71
+ }
72
+ },
73
+ handler: wrap(
74
+ (args) => client.createConnectSession(args)
75
+ )
55
76
  },
56
77
  {
57
78
  name: "create_post",
@@ -134,6 +155,52 @@ function buildTools(client) {
134
155
  }
135
156
  },
136
157
  handler: wrap((args) => client.uploadUrls(args.urls))
158
+ },
159
+ {
160
+ name: "find",
161
+ config: {
162
+ description: 'Find Anaella capabilities by what you want to do (e.g. "post to instagram", "generate an image"). Returns ids, summaries and dollar prices. Free. Then call explain, then do.',
163
+ inputSchema: {
164
+ q: z.string().optional().describe("What you want to do, in plain words"),
165
+ category: z.string().optional()
166
+ }
167
+ },
168
+ handler: wrap(
169
+ (args) => client.find(args.q ?? "", { category: args.category })
170
+ )
171
+ },
172
+ {
173
+ name: "explain",
174
+ config: {
175
+ description: "A capability's input and output JSON Schema, price and description. Free. Call before do.",
176
+ inputSchema: { id: z.string().describe("Capability id from find") }
177
+ },
178
+ handler: wrap((args) => client.explain(args.id))
179
+ },
180
+ {
181
+ name: "do",
182
+ config: {
183
+ description: "Run a capability with input matching its explain schema. Billed per call from the balance. Some capabilities have a daily quota (quotaPerDay in find/explain); beyond it the call fails with 429 rate_limited and resetAt. Async capabilities return a queued job: pass wait=true to block until it finishes, or poll with job.",
184
+ inputSchema: {
185
+ id: z.string().describe("Capability id"),
186
+ input: z.record(z.unknown()).optional().describe("Input object per the explain schema"),
187
+ wait: z.boolean().optional().describe("Wait for async jobs to finish (default false)")
188
+ }
189
+ },
190
+ handler: wrap(
191
+ async (args) => {
192
+ const job = await client.do(args.id, args.input ?? {});
193
+ return args.wait && (job.status === "queued" || job.status === "running") ? client.waitForJob(job.id) : job;
194
+ }
195
+ )
196
+ },
197
+ {
198
+ name: "job",
199
+ config: {
200
+ description: "Status, output, error and cost of a job returned by do.",
201
+ inputSchema: { id: z.string() }
202
+ },
203
+ handler: wrap((args) => client.job(args.id))
137
204
  }
138
205
  ];
139
206
  }
package/dist/http.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  buildServer,
4
4
  loadConfig
5
- } from "./chunk-JE54FATF.js";
5
+ } from "./chunk-JCVVVQYD.js";
6
6
 
7
7
  // src/http.ts
8
8
  import http from "http";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  buildServer,
4
4
  loadConfig
5
- } from "./chunk-JE54FATF.js";
5
+ } from "./chunk-JCVVVQYD.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anaella/mcp",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "MCP server for anaella.com — schedule and publish social posts via the /v1 API.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "smoke": "bun run src/smoke.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@anaella/client": "^0.1.8",
23
+ "@anaella/client": "^0.3.0",
24
24
  "@modelcontextprotocol/sdk": "^1.29.0",
25
25
  "zod": "^3.25.76"
26
26
  },