@aashari/boilerplate-mcp-server 1.10.4 → 1.11.0

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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.11.0](https://github.com/aashari/boilerplate-mcp-server/compare/v1.10.5...v1.11.0) (2025-06-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * add Streamable HTTP transport support alongside STDIO ([aa04e01](https://github.com/aashari/boilerplate-mcp-server/commit/aa04e011b2f80ced3de024050e36ef09d3ed7b18))
7
+
8
+ ## [1.10.5](https://github.com/aashari/boilerplate-mcp-server/compare/v1.10.4...v1.10.5) (2025-06-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * replace Unix-specific chmod with cross-platform ensure-executable script ([6733798](https://github.com/aashari/boilerplate-mcp-server/commit/6733798669eead4766627193d5ef9f1f0cf1582a))
14
+
1
15
  ## [1.10.4](https://github.com/aashari/boilerplate-mcp-server/compare/v1.10.3...v1.10.4) (2025-06-02)
2
16
 
3
17
 
package/README.md CHANGED
@@ -7,13 +7,14 @@ A foundation for developing custom Model Context Protocol (MCP) servers in TypeS
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue)](https://www.typescriptlang.org/)
8
8
  [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
9
9
 
10
- ## Why Use This Boilerplate?
10
+ ## Features
11
11
 
12
- - **Production-Ready Architecture**: Follows the same pattern used in published MCP servers, with clean separation between CLI, tools, controllers, and services
13
- - **Type Safety**: Built with TypeScript for improved developer experience, code quality, and maintainability
14
- - **Working Example**: Includes fully implemented tools demonstrating the complete pattern from CLI to API integration
15
- - **Testing Framework**: Ready-to-use testing infrastructure for unit and CLI integration tests, with coverage reporting
16
- - **Complete Developer Tooling**: Pre-configured ESLint, Prettier, TypeScript, and CI/CD workflows
12
+ - **Multiple Transport Support**: STDIO and Streamable HTTP transports
13
+ - **Production-Ready Architecture**: Clean separation between CLI, tools, controllers, and services
14
+ - **Type Safety**: Built with TypeScript for improved developer experience
15
+ - **Working Example**: Fully implemented IP address lookup tools
16
+ - **Testing Framework**: Ready-to-use testing infrastructure with coverage reporting
17
+ - **Complete Developer Tooling**: Pre-configured ESLint, Prettier, TypeScript
17
18
 
18
19
  ## What is MCP?
19
20
 
@@ -34,13 +35,36 @@ cd boilerplate-mcp-server
34
35
  # Install dependencies
35
36
  npm install
36
37
 
37
- # Start development server
38
- npm run dev:server
38
+ # Run in different modes:
39
39
 
40
- # Try the example tool
41
- npm run dev:cli -- get-ip-details 8.8.8.8
40
+ # 1. CLI Mode - Execute commands directly
41
+ npm run cli -- get-ip-details 8.8.8.8
42
+
43
+ # 2. STDIO Transport - For direct AI assistant integration
44
+ npm run mcp:stdio
45
+
46
+ # 3. HTTP Transport - For web-based integrations (default)
47
+ npm run mcp:http
48
+
49
+ # 4. Development with MCP Inspector
50
+ npm run mcp:inspect
42
51
  ```
43
52
 
53
+ ## Transport Modes
54
+
55
+ ### STDIO Transport
56
+ - Traditional subprocess communication via stdin/stdout
57
+ - Ideal for local AI assistant integrations
58
+ - Run with: `TRANSPORT_MODE=stdio npm run build && node dist/index.js`
59
+
60
+ ### Streamable HTTP Transport (Default)
61
+ - Modern HTTP-based transport with Server-Sent Events (SSE)
62
+ - Supports multiple concurrent connections
63
+ - Runs on port 3000 by default (configurable via PORT env var)
64
+ - Endpoint: `http://localhost:3000/mcp`
65
+ - Health check: `http://localhost:3000/`
66
+ - Run with: `TRANSPORT_MODE=http npm run build && node dist/index.js`
67
+
44
68
  ## Architecture Overview
45
69
 
46
70
  <details>
@@ -58,6 +82,8 @@ src/
58
82
  ├── tools/ # MCP tool definitions
59
83
  │ ├── *.tool.ts # Tool implementations
60
84
  │ └── *.types.ts # Tool argument schemas
85
+ ├── resources/ # MCP resource definitions
86
+ │ └── *.resource.ts # Resource implementations
61
87
  ├── types/ # Type definitions
62
88
  │ └── common.types.ts # Shared type definitions
63
89
  ├── utils/ # Shared utilities
@@ -107,40 +133,44 @@ The boilerplate follows a clean, layered architecture that promotes maintainabil
107
133
  ### Development Scripts
108
134
 
109
135
  ```bash
110
- # Start server in dev mode with hot-reload & inspector
111
- npm run dev:server
112
-
113
- # Run CLI commands in development
114
- npm run dev:cli -- [command] [args]
115
-
116
- # Build the project
117
- npm run build
136
+ # Development
137
+ npm run build # Build TypeScript
138
+ npm run clean # Clean build artifacts
118
139
 
119
- # Production server
120
- npm start
121
- npm run start:server
140
+ # Running different modes
141
+ npm run cli -- [command] # Run CLI commands
142
+ npm run mcp:stdio # Run with STDIO transport
143
+ npm run mcp:http # Run with HTTP transport (default)
144
+ npm run mcp:inspect # Run with MCP Inspector
122
145
 
123
- # Production CLI
124
- npm run start:cli -- [command] [args]
146
+ # Development modes
147
+ npm run dev:stdio # STDIO with inspector
148
+ npm run dev:http # HTTP in development mode
125
149
 
126
150
  # Testing
127
151
  npm test # Run all tests
128
- npm test -- src/path/to/test.ts # Run specific tests
129
152
  npm run test:coverage # Generate coverage report
130
153
 
131
154
  # Code Quality
132
155
  npm run lint # Run ESLint
133
156
  npm run format # Format with Prettier
134
- npm run typecheck # Check TypeScript types
135
157
  ```
136
158
 
159
+ ### Environment Variables
160
+
161
+ - `TRANSPORT_MODE`: Set to `stdio` or `http` (default: `http`)
162
+ - `PORT`: HTTP server port (default: `3000`)
163
+ - `DEBUG`: Enable debug logging (default: `false`)
164
+ - `IPAPI_API_TOKEN`: API token for ip-api.com (optional)
165
+
137
166
  ### Debugging Tools
138
167
 
139
168
  - **MCP Inspector**: Visual tool for testing your MCP tools
140
- - Run server with `npm run dev:server`
141
- - Open http://localhost:5173 in your browser
169
+ - Run server with `npm run mcp:inspect`
170
+ - Open the URL shown in terminal
171
+ - Test your tools interactively
142
172
 
143
- - **Server Logs**: Enable with `DEBUG=true npm run dev:server` or in config
173
+ - **Debug Logging**: Enable with `DEBUG=true` environment variable
144
174
 
145
175
  <details>
146
176
  <summary><b>Configuration (Click to expand)</b></summary>
@@ -152,7 +182,8 @@ Create `~/.mcp/configs.json`:
152
182
  "boilerplate": {
153
183
  "environments": {
154
184
  "DEBUG": "true",
155
- "ANY_OTHER_CONFIG": "value"
185
+ "TRANSPORT_MODE": "http",
186
+ "PORT": "3000"
156
187
  }
157
188
  }
158
189
  }
@@ -332,7 +363,7 @@ exampleTool.register(server);
332
363
 
333
364
  2. Update README.md with your tool documentation
334
365
  3. Build: `npm run build`
335
- 4. Test: `npm run start:server`
366
+ 4. Test: `npm run mcp:stdio` and `npm run mcp:http`
336
367
  5. Publish: `npm publish`
337
368
 
338
369
  ## Testing Best Practices
@@ -350,4 +381,4 @@ exampleTool.register(server);
350
381
 
351
382
  - [MCP Specification](https://github.com/modelcontextprotocol/mcp-spec)
352
383
  - [Official MCP Documentation](https://www.modelcontextprotocol.ai/)
353
- - [TypeScript Documentation](https://www.typescriptlang.org/docs/)
384
+ - [TypeScript Documentation](https://www.typescriptlang.org/docs/)
package/dist/index.d.ts CHANGED
@@ -2,8 +2,5 @@
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  /**
4
4
  * Start the MCP server with the specified transport mode
5
- *
6
- * @param mode The transport mode to use (stdio or sse)
7
- * @returns Promise that resolves to the server instance when started successfully
8
5
  */
9
- export declare function startServer(mode?: 'stdio' | 'sse'): Promise<McpServer>;
6
+ export declare function startServer(mode?: 'stdio' | 'http'): Promise<McpServer>;
package/dist/index.js CHANGED
@@ -6,111 +6,160 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.startServer = startServer;
8
8
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
9
+ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
9
10
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
10
11
  const logger_util_js_1 = require("./utils/logger.util.js");
11
12
  const config_util_js_1 = require("./utils/config.util.js");
12
- const error_util_js_1 = require("./utils/error.util.js");
13
13
  const constants_util_js_1 = require("./utils/constants.util.js");
14
14
  const index_js_1 = require("./cli/index.js");
15
- // Import tools
15
+ const express_1 = __importDefault(require("express"));
16
+ const cors_1 = __importDefault(require("cors"));
17
+ // Import tools and resources
16
18
  const ipaddress_tool_js_1 = __importDefault(require("./tools/ipaddress.tool.js"));
17
- // Import resources
18
19
  const ipaddress_resource_js_1 = __importDefault(require("./resources/ipaddress.resource.js"));
19
- /**
20
- * Boilerplate MCP Server
21
- *
22
- * A template project for building MCP servers that follow best practices.
23
- * Demonstrates proper structure, logging, error handling, and MCP protocol integration.
24
- */
25
- // Create file-level logger
26
- const indexLogger = logger_util_js_1.Logger.forContext('index.ts');
27
- // Log initialization at debug level
28
- indexLogger.debug('Boilerplate MCP server module loaded');
20
+ const logger = logger_util_js_1.Logger.forContext('index.ts');
29
21
  let serverInstance = null;
30
22
  let transportInstance = null;
31
23
  /**
32
24
  * Start the MCP server with the specified transport mode
33
- *
34
- * @param mode The transport mode to use (stdio or sse)
35
- * @returns Promise that resolves to the server instance when started successfully
36
25
  */
37
- async function startServer(mode = 'stdio') {
26
+ async function startServer(mode = 'http') {
38
27
  const serverLogger = logger_util_js_1.Logger.forContext('index.ts', 'startServer');
39
28
  // Load configuration
40
29
  serverLogger.info('Starting MCP server initialization...');
41
30
  config_util_js_1.config.load();
42
- serverLogger.info('Configuration loaded successfully');
43
- // Enable debug logging if DEBUG is set to true
44
31
  if (config_util_js_1.config.getBoolean('DEBUG')) {
45
32
  serverLogger.debug('Debug mode enabled');
46
33
  }
47
- // Log the DEBUG value to verify configuration loading
48
- serverLogger.debug(`DEBUG environment variable: ${process.env.DEBUG}`);
49
- serverLogger.debug(`IPAPI_API_TOKEN value exists: ${Boolean(process.env.IPAPI_API_TOKEN)}`);
50
- serverLogger.debug(`Config DEBUG value: ${config_util_js_1.config.get('DEBUG')}`);
51
34
  serverLogger.info(`Initializing Boilerplate MCP server v${constants_util_js_1.VERSION}`);
52
35
  serverInstance = new mcp_js_1.McpServer({
53
36
  name: constants_util_js_1.PACKAGE_NAME,
54
37
  version: constants_util_js_1.VERSION,
55
38
  });
39
+ // Register tools and resources
40
+ serverLogger.info('Registering MCP tools and resources...');
41
+ ipaddress_tool_js_1.default.registerTools(serverInstance);
42
+ ipaddress_resource_js_1.default.registerResources(serverInstance);
43
+ serverLogger.debug('All tools and resources registered');
56
44
  if (mode === 'stdio') {
57
- serverLogger.info('Using STDIO transport for MCP communication');
45
+ serverLogger.info('Using STDIO transport');
58
46
  transportInstance = new stdio_js_1.StdioServerTransport();
47
+ try {
48
+ await serverInstance.connect(transportInstance);
49
+ serverLogger.info('MCP server started successfully on STDIO transport');
50
+ setupGracefulShutdown();
51
+ return serverInstance;
52
+ }
53
+ catch (err) {
54
+ serverLogger.error('Failed to start server on STDIO transport', err);
55
+ process.exit(1);
56
+ }
59
57
  }
60
58
  else {
61
- throw (0, error_util_js_1.createUnexpectedError)('SSE mode is not supported yet');
62
- }
63
- // Register tools
64
- serverLogger.info('Registering MCP tools...');
65
- ipaddress_tool_js_1.default.registerTools(serverInstance);
66
- serverLogger.debug('Registered IP address tools');
67
- // Register resources
68
- serverLogger.info('Registering MCP resources...');
69
- ipaddress_resource_js_1.default.registerResources(serverInstance);
70
- serverLogger.debug('Registered IP address resources');
71
- serverLogger.info('All tools and resources registered successfully');
72
- try {
73
- serverLogger.info(`Connecting to ${mode.toUpperCase()} transport...`);
74
- await serverInstance.connect(transportInstance);
75
- serverLogger.info('MCP server started successfully and ready to process requests');
59
+ // HTTP transport with Express
60
+ serverLogger.info('Using Streamable HTTP transport');
61
+ const app = (0, express_1.default)();
62
+ app.use((0, cors_1.default)());
63
+ app.use(express_1.default.json());
64
+ const mcpEndpoint = '/mcp';
65
+ serverLogger.debug(`MCP endpoint: ${mcpEndpoint}`);
66
+ // Create transport instance
67
+ const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
68
+ // sessionIdGenerator is optional
69
+ sessionIdGenerator: undefined,
70
+ });
71
+ // Connect server to transport
72
+ await serverInstance.connect(transport);
73
+ transportInstance = transport;
74
+ // Handle all MCP requests
75
+ app.all(mcpEndpoint, (req, res) => {
76
+ transport
77
+ .handleRequest(req, res, req.body)
78
+ .catch((err) => {
79
+ serverLogger.error('Error in transport.handleRequest', err);
80
+ if (!res.headersSent) {
81
+ res.status(500).json({
82
+ error: 'Internal Server Error',
83
+ });
84
+ }
85
+ });
86
+ });
87
+ // Health check endpoint
88
+ app.get('/', (_req, res) => {
89
+ res.send(`Boilerplate MCP Server v${constants_util_js_1.VERSION} is running`);
90
+ });
91
+ // Start HTTP server
92
+ const PORT = Number(process.env.PORT ?? 3000);
93
+ await new Promise((resolve) => {
94
+ app.listen(PORT, () => {
95
+ serverLogger.info(`HTTP transport listening on http://localhost:${PORT}${mcpEndpoint}`);
96
+ resolve();
97
+ });
98
+ });
99
+ setupGracefulShutdown();
76
100
  return serverInstance;
77
101
  }
78
- catch (err) {
79
- serverLogger.error(`Failed to start server`, err);
80
- process.exit(1);
81
- }
82
102
  }
83
103
  /**
84
- * Main entry point - this will run when executed directly
85
- * Determines whether to run in CLI or server mode based on command-line arguments
104
+ * Main entry point
86
105
  */
87
106
  async function main() {
88
107
  const mainLogger = logger_util_js_1.Logger.forContext('index.ts', 'main');
89
108
  // Load configuration
90
109
  config_util_js_1.config.load();
91
- // Log the DEBUG value to verify configuration loading
92
- mainLogger.debug(`DEBUG environment variable: ${process.env.DEBUG}`);
93
- mainLogger.debug(`IPAPI_API_TOKEN value exists: ${Boolean(process.env.IPAPI_API_TOKEN)}`);
94
- mainLogger.debug(`Config DEBUG value: ${config_util_js_1.config.get('DEBUG')}`);
95
- // Check if arguments are provided (CLI mode)
110
+ // CLI mode - if any arguments are provided
96
111
  if (process.argv.length > 2) {
97
- // CLI mode: Pass arguments to CLI runner
98
- mainLogger.info('Starting in CLI mode');
112
+ mainLogger.info('CLI mode detected');
99
113
  await (0, index_js_1.runCli)(process.argv.slice(2));
100
- mainLogger.info('CLI execution completed');
114
+ return;
115
+ }
116
+ // Server mode - determine transport
117
+ const transportMode = (process.env.TRANSPORT_MODE || 'http').toLowerCase();
118
+ let mode;
119
+ if (transportMode === 'stdio') {
120
+ mode = 'stdio';
121
+ }
122
+ else if (transportMode === 'http') {
123
+ mode = 'http';
101
124
  }
102
125
  else {
103
- // MCP Server mode: Start server with default STDIO
104
- mainLogger.info('Starting in server mode');
105
- await startServer();
106
- mainLogger.info('Server is now running');
126
+ mainLogger.warn(`Unknown TRANSPORT_MODE "${transportMode}", defaulting to http`);
127
+ mode = 'http';
107
128
  }
129
+ mainLogger.info(`Starting server with ${mode.toUpperCase()} transport`);
130
+ await startServer(mode);
108
131
  }
109
- // If this file is being executed directly (not imported), run the main function
132
+ // Run main if executed directly
110
133
  if (require.main === module) {
111
134
  main().catch((err) => {
112
- const indexLogger = logger_util_js_1.Logger.forContext('index.ts'); // Re-create logger for catch
113
- indexLogger.error('Unhandled error in main process', err);
135
+ logger.error('Unhandled error in main process', err);
114
136
  process.exit(1);
115
137
  });
116
138
  }
139
+ /**
140
+ * Graceful shutdown handler
141
+ */
142
+ function setupGracefulShutdown() {
143
+ const shutdownLogger = logger_util_js_1.Logger.forContext('index.ts', 'shutdown');
144
+ const shutdown = async () => {
145
+ try {
146
+ shutdownLogger.info('Shutting down gracefully...');
147
+ if (transportInstance &&
148
+ 'close' in transportInstance &&
149
+ typeof transportInstance.close === 'function') {
150
+ await transportInstance.close();
151
+ }
152
+ if (serverInstance && typeof serverInstance.close === 'function') {
153
+ await serverInstance.close();
154
+ }
155
+ process.exit(0);
156
+ }
157
+ catch (err) {
158
+ shutdownLogger.error('Error during shutdown', err);
159
+ process.exit(1);
160
+ }
161
+ };
162
+ ['SIGINT', 'SIGTERM'].forEach((signal) => {
163
+ process.on(signal, shutdown);
164
+ });
165
+ }
@@ -8,7 +8,7 @@
8
8
  * Current application version
9
9
  * This should match the version in package.json
10
10
  */
11
- export declare const VERSION = "1.10.4";
11
+ export declare const VERSION = "1.11.0";
12
12
  /**
13
13
  * Package name with scope
14
14
  * Used for initialization and identification
@@ -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.10.4';
14
+ exports.VERSION = '1.11.0';
15
15
  /**
16
16
  * Package name with scope
17
17
  * Used for initialization and identification
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@aashari/boilerplate-mcp-server",
3
- "version": "1.10.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.",
3
+ "version": "1.11.0",
4
+ "description": "TypeScript MCP server boilerplate with STDIO and HTTP transport support, CLI tools, and extensible architecture",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "_moduleNotes": "Although source code uses ESM syntax, the build output target is CommonJS to align with Node.js compatibility and patterns seen in related MCP servers. tsconfig.json's 'module': 'NodeNext' handles the input syntax, while tsc outputs CJS.",
8
7
  "type": "commonjs",
9
8
  "repository": {
10
9
  "type": "git",
@@ -15,79 +14,75 @@
15
14
  },
16
15
  "scripts": {
17
16
  "build": "tsc",
18
- "prepare": "npm run build && chmod +x dist/index.js",
19
- "postinstall": "chmod +x dist/index.js || true",
17
+ "prepare": "npm run build && node scripts/ensure-executable.js",
18
+ "postinstall": "node scripts/ensure-executable.js",
19
+ "clean": "rm -rf dist coverage",
20
20
  "test": "jest",
21
21
  "test:coverage": "jest --coverage",
22
22
  "lint": "eslint src --ext .ts --config eslint.config.mjs",
23
23
  "format": "prettier --write 'src/**/*.ts' 'scripts/**/*.js'",
24
- "publish:npm": "npm publish",
25
- "update:check": "npx npm-check-updates",
26
- "update:deps": "npx npm-check-updates -u && npm install --legacy-peer-deps",
27
- "update:version": "node scripts/update-version.js",
28
- "dev:server": "DEBUG=true npm run build && npx @modelcontextprotocol/inspector -e DEBUG=true node dist/index.js",
29
- "dev:cli": "DEBUG=true npm run build && DEBUG=true node dist/index.js",
30
- "start:server": "npm run build && npx @modelcontextprotocol/inspector node dist/index.js",
31
- "start:cli": "npm run build && node dist/index.js"
24
+ "cli": "npm run build && node dist/index.js",
25
+ "mcp:stdio": "TRANSPORT_MODE=stdio npm run build && node dist/index.js",
26
+ "mcp:http": "TRANSPORT_MODE=http npm run build && node dist/index.js",
27
+ "mcp:inspect": "TRANSPORT_MODE=http npm run build && (node dist/index.js &) && sleep 2 && npx @modelcontextprotocol/inspector http://localhost:3000/mcp",
28
+ "dev:stdio": "npm run build && npx @modelcontextprotocol/inspector -e TRANSPORT_MODE=stdio -e DEBUG=true node dist/index.js",
29
+ "dev:http": "DEBUG=true TRANSPORT_MODE=http npm run build && node dist/index.js"
32
30
  },
33
31
  "keywords": [
34
32
  "mcp",
33
+ "model-context-protocol",
35
34
  "typescript",
36
35
  "claude",
37
36
  "anthropic",
38
37
  "ai",
38
+ "llm",
39
39
  "boilerplate",
40
40
  "server",
41
- "model-context-protocol",
42
- "tools",
43
- "resources",
44
- "tooling",
45
- "ai-integration",
46
- "mcp-server",
47
- "llm",
48
- "ai-connector",
49
- "external-tools",
41
+ "stdio",
42
+ "http",
43
+ "streamable",
50
44
  "cli",
51
- "mcp-inspector"
45
+ "mcp-server"
52
46
  ],
53
- "author": "",
47
+ "author": "Andi Ashari",
54
48
  "license": "ISC",
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ },
55
52
  "devDependencies": {
56
- "@eslint/js": "^9.28.0",
53
+ "@eslint/js": "^9.29.0",
57
54
  "@semantic-release/changelog": "^6.0.3",
58
55
  "@semantic-release/exec": "^7.1.0",
59
56
  "@semantic-release/git": "^10.0.1",
60
57
  "@semantic-release/github": "^11.0.3",
61
58
  "@semantic-release/npm": "^12.0.1",
62
- "@types/jest": "^29.5.14",
63
- "@types/node": "^22.15.29",
64
- "@typescript-eslint/eslint-plugin": "^8.33.0",
65
- "@typescript-eslint/parser": "^8.33.0",
66
- "eslint": "^9.28.0",
59
+ "@types/cors": "^2.8.19",
60
+ "@types/express": "^5.0.3",
61
+ "@types/jest": "^30.0.0",
62
+ "@types/node": "^24.0.3",
63
+ "@typescript-eslint/eslint-plugin": "^8.34.1",
64
+ "@typescript-eslint/parser": "^8.34.1",
65
+ "eslint": "^9.29.0",
67
66
  "eslint-config-prettier": "^10.1.5",
68
- "eslint-plugin-prettier": "^5.4.1",
69
- "jest": "^29.7.0",
70
- "nodemon": "^3.1.10",
71
- "npm-check-updates": "^18.0.1",
67
+ "eslint-plugin-prettier": "^5.5.0",
68
+ "jest": "^30.0.2",
72
69
  "prettier": "^3.5.3",
73
70
  "semantic-release": "^24.2.5",
74
- "ts-jest": "^29.3.4",
75
- "ts-node": "^10.9.2",
71
+ "ts-jest": "^29.4.0",
76
72
  "typescript": "^5.8.3",
77
- "typescript-eslint": "^8.33.0"
78
- },
79
- "publishConfig": {
80
- "registry": "https://registry.npmjs.org/",
81
- "access": "public"
73
+ "typescript-eslint": "^8.34.1"
82
74
  },
83
75
  "dependencies": {
84
- "@modelcontextprotocol/sdk": "^1.12.1",
76
+ "@modelcontextprotocol/sdk": "^1.13.0",
85
77
  "commander": "^14.0.0",
78
+ "cors": "^2.8.5",
86
79
  "dotenv": "^16.5.0",
87
- "zod": "^3.25.47"
80
+ "express": "^5.1.0",
81
+ "zod": "^3.25.67"
88
82
  },
89
- "directories": {
90
- "example": "examples"
83
+ "publishConfig": {
84
+ "registry": "https://registry.npmjs.org/",
85
+ "access": "public"
91
86
  },
92
87
  "jest": {
93
88
  "preset": "ts-jest",
@@ -97,18 +92,7 @@
97
92
  ],
98
93
  "collectCoverageFrom": [
99
94
  "src/**/*.ts",
100
- "!src/**/*.test.ts",
101
- "!src/**/*.spec.ts"
102
- ],
103
- "coveragePathIgnorePatterns": [
104
- "/node_modules/",
105
- "/dist/",
106
- "/coverage/"
107
- ],
108
- "coverageReporters": [
109
- "text",
110
- "lcov",
111
- "json-summary"
95
+ "!src/**/*.test.ts"
112
96
  ],
113
97
  "transform": {
114
98
  "^.+\\.tsx?$": [
@@ -123,14 +107,6 @@
123
107
  },
124
108
  "extensionsToTreatAsEsm": [
125
109
  ".ts"
126
- ],
127
- "moduleFileExtensions": [
128
- "ts",
129
- "tsx",
130
- "js",
131
- "jsx",
132
- "json",
133
- "node"
134
110
  ]
135
111
  }
136
112
  }
package/package.json.bak CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@aashari/boilerplate-mcp-server",
3
- "version": "1.10.3",
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.",
3
+ "version": "1.10.5",
4
+ "description": "TypeScript MCP server boilerplate with STDIO and HTTP transport support, CLI tools, and extensible architecture",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "_moduleNotes": "Although source code uses ESM syntax, the build output target is CommonJS to align with Node.js compatibility and patterns seen in related MCP servers. tsconfig.json's 'module': 'NodeNext' handles the input syntax, while tsc outputs CJS.",
8
7
  "type": "commonjs",
9
8
  "repository": {
10
9
  "type": "git",
@@ -15,79 +14,75 @@
15
14
  },
16
15
  "scripts": {
17
16
  "build": "tsc",
18
- "prepare": "npm run build && chmod +x dist/index.js",
19
- "postinstall": "chmod +x dist/index.js || true",
17
+ "prepare": "npm run build && node scripts/ensure-executable.js",
18
+ "postinstall": "node scripts/ensure-executable.js",
19
+ "clean": "rm -rf dist coverage",
20
20
  "test": "jest",
21
21
  "test:coverage": "jest --coverage",
22
22
  "lint": "eslint src --ext .ts --config eslint.config.mjs",
23
23
  "format": "prettier --write 'src/**/*.ts' 'scripts/**/*.js'",
24
- "publish:npm": "npm publish",
25
- "update:check": "npx npm-check-updates",
26
- "update:deps": "npx npm-check-updates -u && npm install --legacy-peer-deps",
27
- "update:version": "node scripts/update-version.js",
28
- "dev:server": "DEBUG=true npm run build && npx @modelcontextprotocol/inspector -e DEBUG=true node dist/index.js",
29
- "dev:cli": "DEBUG=true npm run build && DEBUG=true node dist/index.js",
30
- "start:server": "npm run build && npx @modelcontextprotocol/inspector node dist/index.js",
31
- "start:cli": "npm run build && node dist/index.js"
24
+ "cli": "npm run build && node dist/index.js",
25
+ "mcp:stdio": "TRANSPORT_MODE=stdio npm run build && node dist/index.js",
26
+ "mcp:http": "TRANSPORT_MODE=http npm run build && node dist/index.js",
27
+ "mcp:inspect": "TRANSPORT_MODE=http npm run build && (node dist/index.js &) && sleep 2 && npx @modelcontextprotocol/inspector http://localhost:3000/mcp",
28
+ "dev:stdio": "npm run build && npx @modelcontextprotocol/inspector -e TRANSPORT_MODE=stdio -e DEBUG=true node dist/index.js",
29
+ "dev:http": "DEBUG=true TRANSPORT_MODE=http npm run build && node dist/index.js"
32
30
  },
33
31
  "keywords": [
34
32
  "mcp",
33
+ "model-context-protocol",
35
34
  "typescript",
36
35
  "claude",
37
36
  "anthropic",
38
37
  "ai",
38
+ "llm",
39
39
  "boilerplate",
40
40
  "server",
41
- "model-context-protocol",
42
- "tools",
43
- "resources",
44
- "tooling",
45
- "ai-integration",
46
- "mcp-server",
47
- "llm",
48
- "ai-connector",
49
- "external-tools",
41
+ "stdio",
42
+ "http",
43
+ "streamable",
50
44
  "cli",
51
- "mcp-inspector"
45
+ "mcp-server"
52
46
  ],
53
- "author": "",
47
+ "author": "Andi Ashari",
54
48
  "license": "ISC",
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ },
55
52
  "devDependencies": {
56
- "@eslint/js": "^9.28.0",
53
+ "@eslint/js": "^9.29.0",
57
54
  "@semantic-release/changelog": "^6.0.3",
58
55
  "@semantic-release/exec": "^7.1.0",
59
56
  "@semantic-release/git": "^10.0.1",
60
57
  "@semantic-release/github": "^11.0.3",
61
58
  "@semantic-release/npm": "^12.0.1",
62
- "@types/jest": "^29.5.14",
63
- "@types/node": "^22.15.29",
64
- "@typescript-eslint/eslint-plugin": "^8.33.0",
65
- "@typescript-eslint/parser": "^8.33.0",
66
- "eslint": "^9.28.0",
59
+ "@types/cors": "^2.8.19",
60
+ "@types/express": "^5.0.3",
61
+ "@types/jest": "^30.0.0",
62
+ "@types/node": "^24.0.3",
63
+ "@typescript-eslint/eslint-plugin": "^8.34.1",
64
+ "@typescript-eslint/parser": "^8.34.1",
65
+ "eslint": "^9.29.0",
67
66
  "eslint-config-prettier": "^10.1.5",
68
- "eslint-plugin-prettier": "^5.4.1",
69
- "jest": "^29.7.0",
70
- "nodemon": "^3.1.10",
71
- "npm-check-updates": "^18.0.1",
67
+ "eslint-plugin-prettier": "^5.5.0",
68
+ "jest": "^30.0.2",
72
69
  "prettier": "^3.5.3",
73
70
  "semantic-release": "^24.2.5",
74
- "ts-jest": "^29.3.4",
75
- "ts-node": "^10.9.2",
71
+ "ts-jest": "^29.4.0",
76
72
  "typescript": "^5.8.3",
77
- "typescript-eslint": "^8.33.0"
78
- },
79
- "publishConfig": {
80
- "registry": "https://registry.npmjs.org/",
81
- "access": "public"
73
+ "typescript-eslint": "^8.34.1"
82
74
  },
83
75
  "dependencies": {
84
- "@modelcontextprotocol/sdk": "^1.12.1",
76
+ "@modelcontextprotocol/sdk": "^1.13.0",
85
77
  "commander": "^14.0.0",
78
+ "cors": "^2.8.5",
86
79
  "dotenv": "^16.5.0",
87
- "zod": "^3.25.47"
80
+ "express": "^5.1.0",
81
+ "zod": "^3.25.67"
88
82
  },
89
- "directories": {
90
- "example": "examples"
83
+ "publishConfig": {
84
+ "registry": "https://registry.npmjs.org/",
85
+ "access": "public"
91
86
  },
92
87
  "jest": {
93
88
  "preset": "ts-jest",
@@ -97,18 +92,7 @@
97
92
  ],
98
93
  "collectCoverageFrom": [
99
94
  "src/**/*.ts",
100
- "!src/**/*.test.ts",
101
- "!src/**/*.spec.ts"
102
- ],
103
- "coveragePathIgnorePatterns": [
104
- "/node_modules/",
105
- "/dist/",
106
- "/coverage/"
107
- ],
108
- "coverageReporters": [
109
- "text",
110
- "lcov",
111
- "json-summary"
95
+ "!src/**/*.test.ts"
112
96
  ],
113
97
  "transform": {
114
98
  "^.+\\.tsx?$": [
@@ -123,14 +107,6 @@
123
107
  },
124
108
  "extensionsToTreatAsEsm": [
125
109
  ".ts"
126
- ],
127
- "moduleFileExtensions": [
128
- "ts",
129
- "tsx",
130
- "js",
131
- "jsx",
132
- "json",
133
- "node"
134
110
  ]
135
111
  }
136
- }
112
+ }