@aashari/boilerplate-mcp-server 1.0.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.
Files changed (41) hide show
  1. package/.eslintrc.json +19 -0
  2. package/.gitkeep +0 -0
  3. package/.node-version +1 -0
  4. package/.releaserc.json +34 -0
  5. package/CHANGELOG.md +107 -0
  6. package/README.md +357 -0
  7. package/dist/cli/index.d.ts +1 -0
  8. package/dist/cli/index.js +28 -0
  9. package/dist/cli/index.js.bak +28 -0
  10. package/dist/cli/ipaddress.cli.d.ts +10 -0
  11. package/dist/cli/ipaddress.cli.js +31 -0
  12. package/dist/controllers/ipaddress.controller.d.ts +7 -0
  13. package/dist/controllers/ipaddress.controller.js +33 -0
  14. package/dist/controllers/ipaddress.test.d.ts +1 -0
  15. package/dist/index.d.ts +6 -0
  16. package/dist/index.js +88 -0
  17. package/dist/index.js.bak +88 -0
  18. package/dist/resources/ipaddress.resource.d.ts +10 -0
  19. package/dist/resources/ipaddress.resource.js +37 -0
  20. package/dist/services/vendor.ip-api.com.service.d.ts +6 -0
  21. package/dist/services/vendor.ip-api.com.service.js +43 -0
  22. package/dist/services/vendor.ip-api.com.test.d.ts +1 -0
  23. package/dist/services/vendor.ip-api.com.type.d.ts +16 -0
  24. package/dist/services/vendor.ip-api.com.type.js +2 -0
  25. package/dist/tools/ipaddress.tool.d.ts +6 -0
  26. package/dist/tools/ipaddress.tool.js +33 -0
  27. package/dist/tools/ipaddress.type.d.ts +10 -0
  28. package/dist/tools/ipaddress.type.js +8 -0
  29. package/dist/utils/config.util.d.ts +43 -0
  30. package/dist/utils/config.util.js +116 -0
  31. package/dist/utils/error.util.d.ts +62 -0
  32. package/dist/utils/error.util.js +112 -0
  33. package/dist/utils/error.util.test.d.ts +1 -0
  34. package/dist/utils/logger.util.d.ts +9 -0
  35. package/dist/utils/logger.util.js +44 -0
  36. package/eslint.config.mjs +46 -0
  37. package/jest.config.mjs +19 -0
  38. package/package.json +88 -0
  39. package/package.json.bak +88 -0
  40. package/scripts/package.json +3 -0
  41. package/scripts/update-version.js +202 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": ["@typescript-eslint", "prettier"],
4
+ "extends": [
5
+ "eslint:recommended",
6
+ "plugin:@typescript-eslint/recommended",
7
+ "prettier"
8
+ ],
9
+ "rules": {
10
+ "prettier/prettier": ["error"],
11
+ "indent": ["error", "tab", { "SwitchCase": 1 }],
12
+ "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
13
+ },
14
+ "env": {
15
+ "node": true,
16
+ "jest": true
17
+ },
18
+ "ignorePatterns": ["node_modules/**", "dist/**", "examples/**"]
19
+ }
package/.gitkeep ADDED
File without changes
package/.node-version ADDED
@@ -0,0 +1 @@
1
+ 22.14.0
@@ -0,0 +1,34 @@
1
+ {
2
+ "branches": ["main"],
3
+ "plugins": [
4
+ "@semantic-release/commit-analyzer",
5
+ "@semantic-release/release-notes-generator",
6
+ "@semantic-release/changelog",
7
+ [
8
+ "@semantic-release/exec",
9
+ {
10
+ "prepareCmd": "node scripts/update-version.js ${nextRelease.version} && npm run build"
11
+ }
12
+ ],
13
+ [
14
+ "@semantic-release/npm",
15
+ {
16
+ "npmPublish": true,
17
+ "pkgRoot": "."
18
+ }
19
+ ],
20
+ [
21
+ "@semantic-release/git",
22
+ {
23
+ "assets": [
24
+ "package.json",
25
+ "CHANGELOG.md",
26
+ "src/index.ts",
27
+ "dist/index.js"
28
+ ],
29
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
30
+ }
31
+ ],
32
+ "@semantic-release/github"
33
+ ]
34
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,107 @@
1
+ # 1.0.0 (2025-03-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add workflows permission to semantic-release workflow ([de3a335](https://github.com/aashari/boilerplate-mcp-server/commit/de3a33510bd447af353444db1fcb58e1b1aa02e4))
7
+ * improve GitHub Packages publishing with a more robust approach ([fd2aec9](https://github.com/aashari/boilerplate-mcp-server/commit/fd2aec9926cf99d301cbb2b5f5ca961a6b6fec7e))
8
+ * improve GitHub Packages publishing with better error handling and debugging ([db25f04](https://github.com/aashari/boilerplate-mcp-server/commit/db25f04925e884349fcf3ab85316550fde231d1f))
9
+ * improve GITHUB_OUTPUT syntax in semantic-release workflow ([6f154bc](https://github.com/aashari/boilerplate-mcp-server/commit/6f154bc43f42475857e9256b0a671c3263dc9708))
10
+ * improve version detection for global installations ([97a95dc](https://github.com/aashari/boilerplate-mcp-server/commit/97a95dca61d8cd7a86c81bde4cb38c509b810dc0))
11
+ * make publish workflow more resilient against version conflicts ([ffd3705](https://github.com/aashari/boilerplate-mcp-server/commit/ffd3705bc064ee9135402052a0dc7fe32645714b))
12
+ * remove invalid workflows permission ([c012e46](https://github.com/aashari/boilerplate-mcp-server/commit/c012e46a29070c8394f7ab596fe7ba68c037d3a3))
13
+ * remove type module to fix CommonJS compatibility ([8b1f00c](https://github.com/aashari/boilerplate-mcp-server/commit/8b1f00c37467bc676ad8ec9ab672ba393ed084a9))
14
+ * resolve linter errors in version detection code ([5f1f33e](https://github.com/aashari/boilerplate-mcp-server/commit/5f1f33e88ae843b7a0d708899713be36fcd2ec2e))
15
+ * update examples to use correct API (greet instead of sayHello) ([7c062ca](https://github.com/aashari/boilerplate-mcp-server/commit/7c062ca42765c659f018f990f4b1ec563d1172d3))
16
+ * update release workflow to ensure correct versioning in compiled files ([a365394](https://github.com/aashari/boilerplate-mcp-server/commit/a365394b8596defa33ff5a44583d52e2c43f0aa3))
17
+ * update version display in CLI ([2b7846c](https://github.com/aashari/boilerplate-mcp-server/commit/2b7846cbfa023f4b1a8c81ec511370fa8f5aaf33))
18
+
19
+
20
+ ### Features
21
+
22
+ * add automated dependency management ([efa1b62](https://github.com/aashari/boilerplate-mcp-server/commit/efa1b6292e0e9b6efd0d43b40cf7099d50769487))
23
+ * add CLI usage examples for both JavaScript and TypeScript ([d5743b0](https://github.com/aashari/boilerplate-mcp-server/commit/d5743b07a6f2afe1c6cb0b03265228cba771e657))
24
+ * add support for custom name in greet command ([be48a05](https://github.com/aashari/boilerplate-mcp-server/commit/be48a053834a1d910877864608a5e9942d913367))
25
+ * add version update script and fix version display ([ec831d3](https://github.com/aashari/boilerplate-mcp-server/commit/ec831d3a3c966d858c15972365007f9dfd6115b8))
26
+ * implement review recommendations ([a23cbc0](https://github.com/aashari/boilerplate-mcp-server/commit/a23cbc0608a07e202396b3cd496c1f2078e304c1))
27
+ * implement testing, linting, and semantic versioning ([1d7710d](https://github.com/aashari/boilerplate-mcp-server/commit/1d7710dfa11fd1cb04ba3c604e9a2eb785652394))
28
+ * improve CI workflows with standardized Node.js version, caching, and dual publishing ([0dc9470](https://github.com/aashari/boilerplate-mcp-server/commit/0dc94705c81067d7ff63ab978ef9e6a6e3f75784))
29
+ * improve package structure and add better examples ([bd66891](https://github.com/aashari/boilerplate-mcp-server/commit/bd668915bde84445161cdbd55ff9da0b0af51944))
30
+
31
+
32
+ ### Reverts
33
+
34
+ * restore simple version handling ([bd0fadf](https://github.com/aashari/boilerplate-mcp-server/commit/bd0fadfa8207b4a7cf472c3b9f4ee63d8e36189d))
35
+
36
+ # [1.8.0](https://github.com/aashari/boilerplate-npm-package/compare/v1.7.2...v1.8.0) (2025-03-22)
37
+
38
+
39
+ ### Features
40
+
41
+ * add CLI usage examples for both JavaScript and TypeScript ([d5743b0](https://github.com/aashari/boilerplate-npm-package/commit/d5743b07a6f2afe1c6cb0b03265228cba771e657))
42
+
43
+ ## [1.7.2](https://github.com/aashari/boilerplate-npm-package/compare/v1.7.1...v1.7.2) (2025-03-22)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * update release workflow to ensure correct versioning in compiled files ([a365394](https://github.com/aashari/boilerplate-npm-package/commit/a365394b8596defa33ff5a44583d52e2c43f0aa3))
49
+
50
+ ## [1.7.1](https://github.com/aashari/boilerplate-npm-package/compare/v1.7.0...v1.7.1) (2025-03-22)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * update examples to use correct API (greet instead of sayHello) ([7c062ca](https://github.com/aashari/boilerplate-npm-package/commit/7c062ca42765c659f018f990f4b1ec563d1172d3))
56
+
57
+ # [1.7.0](https://github.com/aashari/boilerplate-npm-package/compare/v1.6.1...v1.7.0) (2025-03-22)
58
+
59
+
60
+ ### Features
61
+
62
+ * improve package structure and add better examples ([bd66891](https://github.com/aashari/boilerplate-npm-package/commit/bd668915bde84445161cdbd55ff9da0b0af51944))
63
+
64
+ ## [1.6.1](https://github.com/aashari/boilerplate-npm-package/compare/v1.6.0...v1.6.1) (2025-03-22)
65
+
66
+
67
+ ### Bug Fixes
68
+
69
+ * improve GitHub Packages publishing with better error handling and debugging ([db25f04](https://github.com/aashari/boilerplate-npm-package/commit/db25f04925e884349fcf3ab85316550fde231d1f))
70
+
71
+ # [1.6.0](https://github.com/aashari/boilerplate-npm-package/compare/v1.5.2...v1.6.0) (2025-03-22)
72
+
73
+
74
+ ### Features
75
+
76
+ * add support for custom name in greet command ([be48a05](https://github.com/aashari/boilerplate-npm-package/commit/be48a053834a1d910877864608a5e9942d913367))
77
+
78
+ ## [1.5.2](https://github.com/aashari/boilerplate-npm-package/compare/v1.5.1...v1.5.2) (2025-03-22)
79
+
80
+
81
+ ### Bug Fixes
82
+
83
+ * add workflows permission to semantic-release workflow ([de3a335](https://github.com/aashari/boilerplate-npm-package/commit/de3a33510bd447af353444db1fcb58e1b1aa02e4))
84
+ * improve GITHUB_OUTPUT syntax in semantic-release workflow ([6f154bc](https://github.com/aashari/boilerplate-npm-package/commit/6f154bc43f42475857e9256b0a671c3263dc9708))
85
+ * make publish workflow more resilient against version conflicts ([ffd3705](https://github.com/aashari/boilerplate-npm-package/commit/ffd3705bc064ee9135402052a0dc7fe32645714b))
86
+ * remove invalid workflows permission ([c012e46](https://github.com/aashari/boilerplate-npm-package/commit/c012e46a29070c8394f7ab596fe7ba68c037d3a3))
87
+
88
+ ## [1.5.2](https://github.com/aashari/boilerplate-npm-package/compare/v1.5.1...v1.5.2) (2025-03-22)
89
+
90
+
91
+ ### Bug Fixes
92
+
93
+ * make publish workflow more resilient against version conflicts ([ffd3705](https://github.com/aashari/boilerplate-npm-package/commit/ffd3705bc064ee9135402052a0dc7fe32645714b))
94
+
95
+ ## [1.5.1](https://github.com/aashari/boilerplate-npm-package/compare/v1.5.0...v1.5.1) (2025-03-22)
96
+
97
+
98
+ ### Bug Fixes
99
+
100
+ * improve GitHub Packages publishing with a more robust approach ([fd2aec9](https://github.com/aashari/boilerplate-npm-package/commit/fd2aec9926cf99d301cbb2b5f5ca961a6b6fec7e))
101
+
102
+ # [1.5.0](https://github.com/aashari/boilerplate-npm-package/compare/v1.4.7...v1.5.0) (2025-03-22)
103
+
104
+
105
+ ### Features
106
+
107
+ * improve CI workflows with standardized Node.js version, caching, and dual publishing ([0dc9470](https://github.com/aashari/boilerplate-npm-package/commit/0dc94705c81067d7ff63ab978ef9e6a6e3f75784))
package/README.md ADDED
@@ -0,0 +1,357 @@
1
+ # Boilerplate MCP Server
2
+
3
+ A boilerplate Model Context Protocol (MCP) server implementation using TypeScript. This project demonstrates how to build a well-structured MCP server that exposes both tools and resources to AI applications like Claude Desktop. It serves as a starting point for developers building MCP-compatible servers with a focus on clean architecture, automated workflows, and easy deployment.
4
+
5
+ ## Core Features
6
+
7
+ - **STDIO MCP Server**: Designed for AI clients like Claude Desktop, providing tools and resources via the Model Context Protocol.
8
+ - **CLI Support**: Human-friendly command-line interface for the same functionality, making it easy to test and use directly.
9
+ - **IP Address Lookup**: Get details about any IP address or your current device's IP.
10
+ - **Flexible Configuration**: Support for environment variables, .env files, and global config files.
11
+ - **Testing & Development Tools**: Built-in inspection, testing, and development utilities.
12
+
13
+ ## Installation
14
+
15
+ ### Global Installation
16
+
17
+ You can install this package globally to use as a CLI tool:
18
+
19
+ ```bash
20
+ npm install -g @aashari/boilerplate-mcp-server
21
+ ```
22
+
23
+ After global installation, you can run the CLI commands directly:
24
+
25
+ ```bash
26
+ # Get help
27
+ mcp-server --help
28
+
29
+ # Get current IP details
30
+ mcp-server get-ip-details
31
+
32
+ # Get details for a specific IP
33
+ mcp-server get-ip-details 8.8.8.8
34
+ ```
35
+
36
+ ### Local Installation
37
+
38
+ For development or local use, clone the repository and install dependencies:
39
+
40
+ ```bash
41
+ git clone https://github.com/aashari/boilerplate-mcp-server.git
42
+ cd boilerplate-mcp-server
43
+ npm install
44
+ ```
45
+
46
+ Then run the development server:
47
+
48
+ ```bash
49
+ npm run dev
50
+ ```
51
+
52
+ Or build and start:
53
+
54
+ ```bash
55
+ npm run build
56
+ npm start
57
+ ```
58
+
59
+ ## Developer Tools
60
+
61
+ This project includes several scripts to make development easier:
62
+
63
+ ```bash
64
+ # Run tests
65
+ npm test
66
+
67
+ # Check test coverage
68
+ npm run test:coverage
69
+
70
+ # Run linting
71
+ npm run lint
72
+
73
+ # Format code
74
+ npm run format
75
+
76
+ # Run the server with live reload during development
77
+ npm run dev
78
+
79
+ # Use the MCP Inspector to visually test your server
80
+ npm run inspect
81
+
82
+ # Use the MCP Inspector with debug mode enabled
83
+ npm run inspect:debug
84
+ ```
85
+
86
+ ## Configuration Options for End Users
87
+
88
+ Before setting up with Claude Desktop or Cursor AI, you can configure the server. There are two recommended options for end users:
89
+
90
+ ### Option 1: Direct Configuration in Claude/Cursor
91
+
92
+ Pass your configuration directly in the Claude Desktop config or Cursor AI command:
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "aashari/boilerplate-mcp-server": {
98
+ "command": "npx",
99
+ "args": [
100
+ "-y",
101
+ "DEBUG=true",
102
+ "IPAPI_API_TOKEN=your_token",
103
+ "@aashari/boilerplate-mcp-server"
104
+ ]
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ ### Option 2: Global Configuration File (Recommended)
111
+
112
+ 1. Create a global configuration file at `$HOME/.mcp/configs.json`:
113
+
114
+ ```json
115
+ {
116
+ "@aashari/boilerplate-mcp-server": {
117
+ "environments": {
118
+ "DEBUG": "true",
119
+ "IPAPI_API_TOKEN": "your_token"
120
+ }
121
+ }
122
+ }
123
+ ```
124
+
125
+ 2. Then use a simplified configuration in Claude Desktop or Cursor AI:
126
+
127
+ ```json
128
+ {
129
+ "mcpServers": {
130
+ "aashari/boilerplate-mcp-server": {
131
+ "command": "npx",
132
+ "args": ["-y", "@aashari/boilerplate-mcp-server"]
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ This approach keeps your configuration in one secure location and simplifies your AI assistant setup.
139
+
140
+ ### Available Configuration Options
141
+
142
+ - **DEBUG**: Set to `true` to enable debug logging.
143
+ - **IPAPI_API_TOKEN**: API token for the IP API service (if required).
144
+
145
+ ## Setting Up with Claude Desktop
146
+
147
+ To use this MCP server with Claude Desktop:
148
+
149
+ 1. **Open Claude Desktop Settings**:
150
+
151
+ - Launch Claude Desktop
152
+ - Click on the settings icon (gear) in the top-right corner
153
+
154
+ 2. **Edit MCP Configuration**:
155
+
156
+ - Click on "Edit Config" button
157
+ - This will open File Explorer/Finder with the `claude_desktop_config.json` file
158
+
159
+ 3. **Update Configuration File**:
160
+
161
+ - Add one of the configuration options from above to the file
162
+ - Save the file
163
+
164
+ Example with global configuration file already set up:
165
+
166
+ ```json
167
+ {
168
+ "mcpServers": {
169
+ "aashari/boilerplate-mcp-server": {
170
+ "command": "npx",
171
+ "args": ["-y", "@aashari/boilerplate-mcp-server"]
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ 4. **Restart Claude Desktop**:
178
+
179
+ - Close and reopen Claude Desktop to apply the changes
180
+
181
+ 5. **Verify Tool Availability**:
182
+
183
+ - On the Claude home page, look for the hammer icon on the right side
184
+ - Click it to see available tools
185
+ - Ensure the `get-ip-details` tool is listed
186
+
187
+ 6. **Test the Tool**:
188
+
189
+ - Try asking Claude: "give me my public IP" or "analyze this IP: 8.8.8.8"
190
+ - Claude will use the MCP tool to fetch and display the requested information
191
+
192
+ ## Setting Up with Cursor AI
193
+
194
+ To use this MCP server with Cursor AI:
195
+
196
+ 1. **Open Cursor Settings**:
197
+
198
+ - Launch Cursor
199
+ - Press `CMD + SHIFT + P` (or `CTRL + SHIFT + P` on Windows)
200
+ - Type "settings" and select "Cursor Settings"
201
+ - On the sidebar, select "MCP"
202
+
203
+ 2. **Add New MCP Server**:
204
+
205
+ - Click "+ Add new MCP server"
206
+ - A configuration form will appear
207
+
208
+ 3. **Configure MCP Server**:
209
+
210
+ - **Name**: Enter `aashari/boilerplate-mcp-server`
211
+ - **Type**: Select `command` from the dropdown
212
+ - **Command**: Choose one of the following based on your configuration approach:
213
+
214
+ If using global configuration file (recommended):
215
+
216
+ ```
217
+ npx -y @aashari/boilerplate-mcp-server
218
+ ```
219
+
220
+ If passing configuration directly:
221
+
222
+ ```
223
+ DEBUG=true IPAPI_API_TOKEN=your_token npx -y @aashari/boilerplate-mcp-server
224
+ ```
225
+
226
+ - Click "Add"
227
+
228
+ 4. **Verify Server Configuration**:
229
+
230
+ - The server should now be listed with a green indicator
231
+ - You should see the `get_ip_details` tool listed under the server
232
+
233
+ 5. **Test the Tool**:
234
+
235
+ - In the chat sidebar, ensure Agent mode is active
236
+ - Try asking: "give me my public IP" or "analyze this IP: 8.8.8.8"
237
+ - Cursor AI will use the MCP tool to fetch and display the requested information
238
+
239
+ ## Using as a CLI Tool
240
+
241
+ The package can also be used as a command-line tool for human interaction:
242
+
243
+ - **Get help and available commands**:
244
+
245
+ ```bash
246
+ npx -y @aashari/boilerplate-mcp-server --help
247
+ ```
248
+
249
+ Example output:
250
+
251
+ ```
252
+ Usage: @aashari/boilerplate-mcp-server [options] [command]
253
+
254
+ A boilerplate Model Context Protocol (MCP) server implementation using TypeScript
255
+
256
+ Options:
257
+ -V, --version output the version number
258
+ -h, --help display help for command
259
+
260
+ Commands:
261
+ get-ip-details [ipAddress] Get details about a specific IP address or the current device
262
+ help [command] display help for command
263
+ ```
264
+
265
+ - **Get current device IP details**:
266
+
267
+ ```bash
268
+ npx -y @aashari/boilerplate-mcp-server get-ip-details
269
+ ```
270
+
271
+ Example output:
272
+
273
+ ```
274
+ status: success
275
+ country: Indonesia
276
+ countryCode: ID
277
+ region: JK
278
+ regionName: Jakarta
279
+ city: Jakarta
280
+ zip: 11730
281
+ lat: -6.2114
282
+ lon: 106.8446
283
+ timezone: Asia/Jakarta
284
+ isp: Biznet Wifi
285
+ org:
286
+ as: AS17451 BIZNET NETWORKS
287
+ query: 118.99.106.135
288
+ ```
289
+
290
+ - **Get details for a specific IP address**:
291
+
292
+ ```bash
293
+ npx -y @aashari/boilerplate-mcp-server get-ip-details 8.8.8.8
294
+ ```
295
+
296
+ Example output:
297
+
298
+ ```
299
+ status: success
300
+ country: United States
301
+ countryCode: US
302
+ region: VA
303
+ regionName: Virginia
304
+ city: Ashburn
305
+ zip: 20149
306
+ lat: 39.03
307
+ lon: -77.5
308
+ timezone: America/New_York
309
+ isp: Google LLC
310
+ org: Google Public DNS
311
+ as: AS15169 Google LLC
312
+ query: 8.8.8.8
313
+ ```
314
+
315
+ ## For Developers
316
+
317
+ ### MCP Inspector Usage
318
+
319
+ This project includes integration with MCP Inspector for easy debugging and testing:
320
+
321
+ ```bash
322
+ # Launch the MCP Inspector with your server
323
+ npm run inspect
324
+
325
+ # Launch with debug mode enabled
326
+ npm run inspect:debug
327
+ ```
328
+
329
+ When you run the inspector:
330
+
331
+ 1. The Inspector will start your MCP server
332
+ 2. It will launch a web UI (typically at http://localhost:5173)
333
+ 3. You can use the UI to interact with your server and test its functionality
334
+
335
+ The inspector provides a visual way to see:
336
+
337
+ - Your server's tools and resources
338
+ - The requests and responses between client and server
339
+ - Any errors that occur during communication
340
+
341
+ ## About MCP
342
+
343
+ The Model Context Protocol (MCP) is an open standard developed by Anthropic to simplify how AI systems connect to external data sources and tools. For detailed information, including core concepts, architecture, and implementation guides, please refer to the [official MCP documentation](https://modelcontextprotocol.io/docs/).
344
+
345
+ ## Extending This Project
346
+
347
+ To add your own tools and resources:
348
+
349
+ 1. Create service files in the `src/services` directory
350
+ 2. Implement controllers in `src/controllers`
351
+ 3. Create tool implementations in `src/tools`
352
+ 4. Create resource implementations in `src/resources`
353
+ 5. Register your new tools and resources in `src/index.ts`
354
+
355
+ ## License
356
+
357
+ [ISC](https://opensource.org/licenses/ISC)
@@ -0,0 +1 @@
1
+ export declare function runCli(args: string[]): Promise<void>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runCli = runCli;
7
+ const commander_1 = require("commander");
8
+ const logger_util_js_1 = require("../utils/logger.util.js");
9
+ const ipaddress_cli_js_1 = __importDefault(require("./ipaddress.cli.js"));
10
+ // Get the version from package.json
11
+ const VERSION = '1.0.0'; // This should match the version in src/index.ts
12
+ const NAME = '@aashari/boilerplate-mcp-server';
13
+ const DESCRIPTION = 'A boilerplate Model Context Protocol (MCP) server implementation using TypeScript';
14
+ async function runCli(args) {
15
+ const program = new commander_1.Command();
16
+ program.name(NAME).description(DESCRIPTION).version(VERSION);
17
+ // Register CLI commands
18
+ ipaddress_cli_js_1.default.register(program);
19
+ // Handle unknown commands
20
+ program.on('command:*', (operands) => {
21
+ logger_util_js_1.logger.error(`[src/cli/index.ts] Unknown command: ${operands[0]}`);
22
+ console.log('');
23
+ program.help();
24
+ process.exit(1);
25
+ });
26
+ // Parse arguments; default to help if no command provided
27
+ await program.parseAsync(args.length ? args : ['--help'], { from: 'user' });
28
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runCli = runCli;
7
+ const commander_1 = require("commander");
8
+ const logger_util_js_1 = require("../utils/logger.util.js");
9
+ const ipaddress_cli_js_1 = __importDefault(require("./ipaddress.cli.js"));
10
+ // Get the version from package.json
11
+ const VERSION = '1.1.0'; // This should match the version in src/index.ts
12
+ const NAME = '@aashari/boilerplate-mcp-server';
13
+ const DESCRIPTION = 'A boilerplate Model Context Protocol (MCP) server implementation using TypeScript';
14
+ async function runCli(args) {
15
+ const program = new commander_1.Command();
16
+ program.name(NAME).description(DESCRIPTION).version(VERSION);
17
+ // Register CLI commands
18
+ ipaddress_cli_js_1.default.register(program);
19
+ // Handle unknown commands
20
+ program.on('command:*', (operands) => {
21
+ logger_util_js_1.logger.error(`[src/cli/index.ts] Unknown command: ${operands[0]}`);
22
+ console.log('');
23
+ program.help();
24
+ process.exit(1);
25
+ });
26
+ // Parse arguments; default to help if no command provided
27
+ await program.parseAsync(args.length ? args : ['--help'], { from: 'user' });
28
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Register IP address CLI commands
4
+ * @param program The Commander program instance
5
+ */
6
+ declare function register(program: Command): void;
7
+ declare const _default: {
8
+ register: typeof register;
9
+ };
10
+ export default _default;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const logger_util_js_1 = require("../utils/logger.util.js");
7
+ const error_util_js_1 = require("../utils/error.util.js");
8
+ const ipaddress_controller_js_1 = __importDefault(require("../controllers/ipaddress.controller.js"));
9
+ /**
10
+ * Register IP address CLI commands
11
+ * @param program The Commander program instance
12
+ */
13
+ function register(program) {
14
+ logger_util_js_1.logger.debug(`[src/cli/ipaddress.cli.ts@register] Registering IP address CLI commands...`);
15
+ program
16
+ .command('get-ip-details')
17
+ .description('Get details about a specific IP address or the current device')
18
+ .argument('[ipAddress]', 'IP address to lookup (optional)')
19
+ .action(async (ipAddress) => {
20
+ try {
21
+ logger_util_js_1.logger.debug(`[src/cli/ipaddress.cli.ts@get-ip-details] Fetching IP details for ${ipAddress || 'current device'}...`);
22
+ const result = await ipaddress_controller_js_1.default.get(ipAddress);
23
+ logger_util_js_1.logger.debug(`[src/cli/ipaddress.cli.ts@get-ip-details] IP details fetched successfully`, result);
24
+ console.log(result.content);
25
+ }
26
+ catch (error) {
27
+ (0, error_util_js_1.handleCliError)(error);
28
+ }
29
+ });
30
+ }
31
+ exports.default = { register };
@@ -0,0 +1,7 @@
1
+ declare function get(ipAddress?: string): Promise<{
2
+ content: string;
3
+ }>;
4
+ declare const _default: {
5
+ get: typeof get;
6
+ };
7
+ export default _default;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const vendor_ip_api_com_service_js_1 = __importDefault(require("../services/vendor.ip-api.com.service.js"));
7
+ const logger_util_js_1 = require("../utils/logger.util.js");
8
+ const error_util_js_1 = require("../utils/error.util.js");
9
+ async function get(ipAddress) {
10
+ logger_util_js_1.logger.debug(`[src/controllers/ipaddress.controller.ts@get] Getting IP address details...`);
11
+ try {
12
+ const ipData = await vendor_ip_api_com_service_js_1.default.get(ipAddress);
13
+ logger_util_js_1.logger.debug(`[src/controllers/ipaddress.controller.ts@get] Got the response from the service`, ipData);
14
+ const lines = [];
15
+ for (const [key, value] of Object.entries(ipData)) {
16
+ lines.push(`${key}: ${value}`);
17
+ }
18
+ return {
19
+ content: lines.join('\n'),
20
+ };
21
+ }
22
+ catch (error) {
23
+ // Log the error
24
+ logger_util_js_1.logger.error(`[src/controllers/ipaddress.controller.ts@get] Error getting IP details`, error);
25
+ // Pass McpErrors through
26
+ if (error instanceof error_util_js_1.McpError) {
27
+ throw error;
28
+ }
29
+ // Wrap other errors
30
+ throw (0, error_util_js_1.createUnexpectedError)('Failed to get IP address details', error);
31
+ }
32
+ }
33
+ exports.default = { get };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { logger } from './utils/logger.util.js';
3
+ import { config } from './utils/config.util.js';
4
+ export declare function startServer(mode?: 'stdio' | 'sse'): Promise<void>;
5
+ export { logger, config };
6
+ export * from './utils/error.util.js';