@nekzus/mcp-server 1.1.3 ā 1.1.4
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 +218 -92
- package/dist/index.js +33 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,12 +16,16 @@ official MCP SDK and offers an extensible architecture for adding new tools_
|
|
|
16
16
|
|
|
17
17
|
## š Features
|
|
18
18
|
|
|
19
|
-
- š MCP Protocol Implementation
|
|
20
|
-
- š ļø Integrated Utility Tools
|
|
21
|
-
- š Schema Validation
|
|
19
|
+
- š MCP Protocol Implementation with JSON-RPC 2.0
|
|
20
|
+
- š ļø Seven Integrated Utility Tools
|
|
21
|
+
- š Input Schema Validation
|
|
22
22
|
- š ESM Support
|
|
23
23
|
- š Strict TypeScript Types
|
|
24
|
-
- š§© Extensible Architecture
|
|
24
|
+
- š§© Extensible Tool Architecture
|
|
25
|
+
- š Detailed Error Handling
|
|
26
|
+
- šØ Emoji-Enhanced Output
|
|
27
|
+
- š Secure Expression Evaluation
|
|
28
|
+
- š¦ NPM Package Support
|
|
25
29
|
|
|
26
30
|
## š ļø Available Tools
|
|
27
31
|
|
|
@@ -31,14 +35,33 @@ Generates a personalized greeting message.
|
|
|
31
35
|
|
|
32
36
|
**Parameters:**
|
|
33
37
|
|
|
34
|
-
- `name` (string): Recipient's name
|
|
38
|
+
- `name` (string, required): Recipient's name
|
|
35
39
|
|
|
36
40
|
**Example:**
|
|
37
41
|
|
|
38
42
|
```typescript
|
|
39
|
-
//
|
|
43
|
+
// Input
|
|
40
44
|
{
|
|
41
|
-
|
|
45
|
+
"jsonrpc": "2.0",
|
|
46
|
+
"method": "tools/call",
|
|
47
|
+
"params": {
|
|
48
|
+
"name": "greeting",
|
|
49
|
+
"arguments": {
|
|
50
|
+
"name": "John"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Output
|
|
56
|
+
{
|
|
57
|
+
"jsonrpc": "2.0",
|
|
58
|
+
"result": {
|
|
59
|
+
"content": [{
|
|
60
|
+
"type": "text",
|
|
61
|
+
"text": "š Hello John! Welcome to the MCP server!"
|
|
62
|
+
}],
|
|
63
|
+
"isError": false
|
|
64
|
+
}
|
|
42
65
|
}
|
|
43
66
|
```
|
|
44
67
|
|
|
@@ -53,8 +76,27 @@ Gets a random card from a standard poker deck.
|
|
|
53
76
|
**Example:**
|
|
54
77
|
|
|
55
78
|
```typescript
|
|
56
|
-
//
|
|
57
|
-
{
|
|
79
|
+
// Input
|
|
80
|
+
{
|
|
81
|
+
"jsonrpc": "2.0",
|
|
82
|
+
"method": "tools/call",
|
|
83
|
+
"params": {
|
|
84
|
+
"name": "card",
|
|
85
|
+
"arguments": {}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Output
|
|
90
|
+
{
|
|
91
|
+
"jsonrpc": "2.0",
|
|
92
|
+
"result": {
|
|
93
|
+
"content": [{
|
|
94
|
+
"type": "text",
|
|
95
|
+
"text": "š“ You drew: Ace of ā Spades"
|
|
96
|
+
}],
|
|
97
|
+
"isError": false
|
|
98
|
+
}
|
|
99
|
+
}
|
|
58
100
|
```
|
|
59
101
|
|
|
60
102
|
### 3. datetime
|
|
@@ -69,13 +111,29 @@ Gets the current date and time for a specific timezone.
|
|
|
69
111
|
**Example:**
|
|
70
112
|
|
|
71
113
|
```typescript
|
|
72
|
-
//
|
|
73
|
-
// šļø Date: March 20, 2024
|
|
74
|
-
// ā° Time: 7:25:25 PM
|
|
75
|
-
// š Timezone: America/New_York
|
|
114
|
+
// Input
|
|
76
115
|
{
|
|
77
|
-
|
|
78
|
-
|
|
116
|
+
"jsonrpc": "2.0",
|
|
117
|
+
"method": "tools/call",
|
|
118
|
+
"params": {
|
|
119
|
+
"name": "datetime",
|
|
120
|
+
"arguments": {
|
|
121
|
+
"timeZone": "America/New_York",
|
|
122
|
+
"locale": "en-US"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Output
|
|
128
|
+
{
|
|
129
|
+
"jsonrpc": "2.0",
|
|
130
|
+
"result": {
|
|
131
|
+
"content": [{
|
|
132
|
+
"type": "text",
|
|
133
|
+
"text": "šļø Date: March 24, 2024\nā° Time: 3:25:25 PM\nš Timezone: America/New_York"
|
|
134
|
+
}],
|
|
135
|
+
"isError": false
|
|
136
|
+
}
|
|
79
137
|
}
|
|
80
138
|
```
|
|
81
139
|
|
|
@@ -85,15 +143,35 @@ Performs mathematical calculations with support for basic and advanced operation
|
|
|
85
143
|
|
|
86
144
|
**Parameters:**
|
|
87
145
|
|
|
88
|
-
- `expression` (string): Mathematical expression (e.g., "2 + 2 * 3")
|
|
146
|
+
- `expression` (string, required): Mathematical expression (e.g., "2 + 2 * 3")
|
|
89
147
|
- `precision` (number, optional): Decimal places in the result (default: 2)
|
|
90
148
|
|
|
91
149
|
**Example:**
|
|
92
150
|
|
|
93
151
|
```typescript
|
|
94
|
-
//
|
|
152
|
+
// Input
|
|
153
|
+
{
|
|
154
|
+
"jsonrpc": "2.0",
|
|
155
|
+
"method": "tools/call",
|
|
156
|
+
"params": {
|
|
157
|
+
"name": "calculator",
|
|
158
|
+
"arguments": {
|
|
159
|
+
"expression": "2 + 2 * 3",
|
|
160
|
+
"precision": 2
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Output
|
|
95
166
|
{
|
|
96
|
-
|
|
167
|
+
"jsonrpc": "2.0",
|
|
168
|
+
"result": {
|
|
169
|
+
"content": [{
|
|
170
|
+
"type": "text",
|
|
171
|
+
"text": "š§® Expression: 2 + 2 * 3\nš Result: 8.00"
|
|
172
|
+
}],
|
|
173
|
+
"isError": false
|
|
174
|
+
}
|
|
97
175
|
}
|
|
98
176
|
```
|
|
99
177
|
|
|
@@ -111,12 +189,31 @@ Generates secure passwords with customizable options.
|
|
|
111
189
|
**Example:**
|
|
112
190
|
|
|
113
191
|
```typescript
|
|
114
|
-
//
|
|
192
|
+
// Input
|
|
193
|
+
{
|
|
194
|
+
"jsonrpc": "2.0",
|
|
195
|
+
"method": "tools/call",
|
|
196
|
+
"params": {
|
|
197
|
+
"name": "passwordGen",
|
|
198
|
+
"arguments": {
|
|
199
|
+
"length": 12,
|
|
200
|
+
"includeNumbers": true,
|
|
201
|
+
"includeSymbols": true,
|
|
202
|
+
"includeUppercase": true
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Output
|
|
115
208
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
209
|
+
"jsonrpc": "2.0",
|
|
210
|
+
"result": {
|
|
211
|
+
"content": [{
|
|
212
|
+
"type": "text",
|
|
213
|
+
"text": "š Generated Password:\nKj2$mP9&vN4x\n\nš Password Properties:\n⢠Length: 12\n⢠Includes Numbers: ā
\n⢠Includes Symbols: ā
\n⢠Includes Uppercase: ā
"
|
|
214
|
+
}],
|
|
215
|
+
"isError": false
|
|
216
|
+
}
|
|
120
217
|
}
|
|
121
218
|
```
|
|
122
219
|
|
|
@@ -126,7 +223,7 @@ Generates QR codes for text or URLs.
|
|
|
126
223
|
|
|
127
224
|
**Parameters:**
|
|
128
225
|
|
|
129
|
-
- `text` (string): Text or URL to encode
|
|
226
|
+
- `text` (string, required): Text or URL to encode
|
|
130
227
|
- `size` (number, optional): Size in pixels (default: 200)
|
|
131
228
|
- `dark` (string, optional): Dark module color (default: "#000000")
|
|
132
229
|
- `light` (string, optional): Light module color (default: "#ffffff")
|
|
@@ -134,22 +231,44 @@ Generates QR codes for text or URLs.
|
|
|
134
231
|
**Example:**
|
|
135
232
|
|
|
136
233
|
```typescript
|
|
137
|
-
//
|
|
234
|
+
// Input
|
|
138
235
|
{
|
|
139
|
-
|
|
236
|
+
"jsonrpc": "2.0",
|
|
237
|
+
"method": "tools/call",
|
|
238
|
+
"params": {
|
|
239
|
+
"name": "qrGen",
|
|
240
|
+
"arguments": {
|
|
241
|
+
"text": "https://www.nekzus.dev",
|
|
242
|
+
"size": 300,
|
|
243
|
+
"dark": "#000000",
|
|
244
|
+
"light": "#ffffff"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Output
|
|
250
|
+
{
|
|
251
|
+
"jsonrpc": "2.0",
|
|
252
|
+
"result": {
|
|
253
|
+
"content": [{
|
|
254
|
+
"type": "text",
|
|
255
|
+
"text": "š± QR Code Properties:\n⢠Content: https://www.nekzus.dev\n⢠Size: 300px\n⢠Dark Color: #000000\n⢠Light Color: #ffffff\n\nš QR Code generation successful! (Implementation pending)"
|
|
256
|
+
}],
|
|
257
|
+
"isError": false
|
|
258
|
+
}
|
|
140
259
|
}
|
|
141
260
|
```
|
|
142
261
|
|
|
143
262
|
### 7. kitchenConvert
|
|
144
263
|
|
|
145
|
-
Converts between common kitchen measurements and weights
|
|
264
|
+
Converts between common kitchen measurements and weights.
|
|
146
265
|
|
|
147
266
|
**Parameters:**
|
|
148
267
|
|
|
149
|
-
- `value` (number): Value to convert
|
|
150
|
-
- `from` (string): Source unit
|
|
151
|
-
- `to` (string): Target unit
|
|
152
|
-
- `ingredient` (string, optional): Ingredient for
|
|
268
|
+
- `value` (number, required): Value to convert
|
|
269
|
+
- `from` (string, required): Source unit
|
|
270
|
+
- `to` (string, required): Target unit
|
|
271
|
+
- `ingredient` (string, optional): Ingredient for volume-to-weight conversions
|
|
153
272
|
|
|
154
273
|
**Supported Units:**
|
|
155
274
|
|
|
@@ -168,63 +287,61 @@ Converts between common kitchen measurements and weights, including volume-to-we
|
|
|
168
287
|
- lb (pounds)
|
|
169
288
|
|
|
170
289
|
**Supported Ingredients:**
|
|
171
|
-
- water
|
|
172
|
-
- milk
|
|
173
|
-
- flour
|
|
174
|
-
- sugar
|
|
175
|
-
- brown sugar
|
|
176
|
-
- salt
|
|
177
|
-
- butter
|
|
178
|
-
- oil
|
|
179
|
-
- honey
|
|
180
|
-
- maple syrup
|
|
181
|
-
|
|
182
|
-
**
|
|
290
|
+
- water (density: 1.000 g/ml)
|
|
291
|
+
- milk (density: 1.030 g/ml)
|
|
292
|
+
- flour (density: 0.593 g/ml)
|
|
293
|
+
- sugar (density: 0.845 g/ml)
|
|
294
|
+
- brown sugar (density: 0.721 g/ml)
|
|
295
|
+
- salt (density: 1.217 g/ml)
|
|
296
|
+
- butter (density: 0.911 g/ml)
|
|
297
|
+
- oil (density: 0.918 g/ml)
|
|
298
|
+
- honey (density: 1.420 g/ml)
|
|
299
|
+
- maple syrup (density: 1.370 g/ml)
|
|
300
|
+
|
|
301
|
+
**Example:**
|
|
183
302
|
|
|
184
303
|
```typescript
|
|
185
|
-
//
|
|
186
|
-
// Result: š Conversion Result:
|
|
187
|
-
// ⢠1 cup = 236.59 ml
|
|
304
|
+
// Input
|
|
188
305
|
{
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
306
|
+
"jsonrpc": "2.0",
|
|
307
|
+
"method": "tools/call",
|
|
308
|
+
"params": {
|
|
309
|
+
"name": "kitchenConvert",
|
|
310
|
+
"arguments": {
|
|
311
|
+
"value": 1,
|
|
312
|
+
"from": "cup",
|
|
313
|
+
"to": "g",
|
|
314
|
+
"ingredient": "flour"
|
|
315
|
+
}
|
|
316
|
+
}
|
|
192
317
|
}
|
|
193
318
|
|
|
194
|
-
//
|
|
195
|
-
// Result: š Conversion Result:
|
|
196
|
-
// ⢠1 cup of flour = 140.25 g
|
|
319
|
+
// Output
|
|
197
320
|
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
321
|
+
"jsonrpc": "2.0",
|
|
322
|
+
"result": {
|
|
323
|
+
"content": [{
|
|
324
|
+
"type": "text",
|
|
325
|
+
"text": "š Conversion Result:\n⢠1 cup of flour = 140.30 g\n\nš Note: Conversion includes ingredient density"
|
|
326
|
+
}],
|
|
327
|
+
"isError": false
|
|
328
|
+
}
|
|
202
329
|
}
|
|
203
330
|
```
|
|
204
331
|
|
|
205
332
|
## š Usage
|
|
206
333
|
|
|
207
|
-
### As
|
|
208
|
-
|
|
209
|
-
1. **Global Installation:**
|
|
334
|
+
### As CLI Tool
|
|
210
335
|
|
|
211
336
|
```bash
|
|
337
|
+
# Global Installation
|
|
212
338
|
npm install -g @nekzus/mcp-server
|
|
213
|
-
```
|
|
214
339
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
```bash
|
|
340
|
+
# Direct Execution
|
|
218
341
|
npx @nekzus/mcp-server
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### As a Dependency
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
import { McpUtilityServer } from "@nekzus/mcp-server";
|
|
225
342
|
|
|
226
|
-
|
|
227
|
-
server
|
|
343
|
+
# Example Usage
|
|
344
|
+
echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"greeting","arguments":{"name":"John"}}}' | npx @nekzus/mcp-server
|
|
228
345
|
```
|
|
229
346
|
|
|
230
347
|
## š§ Development
|
|
@@ -236,48 +353,57 @@ git clone https://github.com/nekzus/mcp-server.git
|
|
|
236
353
|
# Install dependencies
|
|
237
354
|
npm install
|
|
238
355
|
|
|
239
|
-
# Development mode
|
|
240
|
-
npm run dev
|
|
241
|
-
|
|
242
356
|
# Build
|
|
243
357
|
npm run build
|
|
244
358
|
|
|
245
|
-
# Run
|
|
246
|
-
npm
|
|
359
|
+
# Run tests
|
|
360
|
+
npm test
|
|
361
|
+
|
|
362
|
+
# Format code
|
|
363
|
+
npm run format
|
|
364
|
+
|
|
365
|
+
# Lint code
|
|
366
|
+
npm run lint
|
|
367
|
+
|
|
368
|
+
# Check code
|
|
369
|
+
npm run check
|
|
247
370
|
```
|
|
248
371
|
|
|
249
372
|
## š Project Structure
|
|
250
373
|
|
|
251
374
|
```
|
|
252
|
-
|
|
253
|
-
āāā
|
|
254
|
-
|
|
255
|
-
āāā
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
āāā index.ts # Main entry point
|
|
375
|
+
/
|
|
376
|
+
āāā index.ts # Main server implementation
|
|
377
|
+
āāā package.json # Project configuration
|
|
378
|
+
āāā tsconfig.json # TypeScript configuration
|
|
379
|
+
āāā biome.json # Biome configuration
|
|
380
|
+
āāā jest.config.js # Jest configuration
|
|
381
|
+
āāā .github/ # GitHub workflows
|
|
382
|
+
ā āāā workflows/ # CI/CD configuration
|
|
383
|
+
āāā dist/ # Compiled JavaScript
|
|
262
384
|
```
|
|
263
385
|
|
|
264
386
|
## š Technical Details
|
|
265
387
|
|
|
266
|
-
- **Transport:** Uses `StdioServerTransport` for communication
|
|
267
|
-
- **Validation:**
|
|
268
|
-
- **
|
|
269
|
-
- **
|
|
270
|
-
- **
|
|
388
|
+
- **Transport:** Uses `StdioServerTransport` for JSON-RPC communication
|
|
389
|
+
- **Input Validation:** Schema validation for tool arguments
|
|
390
|
+
- **Error Handling:** Comprehensive error handling with detailed messages
|
|
391
|
+
- **Security:** Safe expression evaluation in calculator tool
|
|
392
|
+
- **Types:** Full TypeScript type coverage
|
|
393
|
+
- **Testing:** Jest test framework integration
|
|
394
|
+
- **CI/CD:** Automated publishing with semantic-release
|
|
395
|
+
- **Formatting:** Biome for code formatting and linting
|
|
271
396
|
|
|
272
397
|
## š License
|
|
273
398
|
|
|
274
|
-
This
|
|
399
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
275
400
|
|
|
276
401
|
## š¤ Author
|
|
277
402
|
|
|
278
403
|
**Nekzus**
|
|
279
404
|
|
|
280
405
|
- GitHub: [@nekzus](https://github.com/nekzus)
|
|
406
|
+
- PayPal: [Donate](https://paypal.me/maseortega)
|
|
281
407
|
|
|
282
408
|
## š Support
|
|
283
409
|
|
package/dist/index.js
CHANGED
|
@@ -497,18 +497,48 @@ const server = new Server({
|
|
|
497
497
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
498
498
|
tools: TOOLS,
|
|
499
499
|
}));
|
|
500
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) =>
|
|
500
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
501
|
+
const result = await handleToolCall(request.params.name, request.params.arguments ?? {});
|
|
502
|
+
return result;
|
|
503
|
+
});
|
|
501
504
|
// Server startup
|
|
502
505
|
async function runServer() {
|
|
503
506
|
try {
|
|
504
507
|
const transport = new StdioServerTransport();
|
|
508
|
+
// Handle messages directly
|
|
509
|
+
process.stdin.on('data', async (data) => {
|
|
510
|
+
try {
|
|
511
|
+
const message = JSON.parse(data.toString());
|
|
512
|
+
if (message.method === 'tools/call') {
|
|
513
|
+
const result = await handleToolCall(message.params.name, message.params.arguments ?? {});
|
|
514
|
+
const response = {
|
|
515
|
+
jsonrpc: '2.0',
|
|
516
|
+
result,
|
|
517
|
+
id: message.id,
|
|
518
|
+
};
|
|
519
|
+
process.stdout.write(`${JSON.stringify(response)}\n`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
catch (error) {
|
|
523
|
+
log('[Server] Error processing message:', error);
|
|
524
|
+
}
|
|
525
|
+
});
|
|
505
526
|
await server.connect(transport);
|
|
506
527
|
log('[Server] MCP Server is running');
|
|
507
528
|
log('[Server] Available tools:', TOOLS.map((t) => t.name).join(', '));
|
|
508
529
|
// Handle stdin close
|
|
509
|
-
process.stdin.on('close', () => {
|
|
530
|
+
process.stdin.on('close', async () => {
|
|
510
531
|
log('[Server] Input stream closed');
|
|
511
|
-
cleanup();
|
|
532
|
+
await cleanup();
|
|
533
|
+
});
|
|
534
|
+
// Add signal handlers for graceful shutdown
|
|
535
|
+
process.on('SIGINT', async () => {
|
|
536
|
+
log('[Server] Received SIGINT signal');
|
|
537
|
+
await cleanup();
|
|
538
|
+
});
|
|
539
|
+
process.on('SIGTERM', async () => {
|
|
540
|
+
log('[Server] Received SIGTERM signal');
|
|
541
|
+
await cleanup();
|
|
512
542
|
});
|
|
513
543
|
}
|
|
514
544
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nekzus/mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Personal MCP Server implementation providing extensible utility functions and tools for development and testing purposes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "tsc &&
|
|
13
|
+
"build": "tsc && chmod +x dist/index.js",
|
|
14
|
+
"prepare": "npm run build",
|
|
14
15
|
"dev": "tsx src/index.ts",
|
|
15
16
|
"start": "node dist/index.js",
|
|
16
17
|
"test": "jest --passWithNoTests",
|
|
@@ -19,7 +20,6 @@
|
|
|
19
20
|
"check": "biome check --apply .",
|
|
20
21
|
"commit": "git-cz",
|
|
21
22
|
"semantic-release": "semantic-release --branches main",
|
|
22
|
-
"prepare": "npm run build",
|
|
23
23
|
"watch": "tsc --watch"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|