@aashari/boilerplate-mcp-server 1.4.9 → 1.5.1
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/CHANGELOG.md +19 -0
- package/dist/index.js +11 -0
- package/dist/types/common.types.d.ts +2 -24
- package/dist/utils/constants.util.d.ts +1 -1
- package/dist/utils/constants.util.js +1 -1
- package/package.json +6 -4
- package/package.json.bak +6 -4
- package/scripts/ensure-executable.js +38 -0
- package/dist/utils/constants.util.js.bak +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [1.5.1](https://github.com/aashari/boilerplate-mcp-server/compare/v1.5.0...v1.5.1) (2025-05-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Improve cross-platform compatibility for npx execution ([d840c51](https://github.com/aashari/boilerplate-mcp-server/commit/d840c51cc94ad3d54e5c38670b774cdb7d52b8a7))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Performance Improvements
|
|
10
|
+
|
|
11
|
+
* Update dependencies ([cbc63fe](https://github.com/aashari/boilerplate-mcp-server/commit/cbc63fe692f563a3e1b68bb136b8f567408fbf9c))
|
|
12
|
+
|
|
13
|
+
# [1.5.0](https://github.com/aashari/boilerplate-mcp-server/compare/v1.4.9...v1.5.0) (2025-05-05)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **boilerplate:** add standard pagination utils and formatPagination ([cb1e004](https://github.com/aashari/boilerplate-mcp-server/commit/cb1e004fcb33eef61605983b74cf8a373018830b))
|
|
19
|
+
|
|
1
20
|
## [1.4.9](https://github.com/aashari/boilerplate-mcp-server/compare/v1.4.8...v1.4.9) (2025-05-04)
|
|
2
21
|
|
|
3
22
|
|
package/dist/index.js
CHANGED
|
@@ -105,6 +105,17 @@ async function main() {
|
|
|
105
105
|
await startServer();
|
|
106
106
|
mainLogger.info('Server is now running');
|
|
107
107
|
}
|
|
108
|
+
// --- Start: Add Graceful Shutdown ---
|
|
109
|
+
const shutdown = async (signal) => {
|
|
110
|
+
mainLogger.info(`Received ${signal}. Shutting down gracefully...`);
|
|
111
|
+
// Add any specific cleanup logic here if needed in the future
|
|
112
|
+
// For now, just exiting cleanly is the main goal
|
|
113
|
+
// No need to explicitly call server disconnect if process exits
|
|
114
|
+
process.exit(0);
|
|
115
|
+
};
|
|
116
|
+
process.on('SIGINT', () => shutdown('SIGINT')); // Ctrl+C
|
|
117
|
+
process.on('SIGTERM', () => shutdown('SIGTERM')); // kill command
|
|
118
|
+
// --- End: Add Graceful Shutdown ---
|
|
108
119
|
}
|
|
109
120
|
// If this file is being executed directly (not imported), run the main function
|
|
110
121
|
if (require.main === module) {
|
|
@@ -3,27 +3,6 @@
|
|
|
3
3
|
* These types provide a standard interface for controller interactions.
|
|
4
4
|
* Centralized here to ensure consistency across the codebase.
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* Common pagination information for API responses.
|
|
8
|
-
* This is used for providing consistent pagination details to clients.
|
|
9
|
-
*/
|
|
10
|
-
export interface ResponsePagination {
|
|
11
|
-
/**
|
|
12
|
-
* Cursor for the next page of results, if available.
|
|
13
|
-
* This should be passed to subsequent requests to retrieve the next page.
|
|
14
|
-
*/
|
|
15
|
-
nextCursor?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Whether more results are available beyond the current page.
|
|
18
|
-
* When true, clients should use the nextCursor to retrieve more results.
|
|
19
|
-
*/
|
|
20
|
-
hasMore: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* The number of items in the current result set.
|
|
23
|
-
* This helps clients track how many items they've received.
|
|
24
|
-
*/
|
|
25
|
-
count?: number;
|
|
26
|
-
}
|
|
27
6
|
/**
|
|
28
7
|
* Common response structure for controller operations.
|
|
29
8
|
* All controller methods should return this structure.
|
|
@@ -35,8 +14,7 @@ export interface ControllerResponse {
|
|
|
35
14
|
*/
|
|
36
15
|
content: string;
|
|
37
16
|
/**
|
|
38
|
-
* Optional
|
|
39
|
-
* If present, indicates that more results are available.
|
|
17
|
+
* Optional metadata for any extra information associated with the response.
|
|
40
18
|
*/
|
|
41
|
-
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
42
20
|
}
|
|
@@ -11,7 +11,7 @@ exports.CLI_NAME = exports.PACKAGE_NAME = exports.VERSION = void 0;
|
|
|
11
11
|
* Current application version
|
|
12
12
|
* This should match the version in package.json
|
|
13
13
|
*/
|
|
14
|
-
exports.VERSION = '1.
|
|
14
|
+
exports.VERSION = '1.5.1';
|
|
15
15
|
/**
|
|
16
16
|
* Package name with scope
|
|
17
17
|
* Used for initialization and identification
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aashari/boilerplate-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "TypeScript Model Context Protocol (MCP) server boilerplate providing IP lookup tools/resources. Includes CLI support and extensible structure for connecting AI systems (LLMs) to external data sources like ip-api.com. Ideal template for creating new MCP integrations via Node.js.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
"mcp-server": "./dist/index.js"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "tsc",
|
|
17
|
+
"build": "rimraf dist && tsc",
|
|
18
18
|
"prepare": "npm run build && chmod +x dist/index.js",
|
|
19
|
-
"postinstall": "
|
|
19
|
+
"postinstall": "node scripts/ensure-executable.js || true",
|
|
20
20
|
"test": "jest",
|
|
21
21
|
"test:coverage": "jest --coverage",
|
|
22
|
+
"test:cli": "jest src/cli/.*\\.cli\\.test\\.ts --runInBand --testTimeout=60000",
|
|
22
23
|
"lint": "eslint src --ext .ts --config eslint.config.mjs",
|
|
23
24
|
"format": "prettier --write 'src/**/*.ts' 'scripts/**/*.js'",
|
|
24
25
|
"publish:npm": "npm publish",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"nodemon": "^3.1.10",
|
|
71
72
|
"npm-check-updates": "^18.0.1",
|
|
72
73
|
"prettier": "^3.5.3",
|
|
74
|
+
"rimraf": "^6.0.1",
|
|
73
75
|
"semantic-release": "^24.2.3",
|
|
74
76
|
"ts-jest": "^29.3.2",
|
|
75
77
|
"ts-node": "^10.9.2",
|
|
@@ -84,7 +86,7 @@
|
|
|
84
86
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
85
87
|
"commander": "^13.1.0",
|
|
86
88
|
"dotenv": "^16.5.0",
|
|
87
|
-
"zod": "^3.24.
|
|
89
|
+
"zod": "^3.24.4"
|
|
88
90
|
},
|
|
89
91
|
"directories": {
|
|
90
92
|
"example": "examples"
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aashari/boilerplate-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "TypeScript Model Context Protocol (MCP) server boilerplate providing IP lookup tools/resources. Includes CLI support and extensible structure for connecting AI systems (LLMs) to external data sources like ip-api.com. Ideal template for creating new MCP integrations via Node.js.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
"mcp-server": "./dist/index.js"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "tsc",
|
|
17
|
+
"build": "rimraf dist && tsc",
|
|
18
18
|
"prepare": "npm run build && chmod +x dist/index.js",
|
|
19
|
-
"postinstall": "
|
|
19
|
+
"postinstall": "node scripts/ensure-executable.js || true",
|
|
20
20
|
"test": "jest",
|
|
21
21
|
"test:coverage": "jest --coverage",
|
|
22
|
+
"test:cli": "jest src/cli/.*\\.cli\\.test\\.ts --runInBand --testTimeout=60000",
|
|
22
23
|
"lint": "eslint src --ext .ts --config eslint.config.mjs",
|
|
23
24
|
"format": "prettier --write 'src/**/*.ts' 'scripts/**/*.js'",
|
|
24
25
|
"publish:npm": "npm publish",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"nodemon": "^3.1.10",
|
|
71
72
|
"npm-check-updates": "^18.0.1",
|
|
72
73
|
"prettier": "^3.5.3",
|
|
74
|
+
"rimraf": "^6.0.1",
|
|
73
75
|
"semantic-release": "^24.2.3",
|
|
74
76
|
"ts-jest": "^29.3.2",
|
|
75
77
|
"ts-node": "^10.9.2",
|
|
@@ -84,7 +86,7 @@
|
|
|
84
86
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
85
87
|
"commander": "^13.1.0",
|
|
86
88
|
"dotenv": "^16.5.0",
|
|
87
|
-
"zod": "^3.24.
|
|
89
|
+
"zod": "^3.24.4"
|
|
88
90
|
},
|
|
89
91
|
"directories": {
|
|
90
92
|
"example": "examples"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
// Use dynamic import meta for ESM compatibility
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
const rootDir = path.resolve(__dirname, '..');
|
|
10
|
+
const entryPoint = path.join(rootDir, 'dist', 'index.js');
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
if (fs.existsSync(entryPoint)) {
|
|
14
|
+
// Ensure the file is executable (cross-platform)
|
|
15
|
+
const currentMode = fs.statSync(entryPoint).mode;
|
|
16
|
+
// Check if executable bits are set (user, group, or other)
|
|
17
|
+
// Mode constants differ slightly across platforms, checking broadly
|
|
18
|
+
const isExecutable =
|
|
19
|
+
currentMode & fs.constants.S_IXUSR ||
|
|
20
|
+
currentMode & fs.constants.S_IXGRP ||
|
|
21
|
+
currentMode & fs.constants.S_IXOTH;
|
|
22
|
+
|
|
23
|
+
if (!isExecutable) {
|
|
24
|
+
// Set permissions to 755 (rwxr-xr-x) if not executable
|
|
25
|
+
fs.chmodSync(entryPoint, 0o755);
|
|
26
|
+
console.log(
|
|
27
|
+
`Made ${path.relative(rootDir, entryPoint)} executable`,
|
|
28
|
+
);
|
|
29
|
+
} else {
|
|
30
|
+
// console.log(`${path.relative(rootDir, entryPoint)} is already executable`);
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
// console.warn(`${path.relative(rootDir, entryPoint)} not found, skipping chmod`);
|
|
34
|
+
}
|
|
35
|
+
} catch (err) {
|
|
36
|
+
// console.warn(`Failed to set executable permissions: ${err.message}`);
|
|
37
|
+
// We use '|| true' in package.json, so no need to exit here
|
|
38
|
+
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Application constants
|
|
4
|
-
*
|
|
5
|
-
* This file contains constants used throughout the application.
|
|
6
|
-
* Centralizing these values makes them easier to maintain and update.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.CLI_NAME = exports.PACKAGE_NAME = exports.VERSION = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* Current application version
|
|
12
|
-
* This should match the version in package.json
|
|
13
|
-
*/
|
|
14
|
-
exports.VERSION = '1.1.3';
|
|
15
|
-
/**
|
|
16
|
-
* Package name with scope
|
|
17
|
-
* Used for initialization and identification
|
|
18
|
-
*/
|
|
19
|
-
exports.PACKAGE_NAME = '@aashari/boilerplate-mcp-server';
|
|
20
|
-
/**
|
|
21
|
-
* CLI command name
|
|
22
|
-
* Used for binary name and CLI help text
|
|
23
|
-
*/
|
|
24
|
-
exports.CLI_NAME = 'mcp-boilerplate';
|