cls-mcp-server 0.2.0 → 0.2.2
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 +10 -3
- package/dist/index.js +15 -4
- package/package.json +2 -2
package/README.md
CHANGED
@@ -10,7 +10,7 @@ Follow [Node.js](https://nodejs.org/) instructions to install Node.js.
|
|
10
10
|
|
11
11
|
### MCP Server Setup
|
12
12
|
|
13
|
-
#### Stdio
|
13
|
+
#### Stdio (Recommend)
|
14
14
|
|
15
15
|
To configure `cls-mcp-server` as an MCP service in stdio transport, add the following JSON configuration to your `mcpServers` settings:
|
16
16
|
|
@@ -39,9 +39,11 @@ To configure `cls-mcp-server` as an MCP service in stdio transport, add the foll
|
|
39
39
|
}
|
40
40
|
}
|
41
41
|
```
|
42
|
+
|
42
43
|
Go to [Environment value explanation](#environment-value-explanation) for detail explanation.
|
43
44
|
|
44
45
|
#### SSE
|
46
|
+
|
45
47
|
1. Create `.env` in current path, config environment values:
|
46
48
|
|
47
49
|
```
|
@@ -51,14 +53,17 @@ TENCENTCLOUD_SECRET_KEY=YOUR_TENCENT_SECRET_KEY
|
|
51
53
|
TENCENTCLOUD_API_BASE_HOST=tencentcloudapi.com
|
52
54
|
TENCENTCLOUD_REGION=ap-guangzhou
|
53
55
|
MAX_LENGTH=15000
|
56
|
+
PORT=3000
|
54
57
|
```
|
55
58
|
|
56
|
-
2. Run command
|
59
|
+
2. Run command to start sse server
|
60
|
+
|
57
61
|
```
|
58
|
-
|
62
|
+
npx -y cls-mcp-server
|
59
63
|
```
|
60
64
|
|
61
65
|
3. Config your `mcpServers` settings
|
66
|
+
|
62
67
|
```json
|
63
68
|
{
|
64
69
|
"mcpServers": {
|
@@ -85,3 +90,5 @@ Replace `TENCENTCLOUD_API_BASE_HOST` value if you need to change base host of Te
|
|
85
90
|
Replace `TENCENTCLOUD_REGION` value with your desired default region. Will only take effect if no region input from AI.
|
86
91
|
|
87
92
|
Replace `MAX_LENGTH` value to fit token length requirement of your AI model. If not provided, will send entire response to AI model.
|
93
|
+
|
94
|
+
Replace `PORT` value to change sse server port. Default `3000`. Will only take effect in sse transport.
|
package/dist/index.js
CHANGED
@@ -12,7 +12,7 @@ const express_1 = __importDefault(require("express"));
|
|
12
12
|
const tencentcloud_sdk_nodejs_cls_1 = require("tencentcloud-sdk-nodejs-cls");
|
13
13
|
const tencentcloud_sdk_nodejs_region_1 = require("tencentcloud-sdk-nodejs-region");
|
14
14
|
const zod_1 = require("zod");
|
15
|
-
console.log(process.env); // remove this after you've confirmed it is working
|
15
|
+
// console.log(process.env); // remove this after you've confirmed it is working
|
16
16
|
const ClsClient = tencentcloud_sdk_nodejs_cls_1.cls.v20201016.Client;
|
17
17
|
const RegionClient = tencentcloud_sdk_nodejs_region_1.region.v20220627.Client;
|
18
18
|
// Initialize MCP server
|
@@ -283,9 +283,15 @@ function main() {
|
|
283
283
|
if (transport === 'sse') {
|
284
284
|
const app = (0, express_1.default)();
|
285
285
|
let transport = null;
|
286
|
+
const port = process.env.PORT ? Number(process.env.PORT) : 3000;
|
286
287
|
app.get('/sse', (req, res) => {
|
287
288
|
transport = new sse_js_1.SSEServerTransport('/messages', res);
|
288
|
-
mcpServer
|
289
|
+
mcpServer
|
290
|
+
.connect(transport)
|
291
|
+
.then(() => {
|
292
|
+
console.log(`Started cls-mcp-server in sse transport on port ${port}.`);
|
293
|
+
})
|
294
|
+
.catch((error) => {
|
289
295
|
console.error('Fatal error in main():', error);
|
290
296
|
process.exit(error?.code || 1);
|
291
297
|
});
|
@@ -295,11 +301,16 @@ function main() {
|
|
295
301
|
transport.handlePostMessage(req, res);
|
296
302
|
}
|
297
303
|
});
|
298
|
-
app.listen(
|
304
|
+
app.listen(port);
|
299
305
|
}
|
300
306
|
else {
|
301
307
|
const stdioTransport = new stdio_js_1.StdioServerTransport();
|
302
|
-
mcpServer
|
308
|
+
mcpServer
|
309
|
+
.connect(stdioTransport)
|
310
|
+
.then(() => {
|
311
|
+
console.log(`Started cls-mcp-server in stdio transport.`);
|
312
|
+
})
|
313
|
+
.catch((error) => {
|
303
314
|
console.error('Fatal error in main():', error);
|
304
315
|
process.exit(error?.code || 1);
|
305
316
|
});
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "cls-mcp-server",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.2",
|
4
4
|
"main": "index.js",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
7
7
|
],
|
8
8
|
"bin": {
|
9
|
-
"cls-mcp-server": "
|
9
|
+
"cls-mcp-server": "dist/index.js"
|
10
10
|
},
|
11
11
|
"scripts": {
|
12
12
|
"build": "tsc && chmod 755 dist/index.js",
|