imgx-mcp 0.9.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/CHANGELOG.md +168 -0
- package/LICENSE +21 -0
- package/README.md +379 -0
- package/dist/cli.bundle.js +39966 -0
- package/dist/mcp.bundle.js +69794 -0
- package/package.json +54 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.9.0 (2026-02-28)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Renamed from `imgx-cli` to `imgx-mcp`** — reflects primary value as an MCP server for AI coding agents (Claude Code, Codex CLI, Cursor, etc.). CLI command remains `imgx`. npm package is now `imgx-mcp`.
|
|
8
|
+
- Updated tagline: "AI image generation and editing for Claude Code, Codex CLI, and MCP-compatible AI agents"
|
|
9
|
+
- All plugin manifests, registry entries, and documentation updated to `imgx-mcp`
|
|
10
|
+
|
|
11
|
+
### Migration
|
|
12
|
+
|
|
13
|
+
- `npm install -g imgx-mcp` (replaces `imgx-cli`)
|
|
14
|
+
- MCP config: `--package=imgx-mcp` (replaces `--package=imgx-cli`)
|
|
15
|
+
- Claude Code plugin: `somacoffeekyoto/imgx-mcp` (replaces `somacoffeekyoto/imgx-cli`)
|
|
16
|
+
- GitHub repo: `somacoffeekyoto/imgx-mcp` (auto-redirect from old URL)
|
|
17
|
+
|
|
18
|
+
## 0.8.1 (2026-02-27)
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Remove MCP inline preview size guard — always include base64 image data in MCP responses regardless of size. MCP clients that support `type: "image"` content (e.g. Claude Desktop) will display inline; others will use the file path from the text content. Gemini-generated images (~900KB raw, ~1.2MB base64) exceed Claude Desktop's 1MB limit but the file path fallback ensures usability.
|
|
23
|
+
|
|
24
|
+
## 0.8.0 (2026-02-27)
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **MCP inline preview size guard** — images exceeding ~780KB base64 (Claude Desktop's 1MB tool result limit) are now gracefully skipped from inline preview. Full-quality images are always saved to disk. Previously, oversized images caused silent display failures in Claude Desktop.
|
|
29
|
+
|
|
30
|
+
## 0.7.1 (2026-02-27)
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Remove `MULTIPLE_OUTPUTS` capability from Gemini provider — `gemini-3-pro-image-preview` does not support `candidateCount`, causing errors when `count > 1`
|
|
35
|
+
|
|
36
|
+
## 0.7.0 (2026-02-27)
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **Output format selection** — `--format` flag (CLI) and `output_format` parameter (MCP) to choose between `png`, `jpeg`, or `webp` output. Currently supported by OpenAI provider (`gpt-image-1`). Gemini provider outputs PNG regardless of format setting.
|
|
41
|
+
- `OUTPUT_FORMAT` capability added to provider capability system
|
|
42
|
+
|
|
43
|
+
## 0.6.2 (2026-02-27)
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- **Image preview in MCP responses** — MCP tool results now include inline image data (base64) alongside file paths. Claude Desktop and other MCP clients can display generated/edited images directly without opening files manually.
|
|
48
|
+
|
|
49
|
+
## 0.6.1 (2026-02-27)
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Default output directory changed from process cwd to `~/Pictures/imgx` — fixes images being saved to AppData when used via MCP (Claude Desktop, etc.)
|
|
54
|
+
|
|
55
|
+
## 0.6.0 (2026-02-27)
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- **OpenAI provider** — `gpt-image-1` model with generate and edit support
|
|
60
|
+
- Native `fetch` implementation (no `openai` npm dependency)
|
|
61
|
+
- Aspect ratio mapping to OpenAI size strings, resolution mapping to quality parameter
|
|
62
|
+
- Manual multipart/form-data construction for Node 18 compatibility
|
|
63
|
+
- `OPENAI_API_KEY` environment variable support
|
|
64
|
+
- `--provider` flag for `imgx config set api-key` — manage API keys per provider
|
|
65
|
+
- `imgx config set api-key <key> --provider openai`
|
|
66
|
+
- `imgx config list` now shows all configured provider keys
|
|
67
|
+
|
|
68
|
+
### Changed
|
|
69
|
+
|
|
70
|
+
- CLI and MCP server now initialize both Gemini and OpenAI providers at startup
|
|
71
|
+
- `imgx providers` and error messages updated for multi-provider context
|
|
72
|
+
- Help text updated with OpenAI provider info and env var
|
|
73
|
+
|
|
74
|
+
## 0.5.2 (2026-02-26)
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- `imgx-mcp` bin: added missing shebang (`#!/usr/bin/env node`) — fixes `npx imgx-mcp` and Claude Desktop MCP integration on all platforms
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- README: add Claude Desktop MCP configuration (Windows `cmd /c` + macOS/Linux)
|
|
83
|
+
- README: switch all MCP config examples from local `node` path to `npx`
|
|
84
|
+
- README: replace "Version updates" with full release checklist (version bump → build → publish → verify)
|
|
85
|
+
|
|
86
|
+
## 0.5.1 (2026-02-26)
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
|
|
90
|
+
- Published to npm (`npm install -g imgx-cli` / `npx imgx`)
|
|
91
|
+
- `mcpName` field for MCP Registry integration
|
|
92
|
+
- `server.json` for MCP Registry publishing
|
|
93
|
+
|
|
94
|
+
### Changed
|
|
95
|
+
|
|
96
|
+
- README: added Claude Desktop MCP configuration section with output directory note
|
|
97
|
+
- README: added Google AI Studio link for API key setup, MCP env section note
|
|
98
|
+
|
|
99
|
+
## 0.5.0 (2026-02-26)
|
|
100
|
+
|
|
101
|
+
### Added
|
|
102
|
+
|
|
103
|
+
- `edit_last` MCP tool — edit the last generated/edited image via MCP without specifying input path
|
|
104
|
+
- `imgx init` command — create `.imgxrc` project config template in current directory
|
|
105
|
+
- MCP server now tracks last output (shared with CLI `--last` flag)
|
|
106
|
+
|
|
107
|
+
## 0.4.0 (2026-02-26)
|
|
108
|
+
|
|
109
|
+
### Added
|
|
110
|
+
|
|
111
|
+
- `--last` (`-l`) flag for `edit` command — use the previous output as input automatically
|
|
112
|
+
- Works with both `generate` and `edit` outputs
|
|
113
|
+
- Enables iterative editing without manually specifying file paths
|
|
114
|
+
- `.imgxrc` project config — place in project directory for project-level defaults
|
|
115
|
+
- Supports `defaults.model`, `defaults.outputDir`, `defaults.aspectRatio`, `defaults.resolution`, `defaults.provider`
|
|
116
|
+
- Shared via Git (no API keys — use `imgx config set api-key` or env vars)
|
|
117
|
+
|
|
118
|
+
### Changed
|
|
119
|
+
|
|
120
|
+
- Settings resolution expanded to 5 layers: CLI flags → env vars → `.imgxrc` → user config → provider defaults
|
|
121
|
+
|
|
122
|
+
## 0.3.0 (2026-02-26)
|
|
123
|
+
|
|
124
|
+
### Added
|
|
125
|
+
|
|
126
|
+
- `imgx config` command — manage API keys and default settings via config file
|
|
127
|
+
- `config set api-key <key>` — save Gemini API key (no more manual environment variable setup)
|
|
128
|
+
- `config set model|provider|output-dir|aspect-ratio|resolution <value>` — set defaults
|
|
129
|
+
- `config list` — show all settings
|
|
130
|
+
- `config get <key>` — show a specific setting (API key is masked)
|
|
131
|
+
- `config path` — show config file location
|
|
132
|
+
- Config file at `~/.config/imgx/config.json` (Linux/macOS) or `%APPDATA%\imgx\config.json` (Windows)
|
|
133
|
+
- Settings resolution: CLI flags → environment variables → config file → provider defaults
|
|
134
|
+
- Uninstall instructions in README (plugin, npm, MCP, config cleanup)
|
|
135
|
+
|
|
136
|
+
### Changed
|
|
137
|
+
|
|
138
|
+
- API key resolution: environment variable → config file (env var still takes precedence)
|
|
139
|
+
- Default model, provider, output-dir, aspect-ratio, resolution are now configurable via `imgx config set`
|
|
140
|
+
|
|
141
|
+
## 0.2.0 (2026-02-26)
|
|
142
|
+
|
|
143
|
+
### Added
|
|
144
|
+
|
|
145
|
+
- MCP server (`dist/mcp.bundle.js`) — exposes `generate_image`, `edit_image`, `list_providers` tools via Model Context Protocol stdio transport
|
|
146
|
+
- Works with Gemini CLI, Codex CLI, Antigravity, Cursor, Windsurf, Continue.dev, Cline, Zed, and any MCP-compatible tool
|
|
147
|
+
- `.mcp.json` updated with actual server config for Claude Code plugin auto-registration
|
|
148
|
+
- `imgx-mcp` bin command for direct MCP server execution
|
|
149
|
+
|
|
150
|
+
## 0.1.0 (2026-02-26)
|
|
151
|
+
|
|
152
|
+
Initial release.
|
|
153
|
+
|
|
154
|
+
### Features
|
|
155
|
+
|
|
156
|
+
- `generate` command: text-to-image generation
|
|
157
|
+
- `edit` command: image editing with text instructions
|
|
158
|
+
- `providers` command: list available providers
|
|
159
|
+
- `capabilities` command: show provider capabilities
|
|
160
|
+
- Gemini provider with 6 capabilities (generate, edit, aspect ratio, resolution, reference images, person control)
|
|
161
|
+
- Capability-based provider abstraction (model-independent core + model-dependent providers)
|
|
162
|
+
- JSON output for scripting and tool integration
|
|
163
|
+
- Single-file esbuild bundle
|
|
164
|
+
|
|
165
|
+
### Distribution
|
|
166
|
+
|
|
167
|
+
- Claude Code plugin: `somacoffeekyoto/imgx-cli` marketplace with `image-generation` skill
|
|
168
|
+
- npm package name reserved: `imgx-cli` (publish pending)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SOMA COFFEE KYOTO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# imgx-mcp
|
|
2
|
+
|
|
3
|
+
AI image generation and editing for Claude Code, Codex CLI, and MCP-compatible AI agents. Provider-agnostic design with capability-based abstraction.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### As a Claude Code plugin
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/plugin marketplace add somacoffeekyoto/imgx-mcp
|
|
11
|
+
/plugin install imgx-mcp@somacoffeekyoto-imgx-mcp
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
After installation, restart Claude Code. The `image-generation` skill becomes available — Claude Code can generate and edit images via natural language instructions.
|
|
15
|
+
|
|
16
|
+
### Update
|
|
17
|
+
|
|
18
|
+
#### Claude Code plugin
|
|
19
|
+
|
|
20
|
+
You can try updating via the plugin manager:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/plugin update → select "installed" → imgx-mcp → update
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If the update shows no changes or the plugin doesn't reflect the latest version, uninstall and reinstall:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
/plugin uninstall imgx-mcp@somacoffeekyoto-imgx-mcp
|
|
30
|
+
/plugin install imgx-mcp@somacoffeekyoto-imgx-mcp
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then restart Claude Code.
|
|
34
|
+
|
|
35
|
+
#### Standalone CLI
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm update -g imgx-mcp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### As a standalone CLI
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g imgx-mcp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Requires Node.js 18+.
|
|
48
|
+
|
|
49
|
+
## Setup
|
|
50
|
+
|
|
51
|
+
Set up at least one provider:
|
|
52
|
+
|
|
53
|
+
**Gemini** — get a key from [Google AI Studio](https://aistudio.google.com/apikey) (free tier available):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
imgx config set api-key YOUR_GEMINI_API_KEY --provider gemini
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**OpenAI** — get a key from [OpenAI Platform](https://platform.openai.com/api-keys):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
imgx config set api-key YOUR_OPENAI_API_KEY --provider openai
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Keys are stored in `~/.config/imgx/config.json` (Linux/macOS) or `%APPDATA%\imgx\config.json` (Windows). Alternatively, set environment variables:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
export GEMINI_API_KEY="your-api-key"
|
|
69
|
+
export OPENAI_API_KEY="your-api-key"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Environment variables take precedence over the config file.
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
### Generate an image from text
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
imgx generate -p "A coffee cup on a wooden table, morning light" -o output.png
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Edit an existing image
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
imgx edit -i photo.png -p "Change the background to sunset" -o edited.png
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Iterative editing with `--last`
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
imgx edit -i photo.png -p "Make the background darker"
|
|
92
|
+
# → {"success": true, "filePaths": ["./imgx-a1b2c3d4.png"]}
|
|
93
|
+
|
|
94
|
+
imgx edit --last -p "Add warm lighting"
|
|
95
|
+
# Uses the previous output as input automatically
|
|
96
|
+
|
|
97
|
+
imgx edit --last -p "Crop to 16:9" -o final.png
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Options
|
|
101
|
+
|
|
102
|
+
| Flag | Short | Description |
|
|
103
|
+
|------|-------|-------------|
|
|
104
|
+
| `--prompt` | `-p` | Image description or edit instruction (required) |
|
|
105
|
+
| `--output` | `-o` | Output file path (auto-generated if omitted) |
|
|
106
|
+
| `--input` | `-i` | Input image to edit (`edit` command only) |
|
|
107
|
+
| `--last` | `-l` | Use last output as input (`edit` command only) |
|
|
108
|
+
| `--aspect-ratio` | `-a` | `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `2:3`, `3:2` |
|
|
109
|
+
| `--resolution` | `-r` | `1K`, `2K`, `4K` |
|
|
110
|
+
| `--count` | `-n` | Number of images to generate |
|
|
111
|
+
| `--format` | `-f` | Output format: `png`, `jpeg`, `webp` (OpenAI only) |
|
|
112
|
+
| `--model` | `-m` | Model name |
|
|
113
|
+
| `--provider` | | Provider name (default: `gemini`) |
|
|
114
|
+
| `--output-dir` | `-d` | Output directory |
|
|
115
|
+
|
|
116
|
+
### Configuration
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
imgx config set api-key <key> --provider gemini # Save Gemini API key
|
|
120
|
+
imgx config set api-key <key> --provider openai # Save OpenAI API key
|
|
121
|
+
imgx config set model <name> # Set default model
|
|
122
|
+
imgx config set output-dir <dir> # Set default output directory
|
|
123
|
+
imgx config set aspect-ratio 16:9 # Set default aspect ratio
|
|
124
|
+
imgx config set resolution 2K # Set default resolution
|
|
125
|
+
imgx config list # Show all settings
|
|
126
|
+
imgx config get api-key # Show a specific setting (API key is masked)
|
|
127
|
+
imgx config path # Show config file location
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Project config (`.imgxrc`)
|
|
131
|
+
|
|
132
|
+
Generate a template with `imgx init`:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
imgx init
|
|
136
|
+
# → creates .imgxrc in current directory
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Or create manually. Place a `.imgxrc` file in your project directory to set project-level defaults:
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"defaults": {
|
|
144
|
+
"model": "gemini-2.5-flash-image",
|
|
145
|
+
"outputDir": "./assets/images",
|
|
146
|
+
"aspectRatio": "16:9"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Project config is shared via Git. Do not put API keys in `.imgxrc` — use `imgx config set api-key` or environment variables instead.
|
|
152
|
+
|
|
153
|
+
### Settings resolution
|
|
154
|
+
|
|
155
|
+
Settings are resolved in this order (first match wins):
|
|
156
|
+
|
|
157
|
+
1. CLI flags (`--model`, `--output-dir`, etc.)
|
|
158
|
+
2. Environment variables (`IMGX_MODEL`, `IMGX_OUTPUT_DIR`, etc.)
|
|
159
|
+
3. Project config (`.imgxrc` in current directory)
|
|
160
|
+
4. User config (`~/.config/imgx/config.json` or `%APPDATA%\imgx\config.json`)
|
|
161
|
+
5. Provider defaults
|
|
162
|
+
|
|
163
|
+
### Other commands
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
imgx providers # List available providers and their capabilities
|
|
167
|
+
imgx capabilities # Show detailed capabilities of current provider
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Environment variables
|
|
171
|
+
|
|
172
|
+
Environment variables override config file settings.
|
|
173
|
+
|
|
174
|
+
| Variable | Description |
|
|
175
|
+
|----------|-------------|
|
|
176
|
+
| `GEMINI_API_KEY` | Gemini API key |
|
|
177
|
+
| `OPENAI_API_KEY` | OpenAI API key |
|
|
178
|
+
| `IMGX_PROVIDER` | Default provider |
|
|
179
|
+
| `IMGX_MODEL` | Default model |
|
|
180
|
+
| `IMGX_OUTPUT_DIR` | Default output directory |
|
|
181
|
+
|
|
182
|
+
## Output
|
|
183
|
+
|
|
184
|
+
All commands output JSON:
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{"success": true, "filePaths": ["./output.png"]}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{"success": false, "error": "error message"}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
This makes imgx suitable for scripting, CI pipelines, and integration with other tools.
|
|
195
|
+
|
|
196
|
+
## MCP server
|
|
197
|
+
|
|
198
|
+
imgx includes an MCP (Model Context Protocol) server, making it available to any MCP-compatible AI coding tool.
|
|
199
|
+
|
|
200
|
+
### Exposed tools
|
|
201
|
+
|
|
202
|
+
| Tool | Description |
|
|
203
|
+
|------|-------------|
|
|
204
|
+
| `generate_image` | Generate an image from a text prompt |
|
|
205
|
+
| `edit_image` | Edit an existing image with text instructions |
|
|
206
|
+
| `edit_last` | Edit the last generated/edited image (no input path needed) |
|
|
207
|
+
| `list_providers` | List available providers and capabilities |
|
|
208
|
+
|
|
209
|
+
### Configuration
|
|
210
|
+
|
|
211
|
+
Add to your tool's MCP config. The `env` section is optional if you have already run `imgx config set api-key`.
|
|
212
|
+
|
|
213
|
+
**Claude Code** (`.mcp.json` / `claude mcp add`):
|
|
214
|
+
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"mcpServers": {
|
|
218
|
+
"imgx": {
|
|
219
|
+
"command": "npx",
|
|
220
|
+
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
221
|
+
"env": { "GEMINI_API_KEY": "your-key", "OPENAI_API_KEY": "your-key" }
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
On Windows, replace `"command": "npx"` with `"command": "cmd"` and prepend `"/c"` to the args array.
|
|
228
|
+
|
|
229
|
+
Or install as a [Claude Code plugin](#install) for automatic MCP registration.
|
|
230
|
+
|
|
231
|
+
**Gemini CLI** (`~/.gemini/settings.json`):
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"mcpServers": {
|
|
236
|
+
"imgx": {
|
|
237
|
+
"command": "npx",
|
|
238
|
+
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
239
|
+
"env": { "GEMINI_API_KEY": "your-key", "OPENAI_API_KEY": "your-key" }
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
246
|
+
|
|
247
|
+
macOS / Linux:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"mcpServers": {
|
|
252
|
+
"imgx": {
|
|
253
|
+
"command": "npx",
|
|
254
|
+
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
255
|
+
"env": { "GEMINI_API_KEY": "your-key", "OPENAI_API_KEY": "your-key" }
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Windows:
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"mcpServers": {
|
|
266
|
+
"imgx": {
|
|
267
|
+
"command": "cmd",
|
|
268
|
+
"args": ["/c", "npx", "--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
269
|
+
"env": { "GEMINI_API_KEY": "your-key", "OPENAI_API_KEY": "your-key" }
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Config file location: `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS). After editing, restart Claude Desktop.
|
|
276
|
+
|
|
277
|
+
> **Note:** Claude Desktop runs the MCP server from its own app directory. Images will be saved there by default. To control the output location, add `"IMGX_OUTPUT_DIR": "C:\\Users\\you\\Pictures"` to the `env` section, or run `imgx config set output-dir <path>` beforehand.
|
|
278
|
+
|
|
279
|
+
**Codex CLI** (`.codex/config.toml`):
|
|
280
|
+
|
|
281
|
+
```toml
|
|
282
|
+
[mcp_servers.imgx]
|
|
283
|
+
command = "npx"
|
|
284
|
+
args = ["--package=imgx-mcp", "-y", "imgx-mcp"]
|
|
285
|
+
env = { GEMINI_API_KEY = "your-key", OPENAI_API_KEY = "your-key" }
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
The same `npx` pattern works with Cursor, Windsurf, Continue.dev, Cline, Zed, and other MCP-compatible tools. On Windows, use `cmd /c npx` instead of `npx` directly.
|
|
289
|
+
|
|
290
|
+
Only include the API keys for providers you want to use. At least one is required.
|
|
291
|
+
|
|
292
|
+
## Architecture
|
|
293
|
+
|
|
294
|
+
imgx separates **model-independent** and **model-dependent** concerns:
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
CLI (argument parsing, output formatting) MCP server (tool definitions, stdio transport)
|
|
298
|
+
↓ ↓
|
|
299
|
+
Core (Capability enum, ImageProvider interface, provider registry, file I/O)
|
|
300
|
+
↓
|
|
301
|
+
Provider (model-specific API calls, capability declarations)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
CLI and MCP server are two entry points into the same core. Both call the same provider functions.
|
|
305
|
+
|
|
306
|
+
Each provider declares its supported capabilities. The CLI dynamically enables or disables options based on what the active provider supports. Adding a new provider means implementing the `ImageProvider` interface and registering it — no changes to the CLI layer.
|
|
307
|
+
|
|
308
|
+
### Supported capabilities
|
|
309
|
+
|
|
310
|
+
| Capability | Description |
|
|
311
|
+
|------------|-------------|
|
|
312
|
+
| `TEXT_TO_IMAGE` | Generate images from text prompts |
|
|
313
|
+
| `IMAGE_EDITING` | Edit images with text instructions |
|
|
314
|
+
| `ASPECT_RATIO` | Control output aspect ratio |
|
|
315
|
+
| `RESOLUTION_CONTROL` | Control output resolution |
|
|
316
|
+
| `MULTIPLE_OUTPUTS` | Generate multiple images per request |
|
|
317
|
+
| `REFERENCE_IMAGES` | Use reference images for guidance |
|
|
318
|
+
| `PERSON_CONTROL` | Control person generation in output |
|
|
319
|
+
| `OUTPUT_FORMAT` | Choose output format (PNG, JPEG, WebP) |
|
|
320
|
+
|
|
321
|
+
### Current providers
|
|
322
|
+
|
|
323
|
+
| Provider | Models | Capabilities |
|
|
324
|
+
|----------|--------|-------------|
|
|
325
|
+
| Gemini | `gemini-3-pro-image-preview`, `gemini-2.5-flash-image` | All 7 base capabilities |
|
|
326
|
+
| OpenAI | `gpt-image-1` | Generate, edit, aspect ratio, multi-output, output format |
|
|
327
|
+
|
|
328
|
+
## Development
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
git clone https://github.com/somacoffeekyoto/imgx-mcp.git
|
|
332
|
+
cd imgx-mcp
|
|
333
|
+
npm install
|
|
334
|
+
npm run bundle # TypeScript compile + esbuild bundle
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
The build produces two bundles:
|
|
338
|
+
|
|
339
|
+
- `dist/cli.bundle.js` — CLI entry point
|
|
340
|
+
- `dist/mcp.bundle.js` — MCP server entry point
|
|
341
|
+
|
|
342
|
+
## Uninstall
|
|
343
|
+
|
|
344
|
+
### Claude Code plugin
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
/plugin uninstall imgx-mcp@somacoffeekyoto-imgx-mcp
|
|
348
|
+
/plugin marketplace remove somacoffeekyoto-imgx-mcp
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Standalone CLI
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
npm uninstall -g imgx-mcp
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### MCP server
|
|
358
|
+
|
|
359
|
+
Remove the `imgx` entry from your tool's MCP configuration file.
|
|
360
|
+
|
|
361
|
+
### Clean up configuration (optional)
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
# Linux / macOS
|
|
365
|
+
rm -rf ~/.config/imgx/
|
|
366
|
+
|
|
367
|
+
# Windows (PowerShell)
|
|
368
|
+
Remove-Item -Recurse -Force "$env:APPDATA\imgx"
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## License
|
|
372
|
+
|
|
373
|
+
MIT — [SOMA COFFEE KYOTO](https://github.com/somacoffeekyoto)
|
|
374
|
+
|
|
375
|
+
## Links
|
|
376
|
+
|
|
377
|
+
- [GitHub](https://github.com/somacoffeekyoto/imgx-mcp)
|
|
378
|
+
- [SOMA COFFEE KYOTO](https://somacoffee.net)
|
|
379
|
+
- [X (@somacoffeekyoto)](https://x.com/somacoffeekyoto)
|