@nekzus/mcp-server 1.0.33 → 1.0.34
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/dist/index.d.ts +2 -0
- package/dist/index.js +11 -1
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import 'dotenv/config';
|
|
6
|
+
// Define the tools once to avoid repetition
|
|
5
7
|
const TOOLS = [
|
|
6
8
|
{
|
|
7
9
|
name: 'greeting',
|
|
@@ -49,6 +51,7 @@ const TOOLS = [
|
|
|
49
51
|
},
|
|
50
52
|
},
|
|
51
53
|
];
|
|
54
|
+
// Tool handlers
|
|
52
55
|
async function handleGreeting(args) {
|
|
53
56
|
const { name } = args;
|
|
54
57
|
return {
|
|
@@ -107,6 +110,7 @@ async function handleDateTime(args) {
|
|
|
107
110
|
};
|
|
108
111
|
}
|
|
109
112
|
}
|
|
113
|
+
// Tool call handler
|
|
110
114
|
async function handleToolCall(name, args) {
|
|
111
115
|
switch (name) {
|
|
112
116
|
case 'greeting':
|
|
@@ -127,8 +131,9 @@ async function handleToolCall(name, args) {
|
|
|
127
131
|
};
|
|
128
132
|
}
|
|
129
133
|
}
|
|
134
|
+
// Server configuration
|
|
130
135
|
const server = new Server({
|
|
131
|
-
name: '@nekzus/server
|
|
136
|
+
name: '@nekzus/mcp-server',
|
|
132
137
|
version: '0.1.0',
|
|
133
138
|
description: 'MCP Server implementation for development',
|
|
134
139
|
}, {
|
|
@@ -136,16 +141,19 @@ const server = new Server({
|
|
|
136
141
|
tools: {},
|
|
137
142
|
},
|
|
138
143
|
});
|
|
144
|
+
// Setup request handlers
|
|
139
145
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
140
146
|
tools: TOOLS,
|
|
141
147
|
}));
|
|
142
148
|
server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}));
|
|
149
|
+
// Server startup
|
|
143
150
|
async function runServer() {
|
|
144
151
|
try {
|
|
145
152
|
const transport = new StdioServerTransport();
|
|
146
153
|
await server.connect(transport);
|
|
147
154
|
console.log('[Server] MCP Server is running');
|
|
148
155
|
console.log('[Server] Available tools:', TOOLS.map((t) => t.name).join(', '));
|
|
156
|
+
// Handle stdin close
|
|
149
157
|
process.stdin.on('close', () => {
|
|
150
158
|
console.log('[Server] Input stream closed');
|
|
151
159
|
cleanup();
|
|
@@ -156,6 +164,7 @@ async function runServer() {
|
|
|
156
164
|
process.exit(1);
|
|
157
165
|
}
|
|
158
166
|
}
|
|
167
|
+
// Cleanup function
|
|
159
168
|
async function cleanup() {
|
|
160
169
|
try {
|
|
161
170
|
await server.close();
|
|
@@ -167,4 +176,5 @@ async function cleanup() {
|
|
|
167
176
|
process.exit(1);
|
|
168
177
|
}
|
|
169
178
|
}
|
|
179
|
+
// Start the server
|
|
170
180
|
runServer().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nekzus/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "Personal MCP Server implementation providing extensible utility functions and tools for development and testing purposes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|