@nekzus/mcp-server 1.0.34 → 1.0.36
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 +123 -0
- package/package.json +6 -14
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -180
package/README.md
CHANGED
|
@@ -79,6 +79,129 @@ Gets the current date and time for a specific timezone.
|
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
### 4. calculator
|
|
83
|
+
|
|
84
|
+
Performs mathematical calculations with support for basic and advanced operations.
|
|
85
|
+
|
|
86
|
+
**Parameters:**
|
|
87
|
+
|
|
88
|
+
- `expression` (string): Mathematical expression (e.g., "2 + 2 * 3")
|
|
89
|
+
- `precision` (number, optional): Decimal places in the result (default: 2)
|
|
90
|
+
|
|
91
|
+
**Example:**
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// Result: 8
|
|
95
|
+
{
|
|
96
|
+
expression: "2 + 2 * 3"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 5. passwordGen
|
|
101
|
+
|
|
102
|
+
Generates secure passwords with customizable options.
|
|
103
|
+
|
|
104
|
+
**Parameters:**
|
|
105
|
+
|
|
106
|
+
- `length` (number, optional): Password length (default: 16)
|
|
107
|
+
- `includeNumbers` (boolean, optional): Include numbers (default: true)
|
|
108
|
+
- `includeSymbols` (boolean, optional): Include special characters (default: true)
|
|
109
|
+
- `includeUppercase` (boolean, optional): Include uppercase letters (default: true)
|
|
110
|
+
|
|
111
|
+
**Example:**
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Result: 4v7&9G8$
|
|
115
|
+
{
|
|
116
|
+
length: 16,
|
|
117
|
+
includeNumbers: true,
|
|
118
|
+
includeSymbols: true,
|
|
119
|
+
includeUppercase: true
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 6. qrGen
|
|
124
|
+
|
|
125
|
+
Generates QR codes for text or URLs.
|
|
126
|
+
|
|
127
|
+
**Parameters:**
|
|
128
|
+
|
|
129
|
+
- `text` (string): Text or URL to encode
|
|
130
|
+
- `size` (number, optional): Size in pixels (default: 200)
|
|
131
|
+
- `dark` (string, optional): Dark module color (default: "#000000")
|
|
132
|
+
- `light` (string, optional): Light module color (default: "#ffffff")
|
|
133
|
+
|
|
134
|
+
**Example:**
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
// Result: QR code for "https://example.com"
|
|
138
|
+
{
|
|
139
|
+
text: "https://example.com"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 7. kitchenConvert
|
|
144
|
+
|
|
145
|
+
Converts between common kitchen measurements and weights, including volume-to-weight conversions based on specific ingredients.
|
|
146
|
+
|
|
147
|
+
**Parameters:**
|
|
148
|
+
|
|
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
|
|
153
|
+
|
|
154
|
+
**Supported Units:**
|
|
155
|
+
|
|
156
|
+
*Volume:*
|
|
157
|
+
- ml (milliliters)
|
|
158
|
+
- l (liters)
|
|
159
|
+
- cup (US cup)
|
|
160
|
+
- tbsp (tablespoon)
|
|
161
|
+
- tsp (teaspoon)
|
|
162
|
+
- floz (fluid ounce)
|
|
163
|
+
|
|
164
|
+
*Weight:*
|
|
165
|
+
- g (grams)
|
|
166
|
+
- kg (kilograms)
|
|
167
|
+
- oz (ounces)
|
|
168
|
+
- lb (pounds)
|
|
169
|
+
|
|
170
|
+
**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:**
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
// Simple volume conversion
|
|
186
|
+
// Result: 🔄 Conversion Result:
|
|
187
|
+
// • 1 cup = 236.59 ml
|
|
188
|
+
{
|
|
189
|
+
value: 1,
|
|
190
|
+
from: "cup",
|
|
191
|
+
to: "ml"
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Volume to weight conversion with ingredient
|
|
195
|
+
// Result: 🔄 Conversion Result:
|
|
196
|
+
// • 1 cup of flour = 140.25 g
|
|
197
|
+
{
|
|
198
|
+
value: 1,
|
|
199
|
+
from: "cup",
|
|
200
|
+
to: "g",
|
|
201
|
+
ingredient: "flour"
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
82
205
|
## 🚀 Usage
|
|
83
206
|
|
|
84
207
|
### As MCP Server
|
package/package.json
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nekzus/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
4
4
|
"description": "Personal MCP Server implementation providing extensible utility functions and tools for development and testing purposes",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
6
|
"bin": {
|
|
8
7
|
"mcp-server": "./dist/index.js"
|
|
9
8
|
},
|
|
10
9
|
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
"README.md",
|
|
13
|
-
"LICENSE"
|
|
10
|
+
"dist"
|
|
14
11
|
],
|
|
15
12
|
"scripts": {
|
|
16
|
-
"build": "tsc &&
|
|
17
|
-
"dev": "tsx src/index.ts",
|
|
13
|
+
"build": "tsc && node -e \"require('fs').chmodSync('dist/index.js', '755')\"",
|
|
18
14
|
"start": "node dist/index.js",
|
|
19
15
|
"test": "jest --passWithNoTests",
|
|
20
16
|
"format": "biome format --write .",
|
|
21
17
|
"lint": "biome lint --write .",
|
|
22
18
|
"check": "biome check --apply .",
|
|
23
19
|
"commit": "git-cz",
|
|
24
|
-
"semantic-release": "semantic-release --branches main"
|
|
25
|
-
"prepare": "npm run build",
|
|
26
|
-
"watch": "tsc --watch"
|
|
20
|
+
"semantic-release": "semantic-release --branches main"
|
|
27
21
|
},
|
|
28
22
|
"keywords": [
|
|
29
23
|
"mcp",
|
|
@@ -55,13 +49,11 @@
|
|
|
55
49
|
"@semantic-release/npm": "12.0.1",
|
|
56
50
|
"@semantic-release/release-notes-generator": "14.0.3",
|
|
57
51
|
"@types/jest": "29.5.14",
|
|
58
|
-
"@types/node": "22.13.
|
|
52
|
+
"@types/node": "22.13.11",
|
|
59
53
|
"cz-conventional-changelog": "3.3.0",
|
|
60
|
-
"jest": "
|
|
54
|
+
"jest": "29.7.0",
|
|
61
55
|
"semantic-release": "24.2.3",
|
|
62
|
-
"shx": "0.4.0",
|
|
63
56
|
"ts-jest": "29.2.6",
|
|
64
|
-
"tsx": "4.19.3",
|
|
65
57
|
"typescript": "5.8.2"
|
|
66
58
|
},
|
|
67
59
|
"config": {
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import 'dotenv/config';
|
|
6
|
-
// Define the tools once to avoid repetition
|
|
7
|
-
const TOOLS = [
|
|
8
|
-
{
|
|
9
|
-
name: 'greeting',
|
|
10
|
-
description: 'Generate a personalized greeting message for the specified person',
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
name: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'Name of the recipient for the greeting',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
required: ['name'],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'card',
|
|
24
|
-
description: 'Draw a random card from a standard 52-card poker deck',
|
|
25
|
-
inputSchema: {
|
|
26
|
-
type: 'object',
|
|
27
|
-
properties: {
|
|
28
|
-
random_string: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
description: 'Dummy parameter for no-parameter tools',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
required: ['random_string'],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'datetime',
|
|
38
|
-
description: 'Get the current date and time for a specific timezone',
|
|
39
|
-
inputSchema: {
|
|
40
|
-
type: 'object',
|
|
41
|
-
properties: {
|
|
42
|
-
timeZone: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
description: 'Timezone identifier (e.g., "America/New_York")',
|
|
45
|
-
},
|
|
46
|
-
locale: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: 'Locale identifier (e.g., "en-US")',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
// Tool handlers
|
|
55
|
-
async function handleGreeting(args) {
|
|
56
|
-
const { name } = args;
|
|
57
|
-
return {
|
|
58
|
-
content: [
|
|
59
|
-
{
|
|
60
|
-
type: 'text',
|
|
61
|
-
text: `¡Hola ${name}! ¿Cómo estás?`,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
isError: false,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
async function handleCard() {
|
|
68
|
-
const suits = ['♠', '♥', '♦', '♣'];
|
|
69
|
-
const values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'];
|
|
70
|
-
const suit = suits[Math.floor(Math.random() * suits.length)];
|
|
71
|
-
const value = values[Math.floor(Math.random() * values.length)];
|
|
72
|
-
return {
|
|
73
|
-
content: [
|
|
74
|
-
{
|
|
75
|
-
type: 'text',
|
|
76
|
-
text: `${value}${suit}`,
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
isError: false,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
async function handleDateTime(args) {
|
|
83
|
-
const { timeZone = 'UTC', locale = 'en-US' } = args;
|
|
84
|
-
try {
|
|
85
|
-
const date = new Date();
|
|
86
|
-
const formattedDate = new Intl.DateTimeFormat(locale, {
|
|
87
|
-
timeZone,
|
|
88
|
-
dateStyle: 'full',
|
|
89
|
-
timeStyle: 'long',
|
|
90
|
-
}).format(date);
|
|
91
|
-
return {
|
|
92
|
-
content: [
|
|
93
|
-
{
|
|
94
|
-
type: 'text',
|
|
95
|
-
text: formattedDate,
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
isError: false,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
return {
|
|
103
|
-
content: [
|
|
104
|
-
{
|
|
105
|
-
type: 'text',
|
|
106
|
-
text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
isError: true,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Tool call handler
|
|
114
|
-
async function handleToolCall(name, args) {
|
|
115
|
-
switch (name) {
|
|
116
|
-
case 'greeting':
|
|
117
|
-
return handleGreeting(args);
|
|
118
|
-
case 'card':
|
|
119
|
-
return handleCard();
|
|
120
|
-
case 'datetime':
|
|
121
|
-
return handleDateTime(args);
|
|
122
|
-
default:
|
|
123
|
-
return {
|
|
124
|
-
content: [
|
|
125
|
-
{
|
|
126
|
-
type: 'text',
|
|
127
|
-
text: `Unknown tool: ${name}`,
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
isError: true,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Server configuration
|
|
135
|
-
const server = new Server({
|
|
136
|
-
name: '@nekzus/mcp-server',
|
|
137
|
-
version: '0.1.0',
|
|
138
|
-
description: 'MCP Server implementation for development',
|
|
139
|
-
}, {
|
|
140
|
-
capabilities: {
|
|
141
|
-
tools: {},
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
// Setup request handlers
|
|
145
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
146
|
-
tools: TOOLS,
|
|
147
|
-
}));
|
|
148
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}));
|
|
149
|
-
// Server startup
|
|
150
|
-
async function runServer() {
|
|
151
|
-
try {
|
|
152
|
-
const transport = new StdioServerTransport();
|
|
153
|
-
await server.connect(transport);
|
|
154
|
-
console.log('[Server] MCP Server is running');
|
|
155
|
-
console.log('[Server] Available tools:', TOOLS.map((t) => t.name).join(', '));
|
|
156
|
-
// Handle stdin close
|
|
157
|
-
process.stdin.on('close', () => {
|
|
158
|
-
console.log('[Server] Input stream closed');
|
|
159
|
-
cleanup();
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
console.error('[Server] Failed to start MCP Server:', error);
|
|
164
|
-
process.exit(1);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
// Cleanup function
|
|
168
|
-
async function cleanup() {
|
|
169
|
-
try {
|
|
170
|
-
await server.close();
|
|
171
|
-
console.log('[Server] MCP Server stopped gracefully');
|
|
172
|
-
process.exit(0);
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
console.error('[Server] Error during cleanup:', error);
|
|
176
|
-
process.exit(1);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Start the server
|
|
180
|
-
runServer().catch(console.error);
|