gliana-ai-mcp 0.4.0 → 0.4.2

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/dist/index.js +51 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -233,13 +233,12 @@ server.registerTool('generate', {
233
233
  });
234
234
  server.registerTool('tool', {
235
235
  description: 'Run a paid UTILITY tool (not an AI model). PAID: settles a flat price from your wallet (base/tempo/solana). ' +
236
- 'Tools: `scrape` {url}→markdown, `screenshot` {url}→PNG url, `og-image` {title,subtitle?}→1200×630 card url, ' +
237
- '`youtube-thumbnail` {title,subtitle?,background?}→1280×720 url, `rpc` {chain,method,params?}→JSON-RPC result, ' +
238
- '`token-price` {ids,vs?}→spot prices. See https://ai.glianalabs.com/docs#tools.',
236
+ 'Tools: `scrape` {url}→markdown, `screenshot` {url}→PNG url, `og-image`/`quote-card`/`code-image`/`tweet-image` ' +
237
+ '{…}→PNG url, `youtube-thumbnail` {title,background?}→PNG, `meme` {image,top?,bottom?}→PNG, `card` {preset,title}→PNG ' +
238
+ '(preset: og/instagram-square/story/linkedin/podcast), `auto-og` {url}→PNG (scrape+render), `rpc` {chain,method,params?}, ' +
239
+ '`token-price` {ids,vs?}. Full list: GET /openapi.json or https://ai.glianalabs.com/docs#tools.',
239
240
  inputSchema: {
240
- name: z
241
- .enum(['scrape', 'screenshot', 'og-image', 'youtube-thumbnail', 'rpc', 'token-price'])
242
- .describe('Which utility tool to run.'),
241
+ name: z.string().describe('Utility tool name, e.g. scrape, screenshot, og-image, youtube-thumbnail, quote-card, code-image, tweet-image, meme, card, auto-og, rpc, token-price.'),
243
242
  args: z.record(z.any()).describe("The tool's input body, e.g. { url } for scrape, { ids } for token-price."),
244
243
  },
245
244
  outputSchema: {
@@ -281,6 +280,52 @@ server.registerTool('tool', {
281
280
  const structured = { tool: name, costMicroUsd: r.costMicroUsd ?? 0, costUsd: cost, rail, result };
282
281
  return okv(`${name} (charged ${cost} via ${rail}):\n${JSON.stringify(result, null, 2)}`, structured);
283
282
  });
283
+ server.registerTool('recipe', {
284
+ description: 'Run a paid multi-model RECIPE pipeline (chains models in one call). PAID: settles the SUM of the steps from ' +
285
+ 'your wallet (base/tempo/solana). Recipes: `image-to-video` {prompt,motionPrompt?} text→image→animated video ' +
286
+ '(3-8x cheaper than a native text-to-video model), `image-to-video-hd` (crisper still), `image-to-video-audio` ' +
287
+ '(video with sound). Override steps with { imageModel, videoModel }. See https://ai.glianalabs.com/docs#recipes.',
288
+ inputSchema: {
289
+ name: z.string().describe('Recipe name: image-to-video, image-to-video-hd, or image-to-video-audio.'),
290
+ args: z.record(z.any()).describe('Recipe input, e.g. { prompt, motionPrompt?, duration?, resolution? }.'),
291
+ },
292
+ outputSchema: {
293
+ recipe: z.string(),
294
+ costMicroUsd: z.number(),
295
+ costUsd: z.string(),
296
+ rail: z.string(),
297
+ url: z.string().optional().describe('Final media URL (the last step).'),
298
+ result: z.any().describe('Each step output.'),
299
+ },
300
+ annotations: { title: 'Recipe (paid)', readOnlyHint: false, openWorldHint: true },
301
+ }, async ({ name, args }) => {
302
+ const picked = resolveRail();
303
+ if ('error' in picked)
304
+ return fail(picked.error);
305
+ const { rail, method } = picked;
306
+ // SINGLE attempt — same reason as generate (Solana broadcasts; a retry double-pays).
307
+ const mppx = Mppx.create({ methods: [method], polyfill: false });
308
+ const res = await mppx.fetch(`${API}/v1/recipes/${name}`, {
309
+ method: 'POST',
310
+ headers: { 'content-type': 'application/json' },
311
+ body: JSON.stringify(args ?? {}),
312
+ });
313
+ if (res.status === 402)
314
+ return fail(`Payment did not settle over ${rail} — check the wallet holds USDC on that chain, then call recipe again.`);
315
+ if (res.status === 400 || res.status === 404) {
316
+ const e = (await res.json().catch(() => ({})));
317
+ return fail(`Bad request (no charge): ${e.detail ?? 'see https://ai.glianalabs.com/docs#recipes'}`);
318
+ }
319
+ if (!res.ok) {
320
+ const e = (await res.json().catch(() => ({})));
321
+ return fail(e.detail ?? e.error ?? `Request failed (HTTP ${res.status})`);
322
+ }
323
+ const r = (await res.json());
324
+ const cost = usd(r.costMicroUsd ?? 0);
325
+ const { recipe: _r, costMicroUsd: _c, ...result } = r;
326
+ const structured = { recipe: name, costMicroUsd: r.costMicroUsd ?? 0, costUsd: cost, rail, url: r.url, result };
327
+ return okv(`${name} → ${r.url ?? '(no url)'}\ncharged ${cost} via ${rail}`, structured);
328
+ });
284
329
  async function main() {
285
330
  if (RAW_SOL) {
286
331
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gliana-ai-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "MCP server for GlianaAI — pay-per-call generative AI across 59 models (image, video, music, speech). No signup or API key; each generate is paid per call from your own wallet over MPP / x402.",
5
5
  "type": "module",
6
6
  "bin": {