@teamflojo/floimg 0.12.0 → 0.13.1

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/QUICK_START.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Quick Start Guide
2
2
 
3
- Get started with floimg in seconds using `npx` - no installation required.
3
+ Get started with floimg in seconds using `npx` no setup required.
4
4
 
5
5
  ## Try It Now
6
6
 
package/README.md CHANGED
@@ -14,7 +14,6 @@ The core FloImg package provides the pipeline engine, built-in image transforms,
14
14
  - **Save Providers** — Filesystem and S3-compatible storage
15
15
  - **CLI** — Command-line interface with plugin auto-install
16
16
  - **Fluent API** — Chainable syntax for building pipelines
17
- - **MCP Server** — Model Context Protocol for AI agent integration
18
17
 
19
18
  ## Installation
20
19
 
@@ -104,7 +103,7 @@ npx @teamflojo/floimg qr "https://floimg.com" -o qr.png
104
103
  npx @teamflojo/floimg
105
104
  ```
106
105
 
107
- Plugins auto-install on first use. See [QUICK_START.md](./QUICK_START.md) for full CLI documentation.
106
+ See [QUICK_START.md](./QUICK_START.md) for full CLI documentation.
108
107
 
109
108
  ## Plugin Ecosystem
110
109
 
@@ -120,19 +119,27 @@ Plugins auto-install on first use. See [QUICK_START.md](./QUICK_START.md) for fu
120
119
 
121
120
  ## MCP (AI Agents)
122
121
 
123
- Use FloImg with Claude and other AI agents via MCP:
122
+ Use FloImg with Claude and other AI agents via MCP. Install the separate MCP package:
123
+
124
+ ```bash
125
+ npm install -g @teamflojo/floimg-mcp
126
+ ```
127
+
128
+ Configure your MCP client:
124
129
 
125
130
  ```json
126
131
  {
127
132
  "mcpServers": {
128
133
  "floimg": {
129
134
  "command": "npx",
130
- "args": ["-y", "@teamflojo/floimg-claude"]
135
+ "args": ["-y", "@teamflojo/floimg-mcp"]
131
136
  }
132
137
  }
133
138
  }
134
139
  ```
135
140
 
141
+ See [@teamflojo/floimg-mcp](https://www.npmjs.com/package/@teamflojo/floimg-mcp) for full documentation.
142
+
136
143
  ## Documentation
137
144
 
138
145
  - **[Getting Started](https://floimg.com/docs/getting-started/quick-start)** — Installation and first steps
package/dist/cli/index.js CHANGED
@@ -6,7 +6,6 @@ import { saveCommand } from "./commands/save.js";
6
6
  import { runCommand } from "./commands/run.js";
7
7
  import { configCommand } from "./commands/config.js";
8
8
  import { pluginsCommand } from "./commands/plugins.js";
9
- import { mcpCommand } from "./commands/mcp.js";
10
9
  import { filterCommand, presetCommand } from "./commands/filter.js";
11
10
  import { textCommand } from "./commands/text.js";
12
11
  import { aiCommand } from "./commands/ai.js";
@@ -47,7 +46,6 @@ program.addCommand(saveCommand);
47
46
  program.addCommand(runCommand);
48
47
  program.addCommand(configCommand);
49
48
  program.addCommand(pluginsCommand);
50
- program.addCommand(mcpCommand);
51
49
  program.addCommand(filterCommand);
52
50
  program.addCommand(presetCommand);
53
51
  program.addCommand(textCommand);
@@ -151,7 +149,7 @@ program
151
149
  console.log("\n✨ Ready to use! Try:");
152
150
  console.log(" floimg plugins # See available plugins");
153
151
  console.log(" floimg config init # Interactive setup");
154
- console.log(" floimg mcp install # Set up MCP for Claude Code");
152
+ console.log(" npx @teamflojo/floimg-mcp # Run MCP server for Claude Code");
155
153
  console.log(' floimg generate --generator shapes --params \'{"type":"gradient"}\' --out test.svg');
156
154
  });
157
155
  // Check if we should show interactive menu (no args provided)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,c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ACpC,MAAM,OAAO,GAAG;QACd,8BAA8B;QAC9B,sBAAsB;QACtB,2BAA2B;QAC3B,sBAAsB;QACtB,8BAA8B;KAC/B,CAAC;IAEF,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,OAAO,MAAM,EAAE,CAAC,CAAC;YAC7B,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,gBAAgB;QAClB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,CACT,sFAAsF,CACvF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,8DAA8D;AAC9D,IAAI,yBAAyB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IAC5C,mBAAmB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@teamflojo/floimg",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "Universal image workflow engine for developers and AI agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
- "floimg": "./dist/cli/index.js",
10
- "floimg-mcp": "./dist/mcp/server.js"
9
+ "floimg": "./dist/cli/index.js"
11
10
  },
12
11
  "exports": {
13
12
  ".": {
@@ -40,9 +39,7 @@
40
39
  "agent",
41
40
  "image-processing",
42
41
  "automation",
43
- "cloud-storage",
44
- "mcp",
45
- "model-context-protocol"
42
+ "cloud-storage"
46
43
  ],
47
44
  "author": "Brett Cooke",
48
45
  "license": "MIT",
@@ -57,7 +54,6 @@
57
54
  "dependencies": {
58
55
  "@aws-sdk/client-s3": "^3.709.0",
59
56
  "@aws-sdk/s3-request-presigner": "^3.958.0",
60
- "@modelcontextprotocol/sdk": "^1.20.0",
61
57
  "@napi-rs/canvas": "^0.1.80",
62
58
  "@resvg/resvg-js": "^2.6.2",
63
59
  "commander": "^12.1.0",
@@ -1,3 +0,0 @@
1
- import { Command } from "commander";
2
- export declare const mcpCommand: Command;
3
- //# sourceMappingURL=mcp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,UAAU,SAEtB,CAAC"}
@@ -1,87 +0,0 @@
1
- import { Command } from "commander";
2
- import { join, resolve } from "path";
3
- import { writeFile } from "fs/promises";
4
- export const mcpCommand = new Command("mcp").description("MCP (Model Context Protocol) integration helpers");
5
- mcpCommand
6
- .command("install")
7
- .description("Generate MCP configuration for Claude Code")
8
- .option("--global", "Install to global Claude Code config")
9
- .option("--output <path>", "Output path for MCP config snippet")
10
- .action(async (options) => {
11
- console.log("floimg MCP Setup");
12
- console.log("================\n");
13
- // Get the path to the built MCP server
14
- // When floimg is installed globally, use require.resolve to find it
15
- let serverPath;
16
- try {
17
- serverPath = require.resolve("floimg/dist/mcp/server.js");
18
- }
19
- catch {
20
- // Fallback to local path if not found via require.resolve
21
- serverPath = resolve(join(process.cwd(), "node_modules/floimg/dist/mcp/server.js"));
22
- }
23
- const mcpConfig = {
24
- mcpServers: {
25
- floimg: {
26
- command: "node",
27
- args: [serverPath],
28
- env: {
29
- // These will be read from the user's environment or .env
30
- OPENAI_API_KEY: "${OPENAI_API_KEY}",
31
- AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}",
32
- AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}",
33
- AWS_REGION: "${AWS_REGION}",
34
- S3_BUCKET: "${S3_BUCKET}",
35
- },
36
- },
37
- },
38
- };
39
- if (options.output) {
40
- // Write to specified file
41
- await writeFile(options.output, JSON.stringify(mcpConfig, null, 2));
42
- console.log(`✓ MCP configuration written to: ${options.output}\n`);
43
- }
44
- else {
45
- // Just print to console
46
- console.log("Add this to your Claude Code MCP configuration:\n");
47
- console.log(JSON.stringify(mcpConfig, null, 2));
48
- console.log("\n");
49
- }
50
- console.log("📍 Claude Code MCP config locations:");
51
- console.log(" - macOS: ~/Library/Application Support/Claude/claude_desktop_config.json");
52
- console.log(" - Windows: %APPDATA%\\Claude\\claude_desktop_config.json");
53
- console.log(" - Linux: ~/.config/claude/claude_desktop_config.json");
54
- console.log("\n💡 Next steps:");
55
- console.log(" 1. Set up your credentials (AWS, OpenAI) in environment or .env");
56
- console.log(" 2. Add the config above to your Claude Code config file");
57
- console.log(" 3. Restart Claude Code");
58
- console.log(" 4. Try: 'Create a QR code for https://example.com'");
59
- console.log("\n📖 Documentation:");
60
- console.log(" https://github.com/bcooke/floimg/blob/main/packages/floimg/docs/guides/MCP_SERVER.md");
61
- });
62
- mcpCommand
63
- .command("test")
64
- .description("Test MCP server with inspector (opens browser)")
65
- .action(async () => {
66
- console.log("Starting MCP Inspector...\n");
67
- console.log("This will open a web interface to test floimg's MCP tools.");
68
- console.log("Press Ctrl+C to stop.\n");
69
- const { spawn } = await import("child_process");
70
- // Get the path to the built MCP server
71
- let serverPath;
72
- try {
73
- serverPath = require.resolve("floimg/dist/mcp/server.js");
74
- }
75
- catch {
76
- // Fallback to local path if not found via require.resolve
77
- serverPath = resolve(join(process.cwd(), "node_modules/floimg/dist/mcp/server.js"));
78
- }
79
- const inspector = spawn("npx", ["@modelcontextprotocol/inspector", "node", serverPath], {
80
- stdio: "inherit",
81
- env: process.env,
82
- });
83
- inspector.on("close", (code) => {
84
- console.log(`\nMCP Inspector exited with code ${code}`);
85
- });
86
- });
87
- //# sourceMappingURL=mcp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../../src/cli/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CACtD,kDAAkD,CACnD,CAAC;AAEF,UAAU;KACP,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,4CAA4C,CAAC;KACzD,MAAM,CAAC,UAAU,EAAE,sCAAsC,CAAC;KAC1D,MAAM,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;KAC/D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAElC,uCAAuC;IACvC,oEAAoE;IACpE,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,0DAA0D;QAC1D,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE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{};
3
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":""}
@@ -1,989 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
- import { readFile, mkdir } from "fs/promises";
6
- import { existsSync } from "fs";
7
- import { join } from "path";
8
- import createClient from "../index.js";
9
- import { loadConfig } from "../config/loader.js";
10
- import { FloimgError } from "../core/errors.js";
11
- /**
12
- * floimg MCP Server v0.1.0 - Smart Image Generation & Workflow Orchestration
13
- *
14
- * Key improvements:
15
- * - Session workspace: Images stored with IDs, no byte passing between tools
16
- * - File path references: Transform/save can reference any image by path or ID
17
- * - Pipeline support: Multi-step workflows in a single call
18
- * - Better intent routing: Recognizes AI image requests properly
19
- */
20
- // Session workspace for storing images between tool calls
21
- const SESSION_WORKSPACE = join(process.cwd(), ".floimg", "mcp-session");
22
- const imageRegistry = new Map();
23
- // Ensure workspace exists
24
- async function ensureWorkspace() {
25
- if (!existsSync(SESSION_WORKSPACE)) {
26
- await mkdir(SESSION_WORKSPACE, { recursive: true });
27
- }
28
- }
29
- // Generate unique image ID
30
- function generateImageId() {
31
- return `img_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
32
- }
33
- // Load image from various sources
34
- async function loadImage(imageId, imagePath, imageBytes, mime) {
35
- // Priority 1: imageId (reference to session image)
36
- if (imageId) {
37
- const registered = imageRegistry.get(imageId);
38
- if (!registered) {
39
- throw new Error(`Image ID not found: ${imageId}. Use generate_image first to create an image.`);
40
- }
41
- const bytes = await readFile(registered.path);
42
- return {
43
- bytes,
44
- mime: registered.mime,
45
- ...registered.metadata,
46
- };
47
- }
48
- // Priority 2: imagePath (reference to file on disk)
49
- if (imagePath) {
50
- const bytes = await readFile(imagePath);
51
- // Detect MIME type from extension if not provided
52
- const detectedMime = mime || detectMimeFromPath(imagePath);
53
- return {
54
- bytes,
55
- mime: detectedMime,
56
- };
57
- }
58
- // Priority 3: imageBytes (base64 encoded, for external images)
59
- if (imageBytes && mime) {
60
- return {
61
- bytes: Buffer.from(imageBytes, "base64"),
62
- mime: mime,
63
- };
64
- }
65
- throw new Error("Must provide imageId, imagePath, or imageBytes+mime");
66
- }
67
- // Detect MIME type from file path
68
- function detectMimeFromPath(path) {
69
- const ext = path.split(".").pop()?.toLowerCase();
70
- const mimeMap = {
71
- svg: "image/svg+xml",
72
- png: "image/png",
73
- jpg: "image/jpeg",
74
- jpeg: "image/jpeg",
75
- webp: "image/webp",
76
- avif: "image/avif",
77
- };
78
- return mimeMap[ext || ""] || "image/png";
79
- }
80
- // Plugin auto-discovery
81
- async function loadAvailablePlugins(client) {
82
- const plugins = [];
83
- console.error("[floimg-mcp] Starting plugin discovery...");
84
- const potentialPlugins = [
85
- // Generator plugins (default export)
86
- { name: "quickchart", module: "@teamflojo/floimg-quickchart", type: "generator" },
87
- { name: "d3", module: "@teamflojo/floimg-d3", type: "generator" },
88
- { name: "mermaid", module: "@teamflojo/floimg-mermaid", type: "generator" },
89
- { name: "qr", module: "@teamflojo/floimg-qr", type: "generator" },
90
- { name: "screenshot", module: "@teamflojo/floimg-screenshot", type: "generator" },
91
- // AI provider plugins (named exports)
92
- {
93
- name: "google",
94
- module: "@teamflojo/floimg-google",
95
- type: "ai",
96
- exports: {
97
- textProvider: "geminiText",
98
- visionProvider: "geminiVision",
99
- transformProvider: "geminiTransform",
100
- generator: "geminiGenerate",
101
- },
102
- },
103
- ];
104
- for (const pluginDef of potentialPlugins) {
105
- try {
106
- console.error(`[floimg-mcp] Attempting to load ${pluginDef.module}...`);
107
- const plugin = await import(pluginDef.module);
108
- if (pluginDef.type === "generator") {
109
- // Generator plugin - use default export
110
- if (!plugin.default) {
111
- console.error(`[floimg-mcp] ⚠ ${pluginDef.module} has no default export`);
112
- continue;
113
- }
114
- const generator = typeof plugin.default === "function" ? plugin.default() : plugin.default;
115
- client.registerGenerator(generator);
116
- plugins.push(pluginDef.name);
117
- console.error(`[floimg-mcp] ✓ Loaded generator: ${pluginDef.name}`);
118
- }
119
- else if (pluginDef.type === "ai") {
120
- // AI provider plugin - use named exports
121
- const aiPlugin = pluginDef;
122
- let loadedAny = false;
123
- // Load text provider
124
- if (aiPlugin.exports.textProvider && plugin[aiPlugin.exports.textProvider]) {
125
- const textProviderFn = plugin[aiPlugin.exports.textProvider];
126
- const textProvider = typeof textProviderFn === "function" ? textProviderFn() : textProviderFn;
127
- client.registerTextProvider(textProvider);
128
- console.error(`[floimg-mcp] ✓ Loaded text provider: ${textProvider.name}`);
129
- loadedAny = true;
130
- }
131
- // Load vision provider
132
- if (aiPlugin.exports.visionProvider && plugin[aiPlugin.exports.visionProvider]) {
133
- const visionProviderFn = plugin[aiPlugin.exports.visionProvider];
134
- const visionProvider = typeof visionProviderFn === "function" ? visionProviderFn() : visionProviderFn;
135
- client.registerVisionProvider(visionProvider);
136
- console.error(`[floimg-mcp] ✓ Loaded vision provider: ${visionProvider.name}`);
137
- loadedAny = true;
138
- }
139
- // Load transform provider
140
- if (aiPlugin.exports.transformProvider && plugin[aiPlugin.exports.transformProvider]) {
141
- const transformProviderFn = plugin[aiPlugin.exports.transformProvider];
142
- const transformProvider = typeof transformProviderFn === "function" ? transformProviderFn() : transformProviderFn;
143
- client.registerTransformProvider(transformProvider);
144
- console.error(`[floimg-mcp] ✓ Loaded transform provider: ${transformProvider.name}`);
145
- loadedAny = true;
146
- }
147
- // Load generator
148
- if (aiPlugin.exports.generator && plugin[aiPlugin.exports.generator]) {
149
- const generatorFn = plugin[aiPlugin.exports.generator];
150
- const generator = typeof generatorFn === "function" ? generatorFn() : generatorFn;
151
- client.registerGenerator(generator);
152
- console.error(`[floimg-mcp] ✓ Loaded generator: ${generator.name}`);
153
- loadedAny = true;
154
- }
155
- if (loadedAny) {
156
- plugins.push(aiPlugin.name);
157
- }
158
- }
159
- }
160
- catch (err) {
161
- const error = err;
162
- console.error(`[floimg-mcp] ✗ Failed to load ${pluginDef.module}: ${error.message}`);
163
- }
164
- }
165
- console.error(`[floimg-mcp] Plugin discovery complete. Loaded: ${plugins.join(", ") || "none"}`);
166
- if (plugins.length === 0) {
167
- console.error("[floimg-mcp] ⚠ No plugins found!");
168
- console.error("[floimg-mcp] Install with: npm install -g @teamflojo/floimg-quickchart @teamflojo/floimg-mermaid @teamflojo/floimg-qr @teamflojo/floimg-d3 @teamflojo/floimg-screenshot @teamflojo/floimg-google");
169
- console.error("[floimg-mcp] Only built-in generators (shapes, openai) will be available.");
170
- }
171
- return plugins;
172
- }
173
- // Smart generator selection based on intent - IMPROVED for v0.4.0
174
- function selectGenerator(intent, params) {
175
- const intentLower = intent.toLowerCase();
176
- // QR codes
177
- if (intentLower.includes("qr") || intentLower.includes("barcode")) {
178
- return "qr";
179
- }
180
- // Screenshots
181
- if (intentLower.includes("screenshot") ||
182
- intentLower.includes("capture") ||
183
- intentLower.includes("website") ||
184
- intentLower.includes("webpage") ||
185
- (intentLower.includes("url") && params.url)) {
186
- return "screenshot";
187
- }
188
- // Diagrams (Mermaid)
189
- if (intentLower.includes("flowchart") ||
190
- intentLower.includes("diagram") ||
191
- intentLower.includes("sequence") ||
192
- intentLower.includes("gantt") ||
193
- intentLower.includes("class diagram") ||
194
- intentLower.includes("entity") ||
195
- intentLower.includes("state") ||
196
- intentLower.includes("mindmap")) {
197
- return "mermaid";
198
- }
199
- // Charts & Data Visualization (check BEFORE AI detection)
200
- if (intentLower.includes("chart") ||
201
- intentLower.includes("graph") ||
202
- intentLower.includes("plot") ||
203
- intentLower.includes("visualiz")) {
204
- // D3 for custom/complex visualizations
205
- if (params.render ||
206
- params.renderString ||
207
- intentLower.includes("custom") ||
208
- intentLower.includes("d3")) {
209
- return "d3";
210
- }
211
- // QuickChart for standard charts
212
- return "quickchart";
213
- }
214
- // AI Image Generation - IMPROVED: Better keyword detection
215
- // Check for scene descriptions, subjects, art styles, etc.
216
- const aiKeywords = [
217
- "photo",
218
- "picture",
219
- "illustration",
220
- "painting",
221
- "drawing",
222
- "scene",
223
- "image of",
224
- "portrait",
225
- "landscape",
226
- "artwork",
227
- "realistic",
228
- "photorealistic",
229
- "stylized",
230
- "artistic",
231
- "dall-e",
232
- "ai image",
233
- "ai generated",
234
- "generate image",
235
- "person",
236
- "people",
237
- "animal",
238
- "building",
239
- "nature",
240
- "stadium",
241
- "player",
242
- "celebrating",
243
- "sunset",
244
- "dramatic",
245
- ];
246
- const hasAIKeyword = aiKeywords.some((keyword) => intentLower.includes(keyword));
247
- const hasPromptParam = params.prompt !== undefined;
248
- // Route to OpenAI if:
249
- // 1. Has AI-related keywords OR
250
- // 2. Has prompt parameter OR
251
- // 3. Intent describes a scene/subject (more than 5 words)
252
- const wordCount = intent.trim().split(/\s+/).length;
253
- const isDescriptiveIntent = wordCount > 5 && !intentLower.includes("gradient") && !intentLower.includes("shape");
254
- if (hasAIKeyword || hasPromptParam || isDescriptiveIntent) {
255
- return "openai";
256
- }
257
- // Default to shapes for simple SVG graphics (gradients, basic shapes)
258
- return "shapes";
259
- }
260
- // Initialize server
261
- const server = new Server({
262
- name: "floimg",
263
- version: "0.1.0",
264
- }, {
265
- capabilities: {
266
- tools: {},
267
- },
268
- });
269
- // Define available tools
270
- const TOOLS = [
271
- {
272
- name: "generate_image",
273
- description: "Generate any type of image. Routes to the appropriate generator based on intent. " +
274
- "Supports: AI images (DALL-E), charts (bar, line, pie), diagrams (flowcharts, sequence), " +
275
- "QR codes, screenshots, data visualizations (D3), and simple shapes/gradients. " +
276
- "Images are saved to session workspace and assigned an imageId for chaining operations.",
277
- inputSchema: {
278
- type: "object",
279
- properties: {
280
- intent: {
281
- type: "string",
282
- description: "Brief description to route to the right generator and provide simple defaults. " +
283
- "For AI images: intent becomes the prompt (e.g., 'golden retriever in field'). " +
284
- "For QR codes: include the URL (e.g., 'QR code for https://example.com'). " +
285
- "For charts/diagrams: just routing hint (e.g., 'bar chart', 'flowchart') - must provide params with data.",
286
- },
287
- params: {
288
- type: "object",
289
- description: "Generator-specific parameters. " +
290
- "AI images & QR codes: Optional (auto-filled from intent). " +
291
- "Charts & diagrams: REQUIRED - must provide structured data. " +
292
- "Examples: " +
293
- "Charts: {type: 'bar', data: {labels: [...], datasets: [...]}}. " +
294
- "Diagrams: {code: 'graph TD; A-->B'}. " +
295
- "AI images: {prompt: '...', size: '1024x1024'} (or omit, uses intent). " +
296
- "QR codes: {text: 'https://...'} (or omit if URL in intent).",
297
- default: {},
298
- },
299
- saveTo: {
300
- type: "string",
301
- description: "Optional: Also save to a destination (filesystem or cloud). " +
302
- "Examples: './output.png', 's3://bucket/key.png', 'r2://bucket/key.png'. " +
303
- "Image is always saved to session workspace regardless.",
304
- },
305
- },
306
- required: ["intent"],
307
- },
308
- },
309
- {
310
- name: "transform_image",
311
- description: "Apply deterministic, pixel-precise transforms to images. Unlike AI regeneration " +
312
- "(DALL-E, inpainting), these operations mathematically modify exactly what you specify—" +
313
- "the rest of your image stays identical. When you say 'resize to 1200x630,' it does " +
314
- "exactly that, guaranteed. " +
315
- "Supports: resize, convert, blur, sharpen, grayscale, modulate (brightness/saturation/hue), " +
316
- "tint, roundCorners, addText, addCaption, and preset filters. " +
317
- "Reference images by: imageId (from generate_image), imagePath, or imageBytes. " +
318
- "Each transform creates a new imageId for chaining.",
319
- inputSchema: {
320
- type: "object",
321
- properties: {
322
- imageId: {
323
- type: "string",
324
- description: "ID of image from previous generate_image or transform_image call",
325
- },
326
- imagePath: {
327
- type: "string",
328
- description: "Path to image file on disk (e.g., './my-image.png', 'generated/abc.png')",
329
- },
330
- imageBytes: {
331
- type: "string",
332
- description: "Base64-encoded image bytes (for external images not in session)",
333
- },
334
- mime: {
335
- type: "string",
336
- description: "MIME type (required only if using imageBytes, auto-detected for imagePath/imageId)",
337
- },
338
- operation: {
339
- type: "string",
340
- description: "Transform operation to apply",
341
- enum: [
342
- "convert",
343
- "resize",
344
- "composite",
345
- "optimizeSvg",
346
- "blur",
347
- "sharpen",
348
- "grayscale",
349
- "negate",
350
- "normalize",
351
- "threshold",
352
- "modulate",
353
- "tint",
354
- "extend",
355
- "extract",
356
- "roundCorners",
357
- "addText",
358
- "addCaption",
359
- "preset",
360
- ],
361
- },
362
- params: {
363
- type: "object",
364
- description: "Parameters for the operation. Examples: " +
365
- "resize: {width: 800, height: 600}, " +
366
- "blur: {sigma: 5}, " +
367
- "modulate: {brightness: 1.2, saturation: 1.3}, " +
368
- "roundCorners: {radius: 20}, " +
369
- "addText: {text: 'Hello', x: 100, y: 100, size: 48, color: '#fff', shadow: true}, " +
370
- "addCaption: {text: 'Caption', position: 'bottom'}, " +
371
- "preset: {name: 'vintage' | 'vibrant' | 'dramatic' | 'soft'}",
372
- },
373
- to: {
374
- type: "string",
375
- description: "Target MIME type (for convert operation)",
376
- },
377
- saveTo: {
378
- type: "string",
379
- description: "Optional: Also save to a destination (filesystem or cloud). " +
380
- "Image is always saved to session workspace regardless.",
381
- },
382
- },
383
- required: ["operation"],
384
- },
385
- },
386
- {
387
- name: "save_image",
388
- description: "Save an image to filesystem or cloud storage (S3, Tigris, R2, etc.). " +
389
- "Reference images by: imageId (from previous calls), imagePath (any file), or imageBytes (base64). " +
390
- "Supports smart destination routing: './output.png' → filesystem, 's3://bucket/key' → S3. " +
391
- "Returns public URL if saving to cloud storage.",
392
- inputSchema: {
393
- type: "object",
394
- properties: {
395
- imageId: {
396
- type: "string",
397
- description: "ID of image from previous generate_image or transform_image call",
398
- },
399
- imagePath: {
400
- type: "string",
401
- description: "Path to image file on disk",
402
- },
403
- imageBytes: {
404
- type: "string",
405
- description: "Base64-encoded image bytes",
406
- },
407
- mime: {
408
- type: "string",
409
- description: "MIME type (required only if using imageBytes)",
410
- },
411
- destination: {
412
- type: "string",
413
- description: "Where to save: './output.png', 's3://bucket/key.png', 'r2://bucket/key.png'",
414
- },
415
- provider: {
416
- type: "string",
417
- description: "Storage provider: 's3' or 'fs' (auto-detected from destination if not specified)",
418
- },
419
- },
420
- required: ["destination"],
421
- },
422
- },
423
- {
424
- name: "run_pipeline",
425
- description: "Execute a complete image workflow as one atomic operation. Combine AI generation " +
426
- "with deterministic transforms and cloud upload in a single call. What typically " +
427
- "requires 4+ separate tools becomes one pipeline: generate → transform → save. " +
428
- "Each step auto-chains to the next. Session state means you can iterate: run a " +
429
- "pipeline, then refine with additional transforms without starting over.",
430
- inputSchema: {
431
- type: "object",
432
- properties: {
433
- steps: {
434
- type: "array",
435
- description: "Array of steps to execute in order. Each step is an object with one key: " +
436
- "'generate', 'transform', or 'save'. The value is the parameters for that operation.",
437
- items: {
438
- type: "object",
439
- },
440
- },
441
- },
442
- required: ["steps"],
443
- },
444
- },
445
- {
446
- name: "analyze_image",
447
- description: "Analyze an image using AI vision (Claude Vision, GPT-4V, Gemini Vision, Ollama LLaVA). " +
448
- "Returns text or structured JSON describing the image content. " +
449
- "Reference images by: imageId (from previous calls), imagePath (any file), or imageBytes (base64). " +
450
- "Useful for: extracting text, describing contents, detecting objects, answering questions about images.",
451
- inputSchema: {
452
- type: "object",
453
- properties: {
454
- imageId: {
455
- type: "string",
456
- description: "ID of image from previous generate_image or transform_image call",
457
- },
458
- imagePath: {
459
- type: "string",
460
- description: "Path to image file on disk (e.g., './my-image.png')",
461
- },
462
- imageBytes: {
463
- type: "string",
464
- description: "Base64-encoded image bytes",
465
- },
466
- mime: {
467
- type: "string",
468
- description: "MIME type (required only if using imageBytes)",
469
- },
470
- prompt: {
471
- type: "string",
472
- description: "What to analyze or ask about the image. " +
473
- "Examples: 'Describe this image', 'What text is visible?', 'List all objects'",
474
- },
475
- provider: {
476
- type: "string",
477
- description: "Vision provider to use. Defaults to first available. " +
478
- "Options: 'openai' (GPT-4V), 'anthropic' (Claude), 'ollama' (LLaVA), 'gemini'",
479
- enum: ["openai", "anthropic", "ollama", "gemini"],
480
- },
481
- outputFormat: {
482
- type: "string",
483
- description: "Output format: 'text' (default) or 'json' (structured data)",
484
- enum: ["text", "json"],
485
- },
486
- },
487
- required: ["prompt"],
488
- },
489
- },
490
- {
491
- name: "generate_text",
492
- description: "Generate text using AI (Claude, GPT-4, Gemini, Ollama Llama/Mistral). " +
493
- "Useful for: creating prompts, writing descriptions, generating code, expanding on ideas. " +
494
- "Can optionally take context from previous analysis to chain operations.",
495
- inputSchema: {
496
- type: "object",
497
- properties: {
498
- prompt: {
499
- type: "string",
500
- description: "The prompt or question to generate text for",
501
- },
502
- context: {
503
- type: "string",
504
- description: "Optional context to include (e.g., output from analyze_image)",
505
- },
506
- provider: {
507
- type: "string",
508
- description: "Text provider to use. Defaults to first available. " +
509
- "Options: 'openai' (GPT-4), 'anthropic' (Claude), 'ollama' (Llama/Mistral), 'gemini'",
510
- enum: ["openai", "anthropic", "ollama", "gemini"],
511
- },
512
- systemPrompt: {
513
- type: "string",
514
- description: "Optional system prompt to set the AI's behavior/role",
515
- },
516
- temperature: {
517
- type: "number",
518
- description: "Creativity level (0.0 = deterministic, 1.0 = creative). Default: 0.7",
519
- },
520
- maxTokens: {
521
- type: "number",
522
- description: "Maximum tokens to generate. Default: 1024",
523
- },
524
- },
525
- required: ["prompt"],
526
- },
527
- },
528
- ];
529
- // List tools handler
530
- server.setRequestHandler(ListToolsRequestSchema, async () => {
531
- return { tools: TOOLS };
532
- });
533
- // Call tool handler
534
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
535
- const { name, arguments: args } = request.params;
536
- try {
537
- await ensureWorkspace();
538
- // Load configuration (from floimg.config.ts or .floimgrc.json)
539
- const config = await loadConfig();
540
- const client = createClient(config);
541
- // Load available plugins
542
- const availablePlugins = await loadAvailablePlugins(client);
543
- console.error(`[floimg-mcp] Available generators: shapes, openai, ${availablePlugins.join(", ")}`);
544
- switch (name) {
545
- case "generate_image": {
546
- const { intent, params = {}, saveTo, } = args;
547
- if (!intent) {
548
- throw new Error("'intent' parameter is required");
549
- }
550
- // Smart generator selection
551
- const generator = selectGenerator(intent, params);
552
- console.error(`[floimg-mcp] Intent: "${intent}" → Generator: ${generator}`);
553
- // Auto-fill params for simple cases to improve UX
554
- const finalParams = { ...params };
555
- if (generator === "openai" && !finalParams.prompt) {
556
- // For AI images: use intent as prompt
557
- finalParams.prompt = intent;
558
- finalParams.size = finalParams.size || "1024x1024";
559
- console.error(`[floimg-mcp] Auto-filled: prompt="${intent}", size=${finalParams.size}`);
560
- }
561
- if (generator === "qr" && !finalParams.text) {
562
- // For QR codes: extract URL from intent
563
- const urlMatch = intent.match(/https?:\/\/[^\s]+/);
564
- if (urlMatch) {
565
- finalParams.text = urlMatch[0];
566
- console.error(`[floimg-mcp] Auto-filled: text="${finalParams.text}"`);
567
- }
568
- else {
569
- throw new Error("Could not extract URL from intent for QR code. " +
570
- "Please provide params.text explicitly. " +
571
- "Example: { intent: 'qr code', params: { text: 'https://example.com' } }");
572
- }
573
- }
574
- // For charts and diagrams: params always required (too complex to extract)
575
- if ((generator === "quickchart" || generator === "mermaid" || generator === "d3") &&
576
- !finalParams.type &&
577
- !finalParams.data &&
578
- !finalParams.code &&
579
- !finalParams.render) {
580
- throw new Error(`${generator} requires explicit params. Intent is only for routing. ` +
581
- `Please provide structured data: ` +
582
- `${generator === "quickchart" ? '{ type: "bar", data: {...} }' : ""}` +
583
- `${generator === "mermaid" ? '{ code: "graph TD; A-->B" }' : ""}` +
584
- `${generator === "d3" ? '{ render: "...", data: [...] }' : ""}`);
585
- }
586
- const blob = await client.generate({
587
- generator,
588
- params: finalParams,
589
- });
590
- // Save to session workspace
591
- const imageId = generateImageId();
592
- const ext = getExtension(blob.mime);
593
- const sessionPath = join(SESSION_WORKSPACE, `${imageId}.${ext}`);
594
- await client.save(blob, sessionPath);
595
- // Register in session
596
- imageRegistry.set(imageId, {
597
- path: sessionPath,
598
- mime: blob.mime,
599
- metadata: {
600
- width: blob.width,
601
- height: blob.height,
602
- source: blob.source,
603
- },
604
- });
605
- console.error(`[floimg-mcp] Saved to session: ${imageId} → ${sessionPath}`);
606
- // Optionally save to additional destination
607
- let cloudResult = null;
608
- if (saveTo) {
609
- cloudResult = await client.save(blob, saveTo);
610
- console.error(`[floimg-mcp] Also saved to: ${saveTo}`);
611
- }
612
- return {
613
- content: [
614
- {
615
- type: "text",
616
- text: JSON.stringify({
617
- success: true,
618
- imageId,
619
- generator,
620
- session: {
621
- path: sessionPath,
622
- mime: blob.mime,
623
- width: blob.width,
624
- height: blob.height,
625
- },
626
- ...(cloudResult && {
627
- saved: {
628
- location: cloudResult.location,
629
- provider: cloudResult.provider,
630
- size: cloudResult.size,
631
- },
632
- }),
633
- }, null, 2),
634
- },
635
- ],
636
- };
637
- }
638
- case "transform_image": {
639
- const { imageId, imagePath, imageBytes, mime, operation, params = {}, to, saveTo, } = args;
640
- // Load input image
641
- const inputBlob = await loadImage(imageId, imagePath, imageBytes, mime);
642
- let resultBlob;
643
- // Handle special cases that need specific parameters
644
- if (operation === "convert") {
645
- if (!to)
646
- throw new Error("'to' parameter required for convert operation");
647
- resultBlob = await client.transform({
648
- blob: inputBlob,
649
- op: "convert",
650
- to: to,
651
- params,
652
- });
653
- }
654
- else if (operation === "resize") {
655
- const { width, height } = params;
656
- if (!width && !height)
657
- throw new Error("'width' or 'height' required in params for resize");
658
- resultBlob = await client.transform({
659
- blob: inputBlob,
660
- op: "resize",
661
- params: { width, height, ...params },
662
- });
663
- }
664
- else {
665
- // All other operations use the generic params approach
666
- resultBlob = await client.transform({
667
- blob: inputBlob,
668
- op: operation,
669
- params,
670
- });
671
- }
672
- // Save to session workspace
673
- const newImageId = generateImageId();
674
- const ext = getExtension(resultBlob.mime);
675
- const sessionPath = join(SESSION_WORKSPACE, `${newImageId}.${ext}`);
676
- await client.save(resultBlob, sessionPath);
677
- // Register in session
678
- imageRegistry.set(newImageId, {
679
- path: sessionPath,
680
- mime: resultBlob.mime,
681
- metadata: {
682
- width: resultBlob.width,
683
- height: resultBlob.height,
684
- source: resultBlob.source,
685
- },
686
- });
687
- console.error(`[floimg-mcp] Transformed and saved: ${newImageId} → ${sessionPath}`);
688
- // Optionally save to additional destination
689
- let cloudResult = null;
690
- if (saveTo) {
691
- cloudResult = await client.save(resultBlob, saveTo);
692
- console.error(`[floimg-mcp] Also saved to: ${saveTo}`);
693
- }
694
- return {
695
- content: [
696
- {
697
- type: "text",
698
- text: JSON.stringify({
699
- success: true,
700
- imageId: newImageId,
701
- operation,
702
- session: {
703
- path: sessionPath,
704
- mime: resultBlob.mime,
705
- width: resultBlob.width,
706
- height: resultBlob.height,
707
- },
708
- ...(cloudResult && {
709
- saved: {
710
- location: cloudResult.location,
711
- provider: cloudResult.provider,
712
- size: cloudResult.size,
713
- },
714
- }),
715
- }, null, 2),
716
- },
717
- ],
718
- };
719
- }
720
- case "save_image": {
721
- const { imageId, imagePath, imageBytes, mime, destination, provider } = args;
722
- // Load input image
723
- const inputBlob = await loadImage(imageId, imagePath, imageBytes, mime);
724
- const result = await client.save(inputBlob, provider ? { path: destination, provider } : destination);
725
- console.error(`[floimg-mcp] Saved to: ${destination}`);
726
- return {
727
- content: [
728
- {
729
- type: "text",
730
- text: JSON.stringify({
731
- success: true,
732
- location: result.location,
733
- provider: result.provider,
734
- size: result.size,
735
- mime: result.mime,
736
- }, null, 2),
737
- },
738
- ],
739
- };
740
- }
741
- case "run_pipeline": {
742
- const { steps } = args;
743
- if (!Array.isArray(steps) || steps.length === 0) {
744
- throw new Error("'steps' must be a non-empty array");
745
- }
746
- let currentImageId;
747
- const results = [];
748
- for (let i = 0; i < steps.length; i++) {
749
- const step = steps[i];
750
- const stepType = Object.keys(step)[0]; // 'generate', 'transform', or 'save'
751
- const stepParams = step[stepType];
752
- console.error(`[floimg-mcp] Pipeline step ${i + 1}/${steps.length}: ${stepType}`);
753
- if (stepType === "generate") {
754
- // Generate step
755
- const { intent, params = {} } = stepParams;
756
- const generator = selectGenerator(intent, params);
757
- // Auto-fill params for simple cases (same logic as generate_image tool)
758
- const finalParams = { ...params };
759
- if (generator === "openai" && !finalParams.prompt) {
760
- finalParams.prompt = intent;
761
- finalParams.size = finalParams.size || "1024x1024";
762
- }
763
- if (generator === "qr" && !finalParams.text) {
764
- const urlMatch = intent.match(/https?:\/\/[^\s]+/);
765
- if (urlMatch)
766
- finalParams.text = urlMatch[0];
767
- }
768
- const blob = await client.generate({ generator, params: finalParams });
769
- // Save to session
770
- const imageId = generateImageId();
771
- const ext = getExtension(blob.mime);
772
- const sessionPath = join(SESSION_WORKSPACE, `${imageId}.${ext}`);
773
- await client.save(blob, sessionPath);
774
- imageRegistry.set(imageId, {
775
- path: sessionPath,
776
- mime: blob.mime,
777
- metadata: { width: blob.width, height: blob.height, source: blob.source },
778
- });
779
- currentImageId = imageId;
780
- results.push({ step: i + 1, type: "generate", imageId, generator });
781
- }
782
- else if (stepType === "transform") {
783
- // Transform step - uses current image
784
- if (!currentImageId) {
785
- throw new Error(`Pipeline step ${i + 1}: transform requires a previous generate step`);
786
- }
787
- const { operation, params = {}, to } = stepParams;
788
- const inputBlob = await loadImage(currentImageId);
789
- let resultBlob;
790
- if (operation === "convert") {
791
- resultBlob = await client.transform({
792
- blob: inputBlob,
793
- op: "convert",
794
- to: to,
795
- params,
796
- });
797
- }
798
- else if (operation === "resize") {
799
- resultBlob = await client.transform({
800
- blob: inputBlob,
801
- op: "resize",
802
- params,
803
- });
804
- }
805
- else {
806
- resultBlob = await client.transform({
807
- blob: inputBlob,
808
- op: operation,
809
- params,
810
- });
811
- }
812
- // Save to session
813
- const newImageId = generateImageId();
814
- const ext = getExtension(resultBlob.mime);
815
- const sessionPath = join(SESSION_WORKSPACE, `${newImageId}.${ext}`);
816
- await client.save(resultBlob, sessionPath);
817
- imageRegistry.set(newImageId, {
818
- path: sessionPath,
819
- mime: resultBlob.mime,
820
- metadata: { width: resultBlob.width, height: resultBlob.height },
821
- });
822
- currentImageId = newImageId;
823
- results.push({ step: i + 1, type: "transform", operation, imageId: newImageId });
824
- }
825
- else if (stepType === "save") {
826
- // Save step - saves current image
827
- if (!currentImageId) {
828
- throw new Error(`Pipeline step ${i + 1}: save requires a previous generate/transform step`);
829
- }
830
- const { destination, provider } = stepParams;
831
- const inputBlob = await loadImage(currentImageId);
832
- const result = await client.save(inputBlob, provider ? { path: destination, provider } : destination);
833
- results.push({
834
- step: i + 1,
835
- type: "save",
836
- location: result.location,
837
- provider: result.provider,
838
- size: result.size,
839
- });
840
- }
841
- else {
842
- throw new Error(`Unknown pipeline step type: ${stepType}. Use 'generate', 'transform', or 'save'.`);
843
- }
844
- }
845
- return {
846
- content: [
847
- {
848
- type: "text",
849
- text: JSON.stringify({
850
- success: true,
851
- pipeline: {
852
- totalSteps: steps.length,
853
- finalImageId: currentImageId,
854
- results,
855
- },
856
- }, null, 2),
857
- },
858
- ],
859
- };
860
- }
861
- case "analyze_image": {
862
- const { imageId, imagePath, imageBytes, mime, prompt, provider, outputFormat = "text", } = args;
863
- if (!prompt) {
864
- throw new Error("'prompt' parameter is required");
865
- }
866
- // Load input image
867
- const inputBlob = await loadImage(imageId, imagePath, imageBytes, mime);
868
- // Check if vision providers are available
869
- const capabilities = client.getCapabilities();
870
- if (!capabilities.visionProviders || capabilities.visionProviders.length === 0) {
871
- throw new Error("No vision providers configured. " +
872
- "Configure AI providers in floimg.config.ts or environment variables. " +
873
- "Supported: OpenAI (OPENAI_API_KEY), Anthropic (ANTHROPIC_API_KEY), " +
874
- "Ollama (OLLAMA_BASE_URL), Gemini (GOOGLE_AI_API_KEY)");
875
- }
876
- // Select provider (use specified or first available)
877
- const selectedProvider = provider || capabilities.visionProviders[0].name;
878
- console.error(`[floimg-mcp] Analyzing image with provider: ${selectedProvider}`);
879
- const result = await client.analyzeImage({
880
- provider: selectedProvider,
881
- blob: inputBlob,
882
- params: {
883
- prompt,
884
- outputFormat,
885
- },
886
- });
887
- console.error(`[floimg-mcp] Analysis complete: ${result.content.slice(0, 100)}...`);
888
- return {
889
- content: [
890
- {
891
- type: "text",
892
- text: JSON.stringify({
893
- success: true,
894
- provider: selectedProvider,
895
- outputFormat: result.type,
896
- content: result.content,
897
- ...(result.parsed && { parsed: result.parsed }),
898
- }, null, 2),
899
- },
900
- ],
901
- };
902
- }
903
- case "generate_text": {
904
- const { prompt, context, provider, systemPrompt, temperature, maxTokens } = args;
905
- if (!prompt) {
906
- throw new Error("'prompt' parameter is required");
907
- }
908
- // Check if text providers are available
909
- const capabilities = client.getCapabilities();
910
- if (!capabilities.textProviders || capabilities.textProviders.length === 0) {
911
- throw new Error("No text providers configured. " +
912
- "Configure AI providers in floimg.config.ts or environment variables. " +
913
- "Supported: OpenAI (OPENAI_API_KEY), Anthropic (ANTHROPIC_API_KEY), " +
914
- "Ollama (OLLAMA_BASE_URL), Gemini (GOOGLE_AI_API_KEY)");
915
- }
916
- // Select provider (use specified or first available)
917
- const selectedProvider = provider || capabilities.textProviders[0].name;
918
- console.error(`[floimg-mcp] Generating text with provider: ${selectedProvider}`);
919
- const result = await client.generateText({
920
- provider: selectedProvider,
921
- params: {
922
- prompt,
923
- ...(context && { context }),
924
- ...(systemPrompt && { systemPrompt }),
925
- ...(temperature !== undefined && { temperature }),
926
- ...(maxTokens !== undefined && { maxTokens }),
927
- },
928
- });
929
- console.error(`[floimg-mcp] Text generation complete: ${result.content.slice(0, 100)}...`);
930
- return {
931
- content: [
932
- {
933
- type: "text",
934
- text: JSON.stringify({
935
- success: true,
936
- provider: selectedProvider,
937
- content: result.content,
938
- }, null, 2),
939
- },
940
- ],
941
- };
942
- }
943
- default:
944
- throw new Error(`Unknown tool: ${name}`);
945
- }
946
- }
947
- catch (error) {
948
- const message = error instanceof Error ? error.message : String(error);
949
- const errorType = error instanceof FloimgError ? error.name : "Error";
950
- return {
951
- content: [
952
- {
953
- type: "text",
954
- text: JSON.stringify({
955
- success: false,
956
- error: errorType,
957
- message,
958
- }, null, 2),
959
- },
960
- ],
961
- isError: true,
962
- };
963
- }
964
- });
965
- // Helper: Get file extension from MIME type
966
- function getExtension(mime) {
967
- const map = {
968
- "image/svg+xml": "svg",
969
- "image/png": "png",
970
- "image/jpeg": "jpg",
971
- "image/webp": "webp",
972
- "image/avif": "avif",
973
- };
974
- return map[mime] || "png";
975
- }
976
- // Start server with stdio transport
977
- async function main() {
978
- const transport = new StdioServerTransport();
979
- await server.connect(transport);
980
- // Log to stderr (stdout is used for MCP communication)
981
- console.error("floimg MCP server v0.1.0 running on stdio");
982
- console.error("Session workspace:", SESSION_WORKSPACE);
983
- console.error("Smart routing enabled - will auto-select best generator based on intent");
984
- }
985
- main().catch((error) => {
986
- console.error("Fatal error:", error);
987
- process.exit(1);
988
- });
989
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;GAQG;AAEH,0DAA0D;AAC1D,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AACxE,MAAM,aAAa,GAAG,IAAI,GAAG,EAA2D,CAAC;AAEzF,0BAA0B;AAC1B,KAAK,UAAU,eAAe;IAC5B,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACnC,M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