@stabgan/openrouter-mcp-multimodal 1.2.1 → 1.3.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/README.md +30 -137
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ Add one of the following configurations to your MCP settings file (e.g., `cline_
|
|
|
68
68
|
],
|
|
69
69
|
"env": {
|
|
70
70
|
"OPENROUTER_API_KEY": "your-api-key-here",
|
|
71
|
-
"
|
|
71
|
+
"DEFAULT_MODEL": "qwen/qwen2.5-vl-32b-instruct:free"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -89,7 +89,7 @@ Add one of the following configurations to your MCP settings file (e.g., `cline_
|
|
|
89
89
|
],
|
|
90
90
|
"env": {
|
|
91
91
|
"OPENROUTER_API_KEY": "your-api-key-here",
|
|
92
|
-
"
|
|
92
|
+
"DEFAULT_MODEL": "qwen/qwen2.5-vl-32b-instruct:free"
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -108,7 +108,7 @@ Add one of the following configurations to your MCP settings file (e.g., `cline_
|
|
|
108
108
|
"--rm",
|
|
109
109
|
"-i",
|
|
110
110
|
"-e", "OPENROUTER_API_KEY=your-api-key-here",
|
|
111
|
-
"-e", "
|
|
111
|
+
"-e", "DEFAULT_MODEL=qwen/qwen2.5-vl-32b-instruct:free",
|
|
112
112
|
"stabgandocker/openrouter-mcp-multimodal:latest"
|
|
113
113
|
]
|
|
114
114
|
}
|
|
@@ -129,23 +129,45 @@ Add one of the following configurations to your MCP settings file (e.g., `cline_
|
|
|
129
129
|
],
|
|
130
130
|
"env": {
|
|
131
131
|
"OPENROUTER_API_KEY": "your-api-key-here",
|
|
132
|
-
"
|
|
132
|
+
"DEFAULT_MODEL": "qwen/qwen2.5-vl-32b-instruct:free"
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
+
## Examples
|
|
140
|
+
|
|
141
|
+
For comprehensive examples of how to use this MCP server, check out the [examples directory](./examples/). We provide:
|
|
142
|
+
|
|
143
|
+
- JavaScript examples for Node.js applications
|
|
144
|
+
- Python examples with interactive chat capabilities
|
|
145
|
+
- Code snippets for integrating with various applications
|
|
146
|
+
|
|
147
|
+
Each example comes with clear documentation and step-by-step instructions.
|
|
148
|
+
|
|
149
|
+
## Dependencies
|
|
150
|
+
|
|
151
|
+
This project uses the following key dependencies:
|
|
152
|
+
|
|
153
|
+
- `@modelcontextprotocol/sdk`: ^1.8.0 - Latest MCP SDK for tool implementation
|
|
154
|
+
- `openai`: ^4.89.1 - OpenAI-compatible API client for OpenRouter
|
|
155
|
+
- `sharp`: ^0.33.5 - Fast image processing library
|
|
156
|
+
- `axios`: ^1.8.4 - HTTP client for API requests
|
|
157
|
+
- `node-fetch`: ^3.3.2 - Modern fetch implementation
|
|
158
|
+
|
|
159
|
+
Node.js 18 or later is required. All dependencies are regularly updated to ensure compatibility and security.
|
|
160
|
+
|
|
139
161
|
## Available Tools
|
|
140
162
|
|
|
141
|
-
###
|
|
163
|
+
### mcp_openrouter_chat_completion
|
|
142
164
|
|
|
143
165
|
Send text or multimodal messages to OpenRouter models:
|
|
144
166
|
|
|
145
167
|
```javascript
|
|
146
168
|
use_mcp_tool({
|
|
147
169
|
server_name: "openrouter",
|
|
148
|
-
tool_name: "
|
|
170
|
+
tool_name: "mcp_openrouter_chat_completion",
|
|
149
171
|
arguments: {
|
|
150
172
|
model: "google/gemini-2.5-pro-exp-03-25:free", // Optional if default is set
|
|
151
173
|
messages: [
|
|
@@ -168,7 +190,7 @@ For multimodal messages with images:
|
|
|
168
190
|
```javascript
|
|
169
191
|
use_mcp_tool({
|
|
170
192
|
server_name: "openrouter",
|
|
171
|
-
tool_name: "
|
|
193
|
+
tool_name: "mcp_openrouter_chat_completion",
|
|
172
194
|
arguments: {
|
|
173
195
|
model: "anthropic/claude-3.5-sonnet",
|
|
174
196
|
messages: [
|
|
@@ -190,133 +212,4 @@ use_mcp_tool({
|
|
|
190
212
|
]
|
|
191
213
|
}
|
|
192
214
|
});
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### multi_image_analysis
|
|
196
|
-
|
|
197
|
-
Analyze multiple images with a single prompt:
|
|
198
|
-
|
|
199
|
-
```javascript
|
|
200
|
-
use_mcp_tool({
|
|
201
|
-
server_name: "openrouter",
|
|
202
|
-
tool_name: "multi_image_analysis",
|
|
203
|
-
arguments: {
|
|
204
|
-
images: [
|
|
205
|
-
{ url: "https://example.com/image1.jpg" },
|
|
206
|
-
{ url: "file:///absolute/path/to/image2.jpg" },
|
|
207
|
-
{
|
|
208
|
-
url: "https://example.com/image3.jpg",
|
|
209
|
-
alt: "Optional description of image 3"
|
|
210
|
-
}
|
|
211
|
-
],
|
|
212
|
-
prompt: "Compare these images and tell me their similarities and differences",
|
|
213
|
-
markdown_response: true, // Optional, defaults to true
|
|
214
|
-
model: "anthropic/claude-3-opus" // Optional if default is set
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### search_models
|
|
220
|
-
|
|
221
|
-
Search and filter available models:
|
|
222
|
-
|
|
223
|
-
```javascript
|
|
224
|
-
use_mcp_tool({
|
|
225
|
-
server_name: "openrouter",
|
|
226
|
-
tool_name: "search_models",
|
|
227
|
-
arguments: {
|
|
228
|
-
query: "claude", // Optional text search
|
|
229
|
-
provider: "anthropic", // Optional provider filter
|
|
230
|
-
capabilities: {
|
|
231
|
-
vision: true // Filter for models with vision capabilities
|
|
232
|
-
},
|
|
233
|
-
limit: 5 // Optional, defaults to 10
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### get_model_info
|
|
239
|
-
|
|
240
|
-
Get detailed information about a specific model:
|
|
241
|
-
|
|
242
|
-
```javascript
|
|
243
|
-
use_mcp_tool({
|
|
244
|
-
server_name: "openrouter",
|
|
245
|
-
tool_name: "get_model_info",
|
|
246
|
-
arguments: {
|
|
247
|
-
model: "anthropic/claude-3.5-sonnet"
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### validate_model
|
|
253
|
-
|
|
254
|
-
Check if a model ID is valid:
|
|
255
|
-
|
|
256
|
-
```javascript
|
|
257
|
-
use_mcp_tool({
|
|
258
|
-
server_name: "openrouter",
|
|
259
|
-
tool_name: "validate_model",
|
|
260
|
-
arguments: {
|
|
261
|
-
model: "google/gemini-2.5-pro-exp-03-25:free"
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
## Error Handling
|
|
267
|
-
|
|
268
|
-
The server provides detailed error messages for various failure cases:
|
|
269
|
-
|
|
270
|
-
- Invalid input parameters
|
|
271
|
-
- Network errors
|
|
272
|
-
- Rate limiting issues
|
|
273
|
-
- Invalid image formats
|
|
274
|
-
- Authentication problems
|
|
275
|
-
|
|
276
|
-
## Troubleshooting
|
|
277
|
-
|
|
278
|
-
### Common Issues
|
|
279
|
-
|
|
280
|
-
- **"fetch is not defined" error**: This often occurs when the Node.js environment doesn't have global fetch. Use Node.js v18+ or add the PATH environment variable to your configuration as shown below:
|
|
281
|
-
|
|
282
|
-
```json
|
|
283
|
-
{
|
|
284
|
-
"mcpServers": {
|
|
285
|
-
"openrouter": {
|
|
286
|
-
"command": "npx",
|
|
287
|
-
"args": [
|
|
288
|
-
"-y",
|
|
289
|
-
"@stabgan/openrouter-mcp-multimodal"
|
|
290
|
-
],
|
|
291
|
-
"env": {
|
|
292
|
-
"OPENROUTER_API_KEY": "your-api-key-here",
|
|
293
|
-
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
- **Image analysis failures**: Make sure your image path is absolute and the file format is supported.
|
|
301
|
-
|
|
302
|
-
## Development
|
|
303
|
-
|
|
304
|
-
To build from source:
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
git clone https://github.com/stabgan/openrouter-mcp-multimodal.git
|
|
308
|
-
cd openrouter-mcp-multimodal
|
|
309
|
-
npm install
|
|
310
|
-
npm run build
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
## License
|
|
314
|
-
|
|
315
|
-
MIT License
|
|
316
|
-
|
|
317
|
-
## Version 1.2.0 Updates
|
|
318
|
-
- Simplified image analysis by consolidating all functionality into the `multi_image_analysis` tool
|
|
319
|
-
- Added automatic selection of free models with the largest context window when no model is specified
|
|
320
|
-
- Improved handling of various image formats (file://, http://, data:)
|
|
321
|
-
- Enhanced error handling and logging for better troubleshooting
|
|
322
|
-
- Removed the `analyze_image` tool to eliminate confusion and streamline the interface
|
|
215
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stabgan/openrouter-mcp-multimodal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "MCP server for OpenRouter providing text chat and image analysis tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"build": "tsc && shx chmod +x dist/*.js",
|
|
17
17
|
"prepare": "npm run build",
|
|
18
18
|
"start": "node dist/index.js",
|
|
19
|
-
"watch": "tsc --watch"
|
|
19
|
+
"watch": "tsc --watch",
|
|
20
|
+
"examples": "node examples/index.js",
|
|
21
|
+
"audit": "npm audit fix"
|
|
20
22
|
},
|
|
21
23
|
"keywords": [
|
|
22
24
|
"mcp",
|
|
@@ -41,18 +43,18 @@
|
|
|
41
43
|
"node": ">=18.0.0"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.8.0",
|
|
45
47
|
"axios": "^1.8.4",
|
|
46
48
|
"dotenv": "^16.4.7",
|
|
47
49
|
"node-fetch": "^3.3.2",
|
|
48
50
|
"openai": "^4.89.1",
|
|
49
|
-
"sharp": "^0.33.
|
|
51
|
+
"sharp": "^0.33.5"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
|
-
"@types/node": "^22.13.
|
|
54
|
+
"@types/node": "^22.13.14",
|
|
53
55
|
"@types/sharp": "^0.32.0",
|
|
54
56
|
"shx": "^0.3.4",
|
|
55
|
-
"typescript": "^5.
|
|
57
|
+
"typescript": "^5.8.2"
|
|
56
58
|
},
|
|
57
59
|
"overrides": {
|
|
58
60
|
"uri-js": "npm:uri-js-replace",
|