@nekzus/mcp-server 1.1.2 → 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.
Files changed (3) hide show
  1. package/README.md +218 -92
  2. package/dist/index.js +34 -4
  3. package/package.json +4 -4
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 with Zod
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 for New Tools
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
- // Result: šŸ‘‹ Hello John! Welcome to the MCP server!
43
+ // Input
40
44
  {
41
- name: "John";
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
- // Result: šŸŽ“ You drew: Ace of ā™ ļø Spades
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
- // Result:
73
- // šŸ—“ļø Date: March 20, 2024
74
- // ā° Time: 7:25:25 PM
75
- // šŸŒ Timezone: America/New_York
114
+ // Input
76
115
  {
77
- timeZone: "America/New_York",
78
- locale: "en-US"
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
- // Result: 8
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
- expression: "2 + 2 * 3"
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
- // Result: 4v7&9G8$
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
- length: 16,
117
- includeNumbers: true,
118
- includeSymbols: true,
119
- includeUppercase: true
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
- // Result: QR code for "https://example.com"
234
+ // Input
138
235
  {
139
- text: "https://example.com"
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, including volume-to-weight conversions based on specific ingredients.
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 (e.g., "cup", "tbsp", "g", "oz", "ml")
151
- - `to` (string): Target unit (e.g., "cup", "tbsp", "g", "oz", "ml")
152
- - `ingredient` (string, optional): Ingredient for accurate volume-to-weight conversions
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
- **Examples:**
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
- // Simple volume conversion
186
- // Result: šŸ”„ Conversion Result:
187
- // • 1 cup = 236.59 ml
304
+ // Input
188
305
  {
189
- value: 1,
190
- from: "cup",
191
- to: "ml"
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
- // Volume to weight conversion with ingredient
195
- // Result: šŸ”„ Conversion Result:
196
- // • 1 cup of flour = 140.25 g
319
+ // Output
197
320
  {
198
- value: 1,
199
- from: "cup",
200
- to: "g",
201
- ingredient: "flour"
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 MCP Server
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
- 2. **Execution:**
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
- const server = new McpUtilityServer();
227
- server.start();
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 start
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
- src/
253
- ā”œā”€ā”€ types/ # Type definitions
254
- │ └── index.ts # Shared types
255
- ā”œā”€ā”€ utils/ # Utilities
256
- │ ā”œā”€ā”€ cards.ts # Card functions
257
- │ ā”œā”€ā”€ datetime.ts # Date/time functions
258
- │ └── schema.ts # Schema conversion
259
- ā”œā”€ā”€ tools/ # Tool implementations
260
- │ └── index.ts # Tools registry
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:** Converts JSON schemas to Zod for input validation
268
- - **Types:** Fully typed implementation with TypeScript
269
- - **Error Handling:** Robust error handling and resource cleanup
270
- - **Signals:** Handles SIGTERM and SIGINT signals for graceful shutdown
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 MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
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
@@ -485,7 +485,7 @@ async function handleToolCall(name, args) {
485
485
  }
486
486
  // Server configuration
487
487
  const server = new Server({
488
- name: 'nekzus-mcp',
488
+ name: 'mcp-server/nekzus',
489
489
  version: '0.1.0',
490
490
  description: 'MCP Server implementation for development',
491
491
  }, {
@@ -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) => handleToolCall(request.params.name, request.params.arguments ?? {}));
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,16 +1,17 @@
1
1
  {
2
2
  "name": "@nekzus/mcp-server",
3
- "version": "1.1.2",
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": {
7
- "nekzus-mcp": "dist/index.js"
7
+ "mcp-server-nekzus": "dist/index.js"
8
8
  },
9
9
  "files": [
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "build": "tsc && shx chmod +x dist/*.js",
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": [