klamdo-mcp 1.0.0 → 1.2.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.
package/dist/http.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Klamdo MCP Server — Streamable HTTP transport
4
+ *
5
+ * Runs as a hosted service on mark-mini-s, exposed via Cloudflare Tunnel at:
6
+ * https://mcp.klamdo.app
7
+ *
8
+ * Each request is stateless. API key is read from Authorization: Bearer <key> header.
9
+ * Users get their key from https://klamdo.app/profile
10
+ *
11
+ * Smithery URL: https://mcp.klamdo.app/mcp
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG"}
package/dist/http.js ADDED
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Klamdo MCP Server — Streamable HTTP transport
5
+ *
6
+ * Runs as a hosted service on mark-mini-s, exposed via Cloudflare Tunnel at:
7
+ * https://mcp.klamdo.app
8
+ *
9
+ * Each request is stateless. API key is read from Authorization: Bearer <key> header.
10
+ * Users get their key from https://klamdo.app/profile
11
+ *
12
+ * Smithery URL: https://mcp.klamdo.app/mcp
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
16
+ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
17
+ const http_1 = require("http");
18
+ const tools_js_1 = require("./tools.js");
19
+ const PORT = parseInt(process.env.PORT ?? "3838", 10);
20
+ const HOST = process.env.HOST ?? "127.0.0.1";
21
+ function extractApiKey(req) {
22
+ const auth = req.headers["authorization"] ?? "";
23
+ if (auth.startsWith("Bearer "))
24
+ return auth.slice(7).trim();
25
+ // Also allow x-api-key header for clients that don't support Bearer
26
+ const xApiKey = req.headers["x-api-key"];
27
+ if (typeof xApiKey === "string")
28
+ return xApiKey.trim();
29
+ return "";
30
+ }
31
+ async function readBody(req) {
32
+ return new Promise((resolve, reject) => {
33
+ const chunks = [];
34
+ req.on("data", (chunk) => chunks.push(chunk));
35
+ req.on("end", () => resolve(Buffer.concat(chunks)));
36
+ req.on("error", reject);
37
+ });
38
+ }
39
+ function createMcpServer(apiKey) {
40
+ const server = new index_js_1.Server({ name: "klamdo", version: "1.1.0" }, { capabilities: { tools: {}, resources: {} } });
41
+ (0, tools_js_1.registerHandlers)(server, () => apiKey);
42
+ return server;
43
+ }
44
+ const httpServer = (0, http_1.createServer)(async (req, res) => {
45
+ const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
46
+ // Health check
47
+ if (req.method === "GET" && url.pathname === "/health") {
48
+ res.writeHead(200, { "Content-Type": "application/json" });
49
+ res.end(JSON.stringify({ ok: true, service: "klamdo-mcp", version: "1.1.0" }));
50
+ return;
51
+ }
52
+ // CORS preflight
53
+ if (req.method === "OPTIONS") {
54
+ res.writeHead(204, {
55
+ "Access-Control-Allow-Origin": "*",
56
+ "Access-Control-Allow-Methods": "GET, POST, OPTIONS",
57
+ "Access-Control-Allow-Headers": "Authorization, Content-Type, x-api-key, mcp-session-id"
58
+ });
59
+ res.end();
60
+ return;
61
+ }
62
+ // MCP endpoint
63
+ if (url.pathname === "/mcp") {
64
+ res.setHeader("Access-Control-Allow-Origin", "*");
65
+ res.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type, x-api-key, mcp-session-id");
66
+ const apiKey = extractApiKey(req);
67
+ // Require auth — return 401 so Smithery knows OAuth is expected
68
+ if (!apiKey) {
69
+ res.writeHead(401, {
70
+ "Content-Type": "application/json",
71
+ "WWW-Authenticate": 'Bearer realm="Klamdo MCP", error="missing_token"'
72
+ });
73
+ res.end(JSON.stringify({
74
+ error: "missing_api_key",
75
+ message: "Get your API key at https://klamdo.app/profile"
76
+ }));
77
+ return;
78
+ }
79
+ try {
80
+ const body = req.method === "POST" ? await readBody(req) : undefined;
81
+ // Stateless: new server+transport per request
82
+ const mcpServer = createMcpServer(apiKey);
83
+ const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
84
+ sessionIdGenerator: undefined // stateless mode
85
+ });
86
+ await mcpServer.connect(transport);
87
+ await transport.handleRequest(req, res, body ? JSON.parse(body.toString()) : undefined);
88
+ }
89
+ catch (err) {
90
+ if (!res.headersSent) {
91
+ res.writeHead(500, { "Content-Type": "application/json" });
92
+ res.end(JSON.stringify({ error: "internal_error", message: String(err) }));
93
+ }
94
+ }
95
+ return;
96
+ }
97
+ // Root — basic info page
98
+ if (url.pathname === "/" || url.pathname === "") {
99
+ res.writeHead(200, { "Content-Type": "application/json" });
100
+ res.end(JSON.stringify({
101
+ service: "Klamdo MCP Server",
102
+ version: "1.1.0",
103
+ mcpEndpoint: "/mcp",
104
+ docs: "https://klamdo.app/answers",
105
+ getApiKey: "https://klamdo.app/profile"
106
+ }));
107
+ return;
108
+ }
109
+ res.writeHead(404, { "Content-Type": "application/json" });
110
+ res.end(JSON.stringify({ error: "not_found" }));
111
+ });
112
+ httpServer.listen(PORT, HOST, () => {
113
+ process.stdout.write(`[klamdo-mcp:http] Listening on http://${HOST}:${PORT}/mcp\n`);
114
+ });
115
+ httpServer.on("error", (err) => {
116
+ process.stderr.write(`[klamdo-mcp:http] Server error: ${err}\n`);
117
+ process.exit(1);
118
+ });
119
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;GAUG;;AAEH,wEAAmE;AACnE,0FAAmG;AACnG,+BAA+E;AAC/E,yCAA8C;AAE9C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,OAAO,CAAC,GA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I,GAAG,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC;QAChD,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;QAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;YACrB,OAAO,EAAE,mBAAmB;YAC5B,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,MAAM;YACnB,IAAI,EAAE,4BAA4B;YAClC,SAAS,EAAE,4BAA4B;SACxC,CAAC,CAAC,CAAC;QACJ,OAAO;IACT,CAAC;IAED,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;AAClD,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;IACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,IAAI,IAAI,IAAI,QAAQ,CAAC,CAAC;AACtF,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;IAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,GAAG,IAAI,CAAC,CAAC;IACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Klamdo MCP Server
3
+ * Klamdo MCP Server — stdio transport (for Claude Desktop local use)
4
4
  *
5
- * Exposes Klamdo's AI content generation to Claude Desktop and other
6
- * MCP-compatible clients. Lets AI assistants generate identity-locked
7
- * 4K images and 5-second vertical videos on behalf of the user.
8
- *
9
- * Setup:
10
- * 1. Create a Klamdo account at https://klamdo.app
11
- * 2. Get your API key from your profile page
12
- * 3. Add to Claude Desktop config:
13
- * { "mcpServers": { "klamdo": { "command": "npx", "args": ["klamdo-mcp"], "env": { "KLAMDO_API_KEY": "<your-key>" } } } }
5
+ * Setup in Claude Desktop config:
6
+ * {
7
+ * "mcpServers": {
8
+ * "klamdo": {
9
+ * "command": "npx",
10
+ * "args": ["klamdo-mcp"],
11
+ * "env": { "KLAMDO_API_KEY": "<your-key-from-klamdo.app/profile>" }
12
+ * }
13
+ * }
14
+ * }
14
15
  */
15
16
  export {};
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG"}
package/dist/index.js CHANGED
@@ -1,303 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  /**
4
- * Klamdo MCP Server
4
+ * Klamdo MCP Server — stdio transport (for Claude Desktop local use)
5
5
  *
6
- * Exposes Klamdo's AI content generation to Claude Desktop and other
7
- * MCP-compatible clients. Lets AI assistants generate identity-locked
8
- * 4K images and 5-second vertical videos on behalf of the user.
9
- *
10
- * Setup:
11
- * 1. Create a Klamdo account at https://klamdo.app
12
- * 2. Get your API key from your profile page
13
- * 3. Add to Claude Desktop config:
14
- * { "mcpServers": { "klamdo": { "command": "npx", "args": ["klamdo-mcp"], "env": { "KLAMDO_API_KEY": "<your-key>" } } } }
6
+ * Setup in Claude Desktop config:
7
+ * {
8
+ * "mcpServers": {
9
+ * "klamdo": {
10
+ * "command": "npx",
11
+ * "args": ["klamdo-mcp"],
12
+ * "env": { "KLAMDO_API_KEY": "<your-key-from-klamdo.app/profile>" }
13
+ * }
14
+ * }
15
+ * }
15
16
  */
16
17
  Object.defineProperty(exports, "__esModule", { value: true });
17
18
  const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
18
19
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
19
- const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
20
- const BASE_URL = process.env.KLAMDO_BASE_URL ?? "https://klamdo.app";
20
+ const tools_js_1 = require("./tools.js");
21
21
  const API_KEY = process.env.KLAMDO_API_KEY ?? "";
22
22
  if (!API_KEY) {
23
- process.stderr.write("[klamdo-mcp] Warning: KLAMDO_API_KEY is not set. All API calls will fail. " +
24
- "Set it in your MCP client config.\n");
25
- }
26
- async function klamdo(path, body) {
27
- const res = await fetch(`${BASE_URL}/api/mcp${path}`, {
28
- method: body ? "POST" : "GET",
29
- headers: {
30
- "Content-Type": "application/json",
31
- "Authorization": `Bearer ${API_KEY}`
32
- },
33
- body: body ? JSON.stringify(body) : undefined
34
- });
35
- if (!res.ok) {
36
- const text = await res.text().catch(() => "");
37
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Klamdo API error ${res.status}: ${text.slice(0, 200)}`);
38
- }
39
- return res.json();
23
+ process.stderr.write("[klamdo-mcp] Warning: KLAMDO_API_KEY is not set. Set it in your MCP client config.\n");
40
24
  }
41
- // ── Tool definitions ─────────────────────────────────────────────────────────
42
- const TOOLS = [
43
- {
44
- name: "generate_image",
45
- description: "Generate a 4K identity-locked image using the user's reference photo on Klamdo. " +
46
- "Returns a job ID — use check_job to poll for the result. Costs 3 credits.",
47
- inputSchema: {
48
- type: "object",
49
- properties: {
50
- prompt: {
51
- type: "string",
52
- description: "Describe the content you want to generate. Be specific about setting, mood, style, and purpose. " +
53
- "Example: 'A confident coach standing in a modern co-working space, window light, suited, holding a coffee, editorial style'"
54
- },
55
- aspectRatio: {
56
- type: "string",
57
- enum: ["1:1", "16:9", "9:16"],
58
- description: "Output aspect ratio. Default: 1:1 (square, social-optimized).",
59
- default: "1:1"
60
- }
61
- },
62
- required: ["prompt"]
63
- }
64
- },
65
- {
66
- name: "generate_video",
67
- description: "Generate a 5-second vertical identity-locked video from the user's reference photo on Klamdo. " +
68
- "Returns a job ID — use check_job to poll for the result. Aspect ratio is locked to 9:16. Costs 6 credits.",
69
- inputSchema: {
70
- type: "object",
71
- properties: {
72
- prompt: {
73
- type: "string",
74
- description: "Describe the video content. Include motion cues for best results. " +
75
- "Example: 'A confident entrepreneur walking through a city street, slow zoom, cinematic lighting'"
76
- }
77
- },
78
- required: ["prompt"]
79
- }
80
- },
81
- {
82
- name: "check_job",
83
- description: "Check the status of a Klamdo generation job. Returns status and download URLs when complete.",
84
- inputSchema: {
85
- type: "object",
86
- properties: {
87
- jobId: {
88
- type: "string",
89
- description: "The job ID returned from generate_image or generate_video"
90
- }
91
- },
92
- required: ["jobId"]
93
- }
94
- },
95
- {
96
- name: "get_account",
97
- description: "Get current Klamdo account status: credit balance, plan, and recent jobs.",
98
- inputSchema: {
99
- type: "object",
100
- properties: {}
101
- }
102
- },
103
- {
104
- name: "list_jobs",
105
- description: "List recent Klamdo generation jobs for this account.",
106
- inputSchema: {
107
- type: "object",
108
- properties: {
109
- limit: {
110
- type: "number",
111
- description: "Maximum jobs to return (default: 10, max: 50)",
112
- default: 10
113
- }
114
- }
115
- }
116
- }
117
- ];
118
- // ── MCP Server ───────────────────────────────────────────────────────────────
119
- const server = new index_js_1.Server({ name: "klamdo", version: "1.0.0" }, { capabilities: { tools: {}, resources: {} } });
120
- server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({ tools: TOOLS }));
121
- server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
122
- const { name, arguments: args } = request.params;
123
- const input = (args ?? {});
124
- try {
125
- switch (name) {
126
- case "generate_image": {
127
- const result = await klamdo("/jobs", {
128
- prompt: input.prompt,
129
- mode: "image",
130
- aspectRatio: input.aspectRatio ?? "4:5"
131
- });
132
- return {
133
- content: [
134
- {
135
- type: "text",
136
- text: `Image generation started.\n\nJob ID: ${result.jobId}\nStatus: ${result.status}\nCredits reserved: ${result.creditsReserved}\n\nUse check_job("${result.jobId}") to get the result. Images typically complete in 30–90 seconds.`
137
- }
138
- ]
139
- };
140
- }
141
- case "generate_video": {
142
- const result = await klamdo("/jobs", {
143
- prompt: input.prompt,
144
- mode: "video",
145
- aspectRatio: "9:16"
146
- });
147
- return {
148
- content: [
149
- {
150
- type: "text",
151
- text: `Video generation started.\n\nJob ID: ${result.jobId}\nStatus: ${result.status}\nCredits reserved: ${result.creditsReserved}\n\nUse check_job("${result.jobId}") to get the result. Videos typically complete in 2–5 minutes.`
152
- }
153
- ]
154
- };
155
- }
156
- case "check_job": {
157
- const jobId = String(input.jobId ?? "");
158
- if (!jobId)
159
- throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, "jobId is required");
160
- const result = await klamdo(`/jobs/${jobId}`);
161
- if (result.status === "completed") {
162
- const imageAsset = result.assets.find((a) => a.kind === "image");
163
- const videoAsset = result.assets.find((a) => a.kind === "video");
164
- const lines = [
165
- `Job ${jobId} — Completed ✓`,
166
- "",
167
- imageAsset ? `Image URL: ${imageAsset.url}` : null,
168
- videoAsset ? `Video URL: ${videoAsset.url}` : null,
169
- result.caption ? `\nSuggested caption:\n${result.caption}` : null,
170
- "",
171
- `Share page: ${BASE_URL}/share/${jobId}`
172
- ].filter(Boolean);
173
- return { content: [{ type: "text", text: lines.join("\n") }] };
174
- }
175
- if (result.status === "failed") {
176
- return {
177
- content: [
178
- {
179
- type: "text",
180
- text: `Job ${jobId} failed: ${result.errorMessage ?? "Unknown error"}. Credits have been refunded.`
181
- }
182
- ]
183
- };
184
- }
185
- return {
186
- content: [
187
- {
188
- type: "text",
189
- text: `Job ${jobId} is still running (status: ${result.status}). Check again in 15–30 seconds.`
190
- }
191
- ]
192
- };
193
- }
194
- case "get_account": {
195
- const result = await klamdo("/account");
196
- return {
197
- content: [
198
- {
199
- type: "text",
200
- text: [
201
- `Klamdo Account: ${result.name} (${result.email})`,
202
- `Plan: ${result.planTier}`,
203
- `Credits: ${result.availableCredits}`,
204
- result.freeSampleEligible ? "Free sample: available" : ""
205
- ].filter(Boolean).join("\n")
206
- }
207
- ]
208
- };
209
- }
210
- case "list_jobs": {
211
- const limit = Math.min(Number(input.limit ?? 10), 50);
212
- const result = await klamdo(`/jobs?limit=${limit}`);
213
- const lines = result.jobs.map((j) => `[${j.status}] ${j.id} — ${j.mode} — "${j.prompt.slice(0, 60)}" (${j.createdAt.slice(0, 10)})`);
214
- return {
215
- content: [
216
- {
217
- type: "text",
218
- text: lines.length ? lines.join("\n") : "No jobs found."
219
- }
220
- ]
221
- };
222
- }
223
- default:
224
- throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
225
- }
226
- }
227
- catch (err) {
228
- if (err instanceof types_js_1.McpError)
229
- throw err;
230
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, err instanceof Error ? err.message : String(err));
231
- }
232
- });
233
- // Resources: expose the API docs as a readable resource
234
- server.setRequestHandler(types_js_1.ListResourcesRequestSchema, async () => ({
235
- resources: [
236
- {
237
- uri: "klamdo://docs",
238
- name: "Klamdo API Documentation",
239
- description: "How to use Klamdo's MCP tools and what each parameter does",
240
- mimeType: "text/plain"
241
- }
242
- ]
243
- }));
244
- server.setRequestHandler(types_js_1.ReadResourceRequestSchema, async (request) => {
245
- if (request.params.uri === "klamdo://docs") {
246
- return {
247
- contents: [
248
- {
249
- uri: "klamdo://docs",
250
- mimeType: "text/plain",
251
- text: `# Klamdo MCP Server
252
-
253
- Klamdo generates identity-locked 4K images and 5-second vertical videos for coaches and creator-founders.
254
-
255
- ## Tools
256
-
257
- ### generate_image
258
- Generate a 4K image from the user's reference photo. Costs 3 credits.
259
- - prompt (required): Describe the content, setting, mood, and style
260
- - aspectRatio (optional): "1:1" | "16:9" | "9:16" — default "1:1"
261
-
262
- ### generate_video
263
- Generate a 5-second 9:16 vertical video. Costs 6 credits.
264
- - prompt (required): Describe the video content with motion cues
265
-
266
- ### check_job
267
- Poll a generation job for results.
268
- - jobId (required): Job ID from generate_image or generate_video
269
-
270
- ### get_account
271
- Get account status: credits, plan tier, free sample eligibility.
272
-
273
- ### list_jobs
274
- List recent jobs.
275
- - limit (optional): Number of jobs to return (default 10, max 50)
276
-
277
- ## Pricing
278
- - $19.99/month for 120 credits
279
- - 3 credits per 4K image (~40/mo)
280
- - 6 credits per 5-sec video (~20/mo)
281
- - Free sample on first sign-up
282
-
283
- ## Links
284
- - Sign up: https://klamdo.app/sign-up
285
- - Pricing: https://klamdo.app/pricing
286
- `
287
- }
288
- ]
289
- };
290
- }
291
- throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, `Resource not found: ${request.params.uri}`);
292
- });
293
- // ── Start ────────────────────────────────────────────────────────────────────
294
25
  async function main() {
26
+ const server = new index_js_1.Server({ name: "klamdo", version: "1.1.0" }, { capabilities: { tools: {}, resources: {} } });
27
+ (0, tools_js_1.registerHandlers)(server, () => API_KEY);
295
28
  const transport = new stdio_js_1.StdioServerTransport();
296
29
  await server.connect(transport);
297
- process.stderr.write("[klamdo-mcp] Klamdo MCP server running on stdio\n");
30
+ process.stderr.write("[klamdo-mcp] Running via stdio\n");
298
31
  }
299
32
  main().catch((err) => {
300
- process.stderr.write(`[klamdo-mcp] Fatal error: ${err}\n`);
33
+ process.stderr.write(`[klamdo-mcp] Fatal: ${err}\n`);
301
34
  process.exit(1);
302
35
  });
303
36
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;GAYG;;AAEH,wEAAmE;AACnE,wEAAiF;AACjF,iEAO4C;AAE5C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,oBAAoB,CAAC;AACrE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;AAEjD,IAAI,CAAC,OAAO,EA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AE,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAC/C,CAAC;IAEF,IAAA,2BAAgB,EAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;AAC3D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Shared tool definitions and implementations for both stdio and HTTP transports.
3
+ * The apiKey is per-request in HTTP mode, per-process in stdio mode.
4
+ */
5
+ import type { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
+ export declare const BASE_URL: string;
7
+ export declare function klamdo<T>(path: string, apiKey: string, body?: Record<string, unknown>): Promise<T>;
8
+ export declare const TOOLS: ({
9
+ name: string;
10
+ description: string;
11
+ annotations: {
12
+ readOnlyHint: boolean;
13
+ destructiveHint: boolean;
14
+ idempotentHint: boolean;
15
+ openWorldHint: boolean;
16
+ };
17
+ inputSchema: {
18
+ type: string;
19
+ properties: {
20
+ prompt: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ aspectRatio: {
25
+ type: string;
26
+ enum: string[];
27
+ description: string;
28
+ default: string;
29
+ };
30
+ jobId?: undefined;
31
+ limit?: undefined;
32
+ };
33
+ required: string[];
34
+ };
35
+ } | {
36
+ name: string;
37
+ description: string;
38
+ annotations: {
39
+ readOnlyHint: boolean;
40
+ destructiveHint: boolean;
41
+ idempotentHint: boolean;
42
+ openWorldHint: boolean;
43
+ };
44
+ inputSchema: {
45
+ type: string;
46
+ properties: {
47
+ prompt: {
48
+ type: string;
49
+ description: string;
50
+ };
51
+ aspectRatio?: undefined;
52
+ jobId?: undefined;
53
+ limit?: undefined;
54
+ };
55
+ required: string[];
56
+ };
57
+ } | {
58
+ name: string;
59
+ description: string;
60
+ annotations: {
61
+ readOnlyHint: boolean;
62
+ destructiveHint: boolean;
63
+ idempotentHint: boolean;
64
+ openWorldHint: boolean;
65
+ };
66
+ inputSchema: {
67
+ type: string;
68
+ properties: {
69
+ jobId: {
70
+ type: string;
71
+ description: string;
72
+ };
73
+ prompt?: undefined;
74
+ aspectRatio?: undefined;
75
+ limit?: undefined;
76
+ };
77
+ required: string[];
78
+ };
79
+ } | {
80
+ name: string;
81
+ description: string;
82
+ annotations: {
83
+ readOnlyHint: boolean;
84
+ destructiveHint: boolean;
85
+ idempotentHint: boolean;
86
+ openWorldHint: boolean;
87
+ };
88
+ inputSchema: {
89
+ type: string;
90
+ properties: {
91
+ prompt?: undefined;
92
+ aspectRatio?: undefined;
93
+ jobId?: undefined;
94
+ limit?: undefined;
95
+ };
96
+ required?: undefined;
97
+ };
98
+ } | {
99
+ name: string;
100
+ description: string;
101
+ annotations: {
102
+ readOnlyHint: boolean;
103
+ destructiveHint: boolean;
104
+ idempotentHint: boolean;
105
+ openWorldHint: boolean;
106
+ };
107
+ inputSchema: {
108
+ type: string;
109
+ properties: {
110
+ limit: {
111
+ type: string;
112
+ description: string;
113
+ default: number;
114
+ };
115
+ prompt?: undefined;
116
+ aspectRatio?: undefined;
117
+ jobId?: undefined;
118
+ };
119
+ required?: undefined;
120
+ };
121
+ })[];
122
+ export declare function registerHandlers(server: Server, getApiKey: () => string): void;
123
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE,eAAO,MAAM,QAAQ,QAAsD,CAAC;AAE5E,wBAAsB,MAAM,CAAC,CAAC,EAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,CAAC,CAAC,CAyBZ;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoGjB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,QAsKvE"}