@mentionova/mcp-server 1.0.0 → 1.1.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.
Files changed (2) hide show
  1. package/index.js +113 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -27,6 +27,53 @@ async function api(path, params = {}) {
27
27
  return json;
28
28
  }
29
29
 
30
+ async function apiPost(path, body = {}) {
31
+ const url = new URL(`/api/v1${path}`, BASE_URL);
32
+
33
+ const res = await fetch(url.toString(), {
34
+ method: "POST",
35
+ headers: {
36
+ Authorization: `Bearer ${API_KEY}`,
37
+ "Content-Type": "application/json",
38
+ },
39
+ body: JSON.stringify(body),
40
+ });
41
+
42
+ const json = await res.json();
43
+ if (!res.ok) throw new Error(json.error || `API error ${res.status}`);
44
+ return json;
45
+ }
46
+
47
+ async function apiPatch(path, body = {}) {
48
+ const url = new URL(`/api/v1${path}`, BASE_URL);
49
+
50
+ const res = await fetch(url.toString(), {
51
+ method: "PATCH",
52
+ headers: {
53
+ Authorization: `Bearer ${API_KEY}`,
54
+ "Content-Type": "application/json",
55
+ },
56
+ body: JSON.stringify(body),
57
+ });
58
+
59
+ const json = await res.json();
60
+ if (!res.ok) throw new Error(json.error || `API error ${res.status}`);
61
+ return json;
62
+ }
63
+
64
+ async function apiDelete(path) {
65
+ const url = new URL(`/api/v1${path}`, BASE_URL);
66
+
67
+ const res = await fetch(url.toString(), {
68
+ method: "DELETE",
69
+ headers: { Authorization: `Bearer ${API_KEY}` },
70
+ });
71
+
72
+ const json = await res.json();
73
+ if (!res.ok) throw new Error(json.error || `API error ${res.status}`);
74
+ return json;
75
+ }
76
+
30
77
  const server = new McpServer({
31
78
  name: "mentionova",
32
79
  version: "1.0.0",
@@ -202,6 +249,72 @@ server.tool(
202
249
  }
203
250
  );
204
251
 
252
+ // --- Write: Prompts ---
253
+
254
+ server.tool(
255
+ "mentionova_create_prompt",
256
+ "Create one or more prompts (search queries) to track in a workspace. These will be monitored across AI engines on a schedule.",
257
+ {
258
+ workspace_id: z.string().describe("Workspace UUID"),
259
+ prompt_text: z.string().optional().describe("Single prompt text"),
260
+ prompt_texts: z.array(z.string()).optional().describe("Multiple prompt texts"),
261
+ status: z.enum(["active", "paused"]).optional().describe("Initial status (default: active)"),
262
+ schedule_frequency: z.enum(["daily", "weekly", "biweekly", "monthly"]).optional().describe("Run frequency (default: weekly)"),
263
+ },
264
+ async ({ workspace_id, prompt_text, prompt_texts, status, schedule_frequency }) => {
265
+ const body = { prompt_text, prompt_texts, status, schedule_frequency };
266
+ const data = await apiPost(`/workspaces/${workspace_id}/prompts`, body);
267
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
268
+ }
269
+ );
270
+
271
+ server.tool(
272
+ "mentionova_update_prompt",
273
+ "Update a prompt's text, status, schedule, or channels",
274
+ {
275
+ workspace_id: z.string().describe("Workspace UUID"),
276
+ prompt_id: z.string().describe("Prompt UUID"),
277
+ prompt_text: z.string().optional().describe("New prompt text"),
278
+ status: z.enum(["active", "paused", "archived"]).optional().describe("New status"),
279
+ schedule_frequency: z.enum(["daily", "weekly", "biweekly", "monthly"]).optional().describe("New schedule"),
280
+ channels: z.array(z.string()).optional().describe("AI engine channels to run on"),
281
+ },
282
+ async ({ workspace_id, prompt_id, prompt_text, status, schedule_frequency, channels }) => {
283
+ const body = { prompt_text, status, schedule_frequency, channels };
284
+ const data = await apiPatch(`/workspaces/${workspace_id}/prompts/${prompt_id}`, body);
285
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
286
+ }
287
+ );
288
+
289
+ server.tool(
290
+ "mentionova_delete_prompt",
291
+ "Delete a prompt and all its associated runs and citations",
292
+ {
293
+ workspace_id: z.string().describe("Workspace UUID"),
294
+ prompt_id: z.string().describe("Prompt UUID"),
295
+ },
296
+ async ({ workspace_id, prompt_id }) => {
297
+ const data = await apiDelete(`/workspaces/${workspace_id}/prompts/${prompt_id}`);
298
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
299
+ }
300
+ );
301
+
302
+ // --- Write: Runs ---
303
+
304
+ server.tool(
305
+ "mentionova_trigger_run",
306
+ "Trigger a new run for a prompt. Executes the prompt across AI engines and captures citations and mentions. Returns 202 (accepted) immediately; the run processes in the background.",
307
+ {
308
+ workspace_id: z.string().describe("Workspace UUID"),
309
+ prompt_id: z.string().describe("Prompt UUID to run"),
310
+ channels: z.array(z.enum(["perplexity", "claude", "chatgpt", "gemini", "google", "reddit"])).optional().describe("Specific channels to run (default: all)"),
311
+ },
312
+ async ({ workspace_id, prompt_id, channels }) => {
313
+ const data = await apiPost(`/workspaces/${workspace_id}/prompts/${prompt_id}/run`, { channels });
314
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
315
+ }
316
+ );
317
+
205
318
  // Start the server
206
319
  const transport = new StdioServerTransport();
207
320
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentionova/mcp-server",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "MCP server for the Mentionova API - connect AI assistants to your AI search visibility data",
5
5
  "type": "module",
6
6
  "main": "index.js",