nexus-mcp 1.0.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 +495 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +80 -0
- package/dist/cli.js.map +1 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +2 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/openrouter.d.ts +101 -0
- package/dist/clients/openrouter.d.ts.map +1 -0
- package/dist/clients/openrouter.js +359 -0
- package/dist/clients/openrouter.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/logging.d.ts +81 -0
- package/dist/config/logging.d.ts.map +1 -0
- package/dist/config/logging.js +233 -0
- package/dist/config/logging.js.map +1 -0
- package/dist/config/manager.d.ts +97 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +190 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/schema.d.ts +18 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +345 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +61 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +14 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/validation.d.ts +22 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/config/validation.js +167 -0
- package/dist/config/validation.js.map +1 -0
- package/dist/errors/index.d.ts +148 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +225 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +404 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/search.d.ts +70 -0
- package/dist/schemas/search.d.ts.map +1 -0
- package/dist/schemas/search.js +104 -0
- package/dist/schemas/search.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/search.d.ts +101 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +325 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/openrouter.d.ts +82 -0
- package/dist/types/openrouter.d.ts.map +1 -0
- package/dist/types/openrouter.js +6 -0
- package/dist/types/openrouter.js.map +1 -0
- package/dist/types/search.d.ts +80 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/search.js +48 -0
- package/dist/types/search.js.map +1 -0
- package/dist/utils/cache.d.ts +103 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +181 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/deduplication.d.ts +105 -0
- package/dist/utils/deduplication.d.ts.map +1 -0
- package/dist/utils/deduplication.js +232 -0
- package/dist/utils/deduplication.js.map +1 -0
- package/dist/utils/error-messages.d.ts +69 -0
- package/dist/utils/error-messages.d.ts.map +1 -0
- package/dist/utils/error-messages.js +342 -0
- package/dist/utils/error-messages.js.map +1 -0
- package/dist/utils/json-rpc-validator.d.ts +103 -0
- package/dist/utils/json-rpc-validator.d.ts.map +1 -0
- package/dist/utils/json-rpc-validator.js +391 -0
- package/dist/utils/json-rpc-validator.js.map +1 -0
- package/dist/utils/json-validator.d.ts +59 -0
- package/dist/utils/json-validator.d.ts.map +1 -0
- package/dist/utils/json-validator.js +375 -0
- package/dist/utils/json-validator.js.map +1 -0
- package/dist/utils/logger.d.ts +155 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +302 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mcp-error-handler.d.ts +119 -0
- package/dist/utils/mcp-error-handler.d.ts.map +1 -0
- package/dist/utils/mcp-error-handler.js +261 -0
- package/dist/utils/mcp-error-handler.js.map +1 -0
- package/dist/utils/response-optimizer.d.ts +125 -0
- package/dist/utils/response-optimizer.d.ts.map +1 -0
- package/dist/utils/response-optimizer.js +314 -0
- package/dist/utils/response-optimizer.js.map +1 -0
- package/dist/utils/retry.d.ts +148 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +356 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/stdio-handler.d.ts +94 -0
- package/dist/utils/stdio-handler.d.ts.map +1 -0
- package/dist/utils/stdio-handler.js +353 -0
- package/dist/utils/stdio-handler.js.map +1 -0
- package/package.json +106 -0
package/README.md
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD033 MD041 -->
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
# 🔍 Nexus MCP Server
|
|
6
|
+
|
|
7
|
+
**AI integration without the complexity**
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/nexus-mcp)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://www.typescriptlang.org/)
|
|
12
|
+
[](https://modelcontextprotocol.io/)
|
|
13
|
+
|
|
14
|
+
_Intelligent AI model search and discovery with zero-install simplicity_
|
|
15
|
+
|
|
16
|
+
[Quick Start](#-quick-start) • [Features](#-features) • [Documentation](#-documentation) • [Contributing](#-contributing)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🚀 What is Nexus?
|
|
23
|
+
|
|
24
|
+
Nexus is a production-ready **Model Context Protocol (MCP) server** that brings AI-powered web search directly into your development environment. Get intelligent search results with proper citations in **Claude Desktop**, **Cursor**, or any MCP-compatible client - all with a single command.
|
|
25
|
+
|
|
26
|
+
### Why Nexus?
|
|
27
|
+
|
|
28
|
+
- **🎯 Zero Setup**: Ready in 30 seconds with `npx` - no installation, no configuration
|
|
29
|
+
- **🧠 AI-Powered**: Uses Perplexity Sonar models for intelligent, current web search
|
|
30
|
+
- **📚 Source Citations**: Get authoritative sources with every search result
|
|
31
|
+
- **🔧 Developer-First**: Built for developers who want AI capabilities without complexity
|
|
32
|
+
- **⚡ Production-Ready**: Enterprise-grade reliability with comprehensive error handling
|
|
33
|
+
|
|
34
|
+
## ✨ Features
|
|
35
|
+
|
|
36
|
+
<table>
|
|
37
|
+
<tr>
|
|
38
|
+
<td width="50%">
|
|
39
|
+
|
|
40
|
+
### 🚀 **Zero-Install Simplicity**
|
|
41
|
+
|
|
42
|
+
- Ready in 30 seconds with `npx`
|
|
43
|
+
- No dependencies or build steps
|
|
44
|
+
- Cross-platform compatibility
|
|
45
|
+
- Always up-to-date
|
|
46
|
+
|
|
47
|
+
### 🧠 **AI-Powered Intelligence**
|
|
48
|
+
|
|
49
|
+
- Perplexity Sonar model integration
|
|
50
|
+
- Real-time web content search
|
|
51
|
+
- Context-aware result ranking
|
|
52
|
+
- Multiple model options
|
|
53
|
+
|
|
54
|
+
</td>
|
|
55
|
+
<td width="50%">
|
|
56
|
+
|
|
57
|
+
### 📚 **Professional Quality**
|
|
58
|
+
|
|
59
|
+
- Source citations and metadata
|
|
60
|
+
- Comprehensive error handling
|
|
61
|
+
- Production-grade reliability
|
|
62
|
+
- TypeScript implementation
|
|
63
|
+
|
|
64
|
+
### 🔧 **Developer Experience**
|
|
65
|
+
|
|
66
|
+
- MCP protocol compliance
|
|
67
|
+
- Extensive documentation
|
|
68
|
+
- Configurable parameters
|
|
69
|
+
- Community support
|
|
70
|
+
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
|
|
75
|
+
## 🏃♂️ Quick Start
|
|
76
|
+
|
|
77
|
+
**🚀 Zero-install setup - Ready in 30 seconds!**
|
|
78
|
+
|
|
79
|
+
### Prerequisites
|
|
80
|
+
|
|
81
|
+
- Node.js 16 or higher
|
|
82
|
+
- An OpenRouter API key (get one at [OpenRouter](https://openrouter.ai))
|
|
83
|
+
|
|
84
|
+
### Zero-Config Installation
|
|
85
|
+
|
|
86
|
+
No build steps, no dependencies, no setup required:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Set your OpenRouter API key
|
|
90
|
+
export OPENROUTER_API_KEY=your-api-key-here
|
|
91
|
+
|
|
92
|
+
# Run the server instantly
|
|
93
|
+
npx nexus-mcp --stdio
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
That's it! The server is now running and ready for MCP client connections.
|
|
97
|
+
|
|
98
|
+
### Testing the NPX Installation
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Test the CLI help
|
|
102
|
+
npx nexus-mcp --help
|
|
103
|
+
|
|
104
|
+
# Test the version
|
|
105
|
+
npx nexus-mcp --version
|
|
106
|
+
|
|
107
|
+
# Run with your API key
|
|
108
|
+
OPENROUTER_API_KEY=your-key npx nexus-mcp --stdio
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Alternative: Local Development Installation
|
|
112
|
+
|
|
113
|
+
For local development or customization:
|
|
114
|
+
|
|
115
|
+
1. Clone the repository:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git clone https://github.com/your-username/nexus-mcp.git
|
|
119
|
+
cd nexus-mcp
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
2. Install dependencies:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm install
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
3. Build the server:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npm run build
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
4. Configure your OpenRouter API key:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Copy the example environment file
|
|
138
|
+
cp .env.example .env
|
|
139
|
+
|
|
140
|
+
# Edit .env and add your actual API key
|
|
141
|
+
# OPENROUTER_API_KEY=your-api-key-here
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
5. Test the server:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm start
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Integration with MCP Clients
|
|
151
|
+
|
|
152
|
+
### 🚀 Quick Setup with NPX (Recommended)
|
|
153
|
+
|
|
154
|
+
The easiest way to integrate with any MCP client is using NPX:
|
|
155
|
+
|
|
156
|
+
### Claude Code
|
|
157
|
+
|
|
158
|
+
Add this server to your Claude Code MCP settings:
|
|
159
|
+
|
|
160
|
+
1. Open your MCP settings file (usually `~/.claude/mcp_settings.json`)
|
|
161
|
+
|
|
162
|
+
2. Add the server configuration using NPX:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"nexus": {
|
|
168
|
+
"command": "npx",
|
|
169
|
+
"args": ["nexus-mcp", "--stdio"],
|
|
170
|
+
"env": {
|
|
171
|
+
"OPENROUTER_API_KEY": "your-api-key-here"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
3. Restart Claude Code
|
|
179
|
+
|
|
180
|
+
**That's it!** No installation, no build steps, no path configuration required.
|
|
181
|
+
|
|
182
|
+
### Cursor
|
|
183
|
+
|
|
184
|
+
Configure the server in Cursor's MCP settings:
|
|
185
|
+
|
|
186
|
+
1. Open Cursor settings and navigate to MCP servers
|
|
187
|
+
|
|
188
|
+
2. Add a new server with:
|
|
189
|
+
|
|
190
|
+
- **Name**: `nexus`
|
|
191
|
+
- **Command**: `npx`
|
|
192
|
+
- **Args**: `["nexus-mcp", "--stdio"]`
|
|
193
|
+
- **Environment Variables**:
|
|
194
|
+
- `OPENROUTER_API_KEY`: `your-api-key-here`
|
|
195
|
+
|
|
196
|
+
3. Restart Cursor
|
|
197
|
+
|
|
198
|
+
### Other MCP Clients
|
|
199
|
+
|
|
200
|
+
For any MCP-compatible client, use these connection details:
|
|
201
|
+
|
|
202
|
+
- **Transport**: stdio
|
|
203
|
+
- **Command**: `npx`
|
|
204
|
+
- **Args**: `["nexus-mcp", "--stdio"]`
|
|
205
|
+
- **Environment Variables**: `OPENROUTER_API_KEY=your-api-key-here`
|
|
206
|
+
|
|
207
|
+
### Alternative: Local Installation
|
|
208
|
+
|
|
209
|
+
If you prefer using a local installation (after following the local development setup):
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"mcpServers": {
|
|
214
|
+
"nexus": {
|
|
215
|
+
"command": "node",
|
|
216
|
+
"args": ["/path/to/nexus-mcp/dist/cli.js", "--stdio"],
|
|
217
|
+
"env": {
|
|
218
|
+
"OPENROUTER_API_KEY": "your-api-key-here"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Usage
|
|
226
|
+
|
|
227
|
+
Once integrated, you can use the search tool in your MCP client:
|
|
228
|
+
|
|
229
|
+
### Basic Search
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
Use the search tool to find information about "latest developments in AI"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Advanced Search with Parameters
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
Search for "climate change solutions" using:
|
|
239
|
+
- Model: perplexity/sonar
|
|
240
|
+
- Max tokens: 2000
|
|
241
|
+
- Temperature: 0.3
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Available Tools
|
|
245
|
+
|
|
246
|
+
### `search`
|
|
247
|
+
|
|
248
|
+
The main search tool that provides AI-powered web search capabilities.
|
|
249
|
+
|
|
250
|
+
**Parameters:**
|
|
251
|
+
|
|
252
|
+
- `query` (required): Search query (1-2000 characters)
|
|
253
|
+
- `model` (optional): Perplexity model to use (default: "perplexity/sonar")
|
|
254
|
+
- `maxTokens` (optional): Maximum response tokens (1-4000, default: 1000)
|
|
255
|
+
- `temperature` (optional): Response randomness (0-2, default: 0.7)
|
|
256
|
+
|
|
257
|
+
**Example Response:**
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
Based on current information, here are the latest developments in AI...
|
|
261
|
+
|
|
262
|
+
[Detailed AI-generated response with current information]
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
**Search Metadata:**
|
|
266
|
+
- Model: perplexity/sonar
|
|
267
|
+
- Response time: 1250ms
|
|
268
|
+
- Tokens used: 850
|
|
269
|
+
- Sources: 5 found
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Configuration
|
|
273
|
+
|
|
274
|
+
### Environment Variables
|
|
275
|
+
|
|
276
|
+
- `OPENROUTER_API_KEY` (required): Your OpenRouter API key
|
|
277
|
+
- `NODE_ENV` (optional): Environment setting (development, production, test)
|
|
278
|
+
- `LOG_LEVEL` (optional): Logging level (debug, info, warn, error)
|
|
279
|
+
|
|
280
|
+
### Advanced Configuration
|
|
281
|
+
|
|
282
|
+
The server supports additional configuration through environment variables:
|
|
283
|
+
|
|
284
|
+
- `OPENROUTER_TIMEOUT_MS`: Request timeout in milliseconds (default: 30000)
|
|
285
|
+
- `OPENROUTER_MAX_RETRIES`: Maximum retry attempts (default: 3)
|
|
286
|
+
- `OPENROUTER_BASE_URL`: Custom OpenRouter API base URL
|
|
287
|
+
|
|
288
|
+
## Resources
|
|
289
|
+
|
|
290
|
+
The server provides a configuration status resource at `config://status` that shows:
|
|
291
|
+
|
|
292
|
+
- Server health status
|
|
293
|
+
- Configuration information (with masked API key)
|
|
294
|
+
- Search tool availability
|
|
295
|
+
- Server uptime and version
|
|
296
|
+
|
|
297
|
+
## Troubleshooting
|
|
298
|
+
|
|
299
|
+
### NPX-Specific Issues
|
|
300
|
+
|
|
301
|
+
**"npx: command not found"**
|
|
302
|
+
|
|
303
|
+
- Ensure Node.js 16+ is installed: `node --version`
|
|
304
|
+
- Update npm: `npm install -g npm@latest`
|
|
305
|
+
|
|
306
|
+
**"Cannot find package 'nexus-mcp'"**
|
|
307
|
+
|
|
308
|
+
- The package may not be published yet. Use local installation instead
|
|
309
|
+
- Verify network connectivity for npm registry access
|
|
310
|
+
|
|
311
|
+
**NPX takes a long time to start**
|
|
312
|
+
|
|
313
|
+
- This is normal on first run as NPX downloads the package
|
|
314
|
+
- Subsequent runs will be faster due to caching
|
|
315
|
+
- For faster startup, use local installation instead
|
|
316
|
+
|
|
317
|
+
**"Permission denied" errors with NPX**
|
|
318
|
+
|
|
319
|
+
- Try: `npx --yes nexus-mcp --stdio`
|
|
320
|
+
- Or set npm permissions: `npm config set user 0 && npm config set unsafe-perm true`
|
|
321
|
+
|
|
322
|
+
### Common Issues
|
|
323
|
+
|
|
324
|
+
**"Search functionality is not available"**
|
|
325
|
+
|
|
326
|
+
- Ensure `OPENROUTER_API_KEY` environment variable is set
|
|
327
|
+
- Verify your API key is valid at [OpenRouter](https://openrouter.ai)
|
|
328
|
+
- Check the server logs for initialization errors
|
|
329
|
+
|
|
330
|
+
**"Authentication failed: Invalid API key"**
|
|
331
|
+
|
|
332
|
+
- Double-check your API key format and validity
|
|
333
|
+
- Ensure the key has sufficient credits/permissions
|
|
334
|
+
- Test the key directly at OpenRouter dashboard
|
|
335
|
+
|
|
336
|
+
**"Rate limit exceeded"**
|
|
337
|
+
|
|
338
|
+
- Wait for the rate limit to reset (usually 1 minute)
|
|
339
|
+
- Consider upgrading your OpenRouter plan for higher limits
|
|
340
|
+
- Monitor usage in your OpenRouter dashboard
|
|
341
|
+
|
|
342
|
+
**Connection timeouts**
|
|
343
|
+
|
|
344
|
+
- Check your internet connection
|
|
345
|
+
- The server will automatically retry failed requests
|
|
346
|
+
- Increase timeout if needed: `OPENROUTER_TIMEOUT_MS=60000`
|
|
347
|
+
|
|
348
|
+
**MCP client can't connect to server**
|
|
349
|
+
|
|
350
|
+
- Verify the `--stdio` flag is included in your MCP configuration
|
|
351
|
+
- Check that Node.js 16+ is available in your MCP client's environment
|
|
352
|
+
- Ensure the API key is properly set in the environment variables
|
|
353
|
+
|
|
354
|
+
### Debug Logging
|
|
355
|
+
|
|
356
|
+
Enable debug logging by:
|
|
357
|
+
|
|
358
|
+
**For local development:** Add `LOG_LEVEL=debug` to your `.env` file
|
|
359
|
+
|
|
360
|
+
**For MCP clients:** Add `LOG_LEVEL: "debug"` to the `env` section of your MCP configuration
|
|
361
|
+
|
|
362
|
+
This will provide detailed information about:
|
|
363
|
+
|
|
364
|
+
- Configuration loading
|
|
365
|
+
- API requests and responses
|
|
366
|
+
- Error details and stack traces
|
|
367
|
+
- Performance metrics
|
|
368
|
+
|
|
369
|
+
### Testing Connection
|
|
370
|
+
|
|
371
|
+
You can test if the server is working by checking the configuration status resource in your MCP client, or by running a simple search query.
|
|
372
|
+
|
|
373
|
+
## Development
|
|
374
|
+
|
|
375
|
+
For developers working on this server:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
# Development with hot reload
|
|
379
|
+
npm run dev
|
|
380
|
+
|
|
381
|
+
# Run tests
|
|
382
|
+
npm test
|
|
383
|
+
|
|
384
|
+
# Run tests with coverage
|
|
385
|
+
npm run test:coverage
|
|
386
|
+
|
|
387
|
+
# Lint code
|
|
388
|
+
npm run lint
|
|
389
|
+
|
|
390
|
+
# Format code
|
|
391
|
+
npm run format
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## 💰 API Credits and Costs
|
|
395
|
+
|
|
396
|
+
This server uses OpenRouter's API, which charges based on token usage:
|
|
397
|
+
|
|
398
|
+
- **Perplexity Sonar models**: Check current pricing at [OpenRouter Models](https://openrouter.ai/models)
|
|
399
|
+
- **Usage monitoring**: Track consumption through the OpenRouter dashboard
|
|
400
|
+
- **Cost control**: Set usage limits in your OpenRouter account
|
|
401
|
+
- **Optimization**: Nexus includes built-in rate limiting and intelligent caching
|
|
402
|
+
|
|
403
|
+
## 📚 Documentation
|
|
404
|
+
|
|
405
|
+
<div align="center">
|
|
406
|
+
|
|
407
|
+
| 📖 **Guide** | 🔗 **Link** | 📝 **Description** |
|
|
408
|
+
| ------------------- | ------------------------------------------- | -------------------------------- |
|
|
409
|
+
| **Quick Start** | [Getting Started](#-quick-start) | Zero-install setup in 30 seconds |
|
|
410
|
+
| **API Reference** | [MCP Tools](CLAUDE.md#development-commands) | Complete command reference |
|
|
411
|
+
| **Configuration** | [Environment Setup](#configuration) | Advanced configuration options |
|
|
412
|
+
| **Contributing** | [Contributing Guide](CONTRIBUTING.md) | Join our open source community |
|
|
413
|
+
| **Troubleshooting** | [Common Issues](#troubleshooting) | Solutions to common problems |
|
|
414
|
+
|
|
415
|
+
</div>
|
|
416
|
+
|
|
417
|
+
## 🤝 Contributing
|
|
418
|
+
|
|
419
|
+
We welcome contributions from developers of all experience levels!
|
|
420
|
+
|
|
421
|
+
<table>
|
|
422
|
+
<tr>
|
|
423
|
+
<td width="33%">
|
|
424
|
+
|
|
425
|
+
### 🚀 **Get Started**
|
|
426
|
+
|
|
427
|
+
- Fork the repository
|
|
428
|
+
- Read our [Contributing Guide](CONTRIBUTING.md)
|
|
429
|
+
- Check out [good first issues](https://github.com/search?q=repo%3Anexus-mcp+label%3A%22good+first+issue%22&type=issues)
|
|
430
|
+
|
|
431
|
+
</td>
|
|
432
|
+
<td width="33%">
|
|
433
|
+
|
|
434
|
+
### 🐛 **Report Issues**
|
|
435
|
+
|
|
436
|
+
- [Bug Reports](https://github.com/nexus-mcp/issues/new?template=bug_report.yml)
|
|
437
|
+
- [Feature Requests](https://github.com/nexus-mcp/issues/new?template=feature_request.yml)
|
|
438
|
+
- [Ask Questions](https://github.com/nexus-mcp/issues/new?template=question.yml)
|
|
439
|
+
|
|
440
|
+
</td>
|
|
441
|
+
<td width="33%">
|
|
442
|
+
|
|
443
|
+
### 💬 **Join Community**
|
|
444
|
+
|
|
445
|
+
- [GitHub Discussions](https://github.com/nexus-mcp/discussions)
|
|
446
|
+
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
447
|
+
- [Roadmap & Project Board](https://github.com/nexus-mcp/projects)
|
|
448
|
+
|
|
449
|
+
</td>
|
|
450
|
+
</tr>
|
|
451
|
+
</table>
|
|
452
|
+
|
|
453
|
+
### 🌟 Recognition
|
|
454
|
+
|
|
455
|
+
Contributors are recognized in our:
|
|
456
|
+
|
|
457
|
+
- [Contributors list](https://github.com/nexus-mcp/graphs/contributors)
|
|
458
|
+
- Release notes for significant contributions
|
|
459
|
+
- Community spotlights and testimonials
|
|
460
|
+
|
|
461
|
+
## 🔗 Related Projects
|
|
462
|
+
|
|
463
|
+
- [Model Context Protocol](https://modelcontextprotocol.io) - The standard we implement
|
|
464
|
+
- [OpenRouter](https://openrouter.ai) - Our AI model provider
|
|
465
|
+
- [Claude Desktop](https://claude.ai) - Primary MCP client
|
|
466
|
+
- [Cursor](https://cursor.sh) - AI-powered code editor with MCP support
|
|
467
|
+
|
|
468
|
+
## 📞 Support & Community
|
|
469
|
+
|
|
470
|
+
<div align="center">
|
|
471
|
+
|
|
472
|
+
| 💬 **Need Help?** | 🔗 **Resource** |
|
|
473
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
474
|
+
| **Quick Questions** | [GitHub Discussions](https://github.com/nexus-mcp/discussions) |
|
|
475
|
+
| **Bug Reports** | [GitHub Issues](https://github.com/nexus-mcp/issues) |
|
|
476
|
+
| **Documentation** | [OpenRouter Docs](https://openrouter.ai/docs) • [MCP Specification](https://modelcontextprotocol.io) |
|
|
477
|
+
| **Feature Requests** | [Enhancement Proposals](https://github.com/nexus-mcp/issues/new?template=feature_request.yml) |
|
|
478
|
+
|
|
479
|
+
</div>
|
|
480
|
+
|
|
481
|
+
## 📄 License
|
|
482
|
+
|
|
483
|
+
**MIT License** - see [LICENSE](LICENSE) file for details.
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
<div align="center">
|
|
488
|
+
|
|
489
|
+
**Made with ❤️ by the open source community**
|
|
490
|
+
|
|
491
|
+
[⭐ Star us on GitHub](https://github.com/nexus-mcp) • [📦 View on NPM](https://www.npmjs.com/package/nexus-mcp) • [📚 Read the Docs](CLAUDE.md)
|
|
492
|
+
|
|
493
|
+
_Nexus: AI integration without the complexity_
|
|
494
|
+
|
|
495
|
+
</div>
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { createServer } from './index.js';
|
|
4
|
+
function printUsage() {
|
|
5
|
+
console.log(`
|
|
6
|
+
Usage: nexus [options]
|
|
7
|
+
|
|
8
|
+
Nexus MCP Server - Intelligent AI model search and discovery
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
--stdio Use STDIO transport (required for MCP clients)
|
|
12
|
+
--help Show this help message
|
|
13
|
+
--version Show version information
|
|
14
|
+
|
|
15
|
+
Environment Variables:
|
|
16
|
+
OPENROUTER_API_KEY OpenRouter API key (required)
|
|
17
|
+
NODE_ENV Environment (development, production, test)
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
npx nexus-mcp --stdio
|
|
21
|
+
nexus --stdio
|
|
22
|
+
`);
|
|
23
|
+
}
|
|
24
|
+
function printVersion() {
|
|
25
|
+
console.log(`nexus-mcp v1.0.0`);
|
|
26
|
+
}
|
|
27
|
+
async function main() {
|
|
28
|
+
try {
|
|
29
|
+
const { values } = parseArgs({
|
|
30
|
+
args: process.argv.slice(2),
|
|
31
|
+
options: {
|
|
32
|
+
stdio: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
help: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
default: false,
|
|
39
|
+
},
|
|
40
|
+
version: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
allowPositionals: true,
|
|
46
|
+
});
|
|
47
|
+
if (values.help) {
|
|
48
|
+
printUsage();
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
if (values.version) {
|
|
52
|
+
printVersion();
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
if (!values.stdio) {
|
|
56
|
+
console.error('Error: --stdio flag is required for MCP server operation');
|
|
57
|
+
printUsage();
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
// Check for required environment variables
|
|
61
|
+
if (!process.env.OPENROUTER_API_KEY) {
|
|
62
|
+
console.error('Error: OPENROUTER_API_KEY environment variable is required');
|
|
63
|
+
console.error('Please set your OpenRouter API key:');
|
|
64
|
+
console.error(' export OPENROUTER_API_KEY=your_api_key_here');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
// Set default environment if not specified
|
|
68
|
+
if (!process.env.NODE_ENV) {
|
|
69
|
+
process.env.NODE_ENV = 'production';
|
|
70
|
+
}
|
|
71
|
+
// Start the MCP server
|
|
72
|
+
await createServer();
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Failed to start Nexus MCP server:', error);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
main();
|
|
80
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;CAiBb,CAAC,CAAC;AACH,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAClC,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;YAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAC3B,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;iBACf;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;iBACf;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;iBACf;aACF;YACD,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,UAAU,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,YAAY,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YAC1E,UAAU,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,2CAA2C;QAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;YACpC,OAAO,CAAC,KAAK,CACX,4DAA4D,CAC7D,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACrD,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,2CAA2C;QAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;QACtC,CAAC;QAED,uBAAuB;QACvB,MAAM,YAAY,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ChatCompletionRequest, ChatCompletionResponse, ChatCompletionChunk } from '../types/openrouter.js';
|
|
2
|
+
export interface OpenRouterClientConfig {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
userAgent?: string;
|
|
7
|
+
maxRetries?: number;
|
|
8
|
+
retryDelay?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RetryConfig {
|
|
11
|
+
maxRetries: number;
|
|
12
|
+
retryDelay: number;
|
|
13
|
+
retryableStatusCodes: number[];
|
|
14
|
+
}
|
|
15
|
+
export declare class OpenRouterClient {
|
|
16
|
+
private readonly apiKey;
|
|
17
|
+
private readonly baseUrl;
|
|
18
|
+
private readonly timeout;
|
|
19
|
+
private readonly defaultHeaders;
|
|
20
|
+
private readonly retryConfig;
|
|
21
|
+
constructor(config: OpenRouterClientConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Validate API key format
|
|
24
|
+
*/
|
|
25
|
+
private validateApiKey;
|
|
26
|
+
/**
|
|
27
|
+
* Sleep for a given amount of time
|
|
28
|
+
*/
|
|
29
|
+
private sleep;
|
|
30
|
+
/**
|
|
31
|
+
* Calculate exponential backoff delay
|
|
32
|
+
*/
|
|
33
|
+
private calculateBackoffDelay;
|
|
34
|
+
/**
|
|
35
|
+
* Check if an error is retryable
|
|
36
|
+
*/
|
|
37
|
+
private isRetryableError;
|
|
38
|
+
/**
|
|
39
|
+
* Make authenticated HTTP request to OpenRouter API with retry logic
|
|
40
|
+
*/
|
|
41
|
+
makeRequest<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Set custom headers for requests
|
|
44
|
+
*/
|
|
45
|
+
setHeaders(headers: Record<string, string>): void;
|
|
46
|
+
/**
|
|
47
|
+
* Get current headers
|
|
48
|
+
*/
|
|
49
|
+
getHeaders(): Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Test API connection and authentication
|
|
52
|
+
*/
|
|
53
|
+
testConnection(): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Create a chat completion using the OpenRouter API
|
|
56
|
+
*/
|
|
57
|
+
chatCompletions(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* Create a streaming chat completion using the OpenRouter API
|
|
60
|
+
* Returns an async generator that yields chat completion chunks
|
|
61
|
+
*/
|
|
62
|
+
chatCompletionsStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Base error class for OpenRouter API errors
|
|
66
|
+
*/
|
|
67
|
+
export declare class OpenRouterApiError extends Error {
|
|
68
|
+
readonly statusCode: number;
|
|
69
|
+
readonly type: string;
|
|
70
|
+
readonly code: number;
|
|
71
|
+
constructor(message: string, statusCode: number, type: string, code: number);
|
|
72
|
+
isRateLimitError(): boolean;
|
|
73
|
+
isAuthenticationError(): boolean;
|
|
74
|
+
isServerError(): boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Authentication error class
|
|
78
|
+
*/
|
|
79
|
+
export declare class AuthenticationError extends OpenRouterApiError {
|
|
80
|
+
constructor(message: string, statusCode?: number, code?: number);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Rate limit error class
|
|
84
|
+
*/
|
|
85
|
+
export declare class RateLimitError extends OpenRouterApiError {
|
|
86
|
+
readonly retryAfter?: number | undefined;
|
|
87
|
+
constructor(message: string, retryAfter?: number | undefined, statusCode?: number, code?: number);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Server error class for 5xx status codes
|
|
91
|
+
*/
|
|
92
|
+
export declare class ServerError extends OpenRouterApiError {
|
|
93
|
+
constructor(message: string, statusCode: number, code: number);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Generic API error class for 4xx client errors
|
|
97
|
+
*/
|
|
98
|
+
export declare class ClientError extends OpenRouterApiError {
|
|
99
|
+
constructor(message: string, statusCode: number, type: string, code: number);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=openrouter.d.ts.map
|