create-mcp-kit 0.1.2 → 0.1.4
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/package.json +2 -2
- package/template/client-js/package.json.hbs +11 -11
- package/template/client-js/vitest.config.js.hbs +1 -6
- package/template/client-ts/package.json.hbs +13 -13
- package/template/client-ts/vitest.config.ts.hbs +1 -6
- package/template/server-js/package.json.hbs +12 -12
- package/template/server-js/scripts/base.js.hbs +12 -8
- package/template/server-js/src/assets/mcp.json +17 -0
- package/template/server-js/src/services/index.js.hbs +1 -1
- package/template/server-js/src/services/web.js.hbs +7 -0
- package/template/server-js/vitest.config.js.hbs +1 -6
- package/template/server-js/vitest.setup.js.hbs +1 -1
- package/template/server-ts/package.json.hbs +16 -16
- package/template/server-ts/scripts/base.js.hbs +12 -8
- package/template/server-ts/src/assets/mcp.json +17 -0
- package/template/server-ts/src/services/index.ts.hbs +1 -1
- package/template/server-ts/src/services/web.ts.hbs +7 -0
- package/template/server-ts/vitest.config.ts.hbs +1 -6
- package/template/server-ts/vitest.setup.ts.hbs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mcp-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A CLI tool to create MCP (Model Context Protocol) applications with ease.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "zhensherlock",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"gradient-string": "^3.0.0",
|
|
49
49
|
"handlebars": "^4.7.8",
|
|
50
50
|
"picocolors": "^1.1.1",
|
|
51
|
-
"@mcp-tool-kit/shared": "^0.1.
|
|
51
|
+
"@mcp-tool-kit/shared": "^0.1.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {},
|
|
54
54
|
"scripts": {
|
|
@@ -27,40 +27,40 @@
|
|
|
27
27
|
"prepare": "husky"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.21.0",
|
|
31
31
|
"dotenv": "^17.2.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
{{#if (includes plugins 'commitlint')}}
|
|
35
|
-
"@commitlint/cli": "^
|
|
36
|
-
"@commitlint/config-conventional": "^
|
|
35
|
+
"@commitlint/cli": "^20.1.0",
|
|
36
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
37
37
|
{{/if}}
|
|
38
38
|
{{#if (includes plugins 'vitest')}}
|
|
39
|
-
"@vitest/coverage-v8": "^
|
|
39
|
+
"@vitest/coverage-v8": "^4.0.6",
|
|
40
40
|
{{/if}}
|
|
41
41
|
{{#if (includes plugins 'changelog')}}
|
|
42
42
|
"compare-func": "^2.0.0",
|
|
43
43
|
{{/if}}
|
|
44
44
|
{{#if (includes plugins 'changelog')}}
|
|
45
|
-
"conventional-changelog-angular": "^8.
|
|
45
|
+
"conventional-changelog-angular": "^8.1.0",
|
|
46
46
|
"conventional-changelog-cli": "^5.0.0",
|
|
47
47
|
{{/if}}
|
|
48
48
|
"cross-env": "^10.1.0",
|
|
49
|
-
"esbuild": "^0.25.
|
|
49
|
+
"esbuild": "^0.25.12",
|
|
50
50
|
{{#if (includes plugins 'style')}}
|
|
51
|
-
"eslint": "^9.
|
|
51
|
+
"eslint": "^9.39.1",
|
|
52
52
|
"eslint-plugin-import": "^2.32.0",
|
|
53
53
|
"eslint-plugin-prettier": "^5.5.4",
|
|
54
|
-
"globals": "^16.
|
|
54
|
+
"globals": "^16.5.0",
|
|
55
55
|
{{/if}}
|
|
56
56
|
"husky": "^9.1.7",
|
|
57
57
|
{{#if (includes plugins 'style')}}
|
|
58
|
-
"lint-staged": "^16.2.
|
|
58
|
+
"lint-staged": "^16.2.6",
|
|
59
59
|
"prettier": "^3.6.2",
|
|
60
60
|
{{/if}}
|
|
61
61
|
{{#if (includes plugins 'vitest')}}
|
|
62
|
-
"vitest": "^
|
|
62
|
+
"vitest": "^4.0.6",
|
|
63
63
|
{{/if}}
|
|
64
|
-
"rimraf": "^6.0
|
|
64
|
+
"rimraf": "^6.1.0"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -27,47 +27,47 @@
|
|
|
27
27
|
"prepare": "husky"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.21.0",
|
|
31
31
|
"dotenv": "^17.2.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
{{#if (includes plugins 'commitlint')}}
|
|
35
|
-
"@commitlint/cli": "^
|
|
36
|
-
"@commitlint/config-conventional": "^
|
|
35
|
+
"@commitlint/cli": "^20.1.0",
|
|
36
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
37
37
|
{{/if}}
|
|
38
38
|
{{#if (includes plugins 'style')}}
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
40
|
-
"@typescript-eslint/parser": "^8.46.
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
40
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
41
41
|
{{/if}}
|
|
42
42
|
{{#if (includes plugins 'vitest')}}
|
|
43
|
-
"@vitest/coverage-v8": "^
|
|
43
|
+
"@vitest/coverage-v8": "^4.0.6",
|
|
44
44
|
{{/if}}
|
|
45
45
|
{{#if (includes plugins 'changelog')}}
|
|
46
46
|
"compare-func": "^2.0.0",
|
|
47
47
|
{{/if}}
|
|
48
48
|
"concurrently": "^9.2.1",
|
|
49
49
|
{{#if (includes plugins 'changelog')}}
|
|
50
|
-
"conventional-changelog-angular": "^8.
|
|
50
|
+
"conventional-changelog-angular": "^8.1.0",
|
|
51
51
|
"conventional-changelog-cli": "^5.0.0",
|
|
52
52
|
{{/if}}
|
|
53
53
|
"cross-env": "^10.1.0",
|
|
54
|
-
"esbuild": "^0.25.
|
|
54
|
+
"esbuild": "^0.25.12",
|
|
55
55
|
{{#if (includes plugins 'style')}}
|
|
56
|
-
"eslint": "^9.
|
|
56
|
+
"eslint": "^9.39.1",
|
|
57
57
|
"eslint-plugin-import": "^2.32.0",
|
|
58
58
|
"eslint-plugin-prettier": "^5.5.4",
|
|
59
|
-
"globals": "^16.
|
|
59
|
+
"globals": "^16.5.0",
|
|
60
60
|
{{/if}}
|
|
61
61
|
"husky": "^9.1.7",
|
|
62
62
|
{{#if (includes plugins 'style')}}
|
|
63
|
-
"lint-staged": "^16.2.
|
|
63
|
+
"lint-staged": "^16.2.6",
|
|
64
64
|
"prettier": "^3.6.2",
|
|
65
65
|
{{/if}}
|
|
66
66
|
"tsx": "^4.20.6",
|
|
67
67
|
"typescript": "^5.9.3",
|
|
68
68
|
{{#if (includes plugins 'vitest')}}
|
|
69
|
-
"vitest": "^
|
|
69
|
+
"vitest": "^4.0.6",
|
|
70
70
|
{{/if}}
|
|
71
|
-
"rimraf": "^6.0
|
|
71
|
+
"rimraf": "^6.1.0"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"prepare": "husky"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.21.0",
|
|
45
45
|
"dotenv": "^17.2.3",
|
|
46
46
|
{{#if (or (includes transports 'streamable') (includes transports 'sse'))}}
|
|
47
47
|
"express": "^5.1.0",
|
|
@@ -52,34 +52,34 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
{{#if (includes plugins 'commitlint')}}
|
|
55
|
-
"@commitlint/cli": "^
|
|
56
|
-
"@commitlint/config-conventional": "^
|
|
55
|
+
"@commitlint/cli": "^20.1.0",
|
|
56
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
57
57
|
{{/if}}
|
|
58
58
|
{{#if (includes plugins 'inspector')}}
|
|
59
|
-
"@modelcontextprotocol/inspector": "^0.
|
|
59
|
+
"@modelcontextprotocol/inspector": "^0.17.2",
|
|
60
60
|
{{/if}}
|
|
61
61
|
{{#if (includes plugins 'vitest')}}
|
|
62
|
-
"@vitest/coverage-v8": "^
|
|
62
|
+
"@vitest/coverage-v8": "^4.0.14",
|
|
63
63
|
"c8": "^10.1.3",
|
|
64
64
|
{{/if}}
|
|
65
65
|
{{#if (includes plugins 'changelog')}}
|
|
66
66
|
"compare-func": "^2.0.0",
|
|
67
67
|
{{/if}}
|
|
68
68
|
{{#if (includes plugins 'changelog')}}
|
|
69
|
-
"conventional-changelog-angular": "^8.
|
|
69
|
+
"conventional-changelog-angular": "^8.1.0",
|
|
70
70
|
"conventional-changelog-cli": "^5.0.0",
|
|
71
71
|
{{/if}}
|
|
72
72
|
"cross-env": "^10.1.0",
|
|
73
|
-
"esbuild": "^0.25.
|
|
73
|
+
"esbuild": "^0.25.12",
|
|
74
74
|
{{#if (includes plugins 'style')}}
|
|
75
|
-
"eslint": "^9.
|
|
75
|
+
"eslint": "^9.39.1",
|
|
76
76
|
"eslint-plugin-import": "^2.32.0",
|
|
77
77
|
"eslint-plugin-prettier": "^5.5.3",
|
|
78
|
-
"globals": "^16.
|
|
78
|
+
"globals": "^16.5.0",
|
|
79
79
|
{{/if}}
|
|
80
80
|
"husky": "^9.1.7",
|
|
81
81
|
{{#if (includes plugins 'style')}}
|
|
82
|
-
"lint-staged": "^16.2.
|
|
82
|
+
"lint-staged": "^16.2.6",
|
|
83
83
|
{{/if}}
|
|
84
84
|
{{#if (includes plugins 'vitest')}}
|
|
85
85
|
"nyc": "^17.1.0",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"tree-kill": "^1.2.2",
|
|
92
92
|
{{/if}}
|
|
93
93
|
{{#if (includes plugins 'vitest')}}
|
|
94
|
-
"vitest": "^
|
|
94
|
+
"vitest": "^4.0.14",
|
|
95
95
|
{{/if}}
|
|
96
|
-
"rimraf": "^6.0
|
|
96
|
+
"rimraf": "^6.1.0"
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -64,15 +64,19 @@ const after = async result => {
|
|
|
64
64
|
if (inspectorProcess) {
|
|
65
65
|
kill(inspectorProcess.pid, 'SIGINT')
|
|
66
66
|
}
|
|
67
|
-
inspectorProcess = spawn(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
inspectorProcess = spawn(
|
|
68
|
+
'npx',
|
|
69
|
+
['@modelcontextprotocol/inspector', '--config', './src/assets/mcp.json', '--server', 'mcp-stdio'],
|
|
70
|
+
{
|
|
71
|
+
stdio: 'inherit',
|
|
72
|
+
shell: true,
|
|
73
|
+
env: {
|
|
74
|
+
...process.env,
|
|
75
|
+
DANGEROUSLY_OMIT_AUTH: true,
|
|
76
|
+
MCP_AUTO_OPEN_ENABLED: autoOpenBrowser,
|
|
77
|
+
},
|
|
74
78
|
},
|
|
75
|
-
|
|
79
|
+
)
|
|
76
80
|
autoOpenBrowser = false
|
|
77
81
|
|
|
78
82
|
if (process.env.TRANSPORT === 'web') {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"mcp-stdio": {
|
|
4
|
+
"type": "node",
|
|
5
|
+
"args": ["build/index.js"],
|
|
6
|
+
"env": {}
|
|
7
|
+
},
|
|
8
|
+
"mcp-streamable": {
|
|
9
|
+
"type": "streamable-http",
|
|
10
|
+
"url": "http://localhost:8401/mcp"
|
|
11
|
+
},
|
|
12
|
+
"mcp-sse": {
|
|
13
|
+
"type": "sse",
|
|
14
|
+
"url": "http://localhost:8401/sse"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -6,6 +6,7 @@ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
|
|
|
6
6
|
{{/if}}
|
|
7
7
|
{{#if (includes transports 'sse')}}
|
|
8
8
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'
|
|
9
|
+
import { createServer } from '@/services'
|
|
9
10
|
{{/if}}
|
|
10
11
|
{{#if (includes transports 'streamable')}}
|
|
11
12
|
import { generateSessionId } from '@/utils'
|
|
@@ -81,10 +82,16 @@ export async function webServer(server, options) {
|
|
|
81
82
|
const transport = new SSEServerTransport('/messages', res)
|
|
82
83
|
transports.sse[transport.sessionId] = transport
|
|
83
84
|
|
|
85
|
+
const interval = setInterval(() => {
|
|
86
|
+
res.raw.write(`event: ping\ndata: {"time":"${new Date().toISOString()}"}\n\n`)
|
|
87
|
+
}, 15000)
|
|
88
|
+
|
|
84
89
|
res.on('close', () => {
|
|
85
90
|
delete transports.sse[transport.sessionId]
|
|
91
|
+
clearInterval(interval)
|
|
86
92
|
})
|
|
87
93
|
|
|
94
|
+
const server = createServer(options)
|
|
88
95
|
await server.connect(transport)
|
|
89
96
|
})
|
|
90
97
|
|
|
@@ -17,12 +17,7 @@ export default defineConfig({
|
|
|
17
17
|
},
|
|
18
18
|
{{#if (or (includes transports 'streamable') (includes transports 'sse'))}}
|
|
19
19
|
pool: 'threads',
|
|
20
|
-
|
|
21
|
-
threads: {
|
|
22
|
-
maxThreads: 1,
|
|
23
|
-
minThreads: 1,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
20
|
+
maxWorkers: 1,
|
|
26
21
|
{{/if}}
|
|
27
22
|
},
|
|
28
23
|
})
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"prepare": "husky"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.21.0",
|
|
45
45
|
"dotenv": "^17.2.3",
|
|
46
46
|
{{#if (or (includes transports 'streamable') (includes transports 'sse'))}}
|
|
47
47
|
"express": "^5.1.0",
|
|
@@ -52,22 +52,22 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
{{#if (includes plugins 'commitlint')}}
|
|
55
|
-
"@commitlint/cli": "^
|
|
56
|
-
"@commitlint/config-conventional": "^
|
|
55
|
+
"@commitlint/cli": "^20.1.0",
|
|
56
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
57
57
|
{{/if}}
|
|
58
58
|
{{#if (includes plugins 'inspector')}}
|
|
59
|
-
"@modelcontextprotocol/inspector": "^0.
|
|
59
|
+
"@modelcontextprotocol/inspector": "^0.17.2",
|
|
60
60
|
{{/if}}
|
|
61
61
|
{{#if (or (includes transports 'streamable') (includes transports 'sse'))}}
|
|
62
|
-
"@types/express": "^5.0.
|
|
62
|
+
"@types/express": "^5.0.5",
|
|
63
63
|
{{/if}}
|
|
64
|
-
"@types/yargs": "^17.0.
|
|
64
|
+
"@types/yargs": "^17.0.34",
|
|
65
65
|
{{#if (includes plugins 'style')}}
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
67
|
-
"@typescript-eslint/parser": "^8.
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
67
|
+
"@typescript-eslint/parser": "^8.48.0",
|
|
68
68
|
{{/if}}
|
|
69
69
|
{{#if (includes plugins 'vitest')}}
|
|
70
|
-
"@vitest/coverage-v8": "^
|
|
70
|
+
"@vitest/coverage-v8": "^4.0.14",
|
|
71
71
|
"c8": "^10.1.3",
|
|
72
72
|
{{/if}}
|
|
73
73
|
{{#if (includes plugins 'changelog')}}
|
|
@@ -75,20 +75,20 @@
|
|
|
75
75
|
{{/if}}
|
|
76
76
|
"concurrently": "^9.2.1",
|
|
77
77
|
{{#if (includes plugins 'changelog')}}
|
|
78
|
-
"conventional-changelog-angular": "^8.
|
|
78
|
+
"conventional-changelog-angular": "^8.1.0",
|
|
79
79
|
"conventional-changelog-cli": "^5.0.0",
|
|
80
80
|
{{/if}}
|
|
81
81
|
"cross-env": "^10.1.0",
|
|
82
|
-
"esbuild": "^0.25.
|
|
82
|
+
"esbuild": "^0.25.12",
|
|
83
83
|
{{#if (includes plugins 'style')}}
|
|
84
|
-
"eslint": "^9.
|
|
84
|
+
"eslint": "^9.39.1",
|
|
85
85
|
"eslint-plugin-import": "^2.32.0",
|
|
86
86
|
"eslint-plugin-prettier": "^5.5.3",
|
|
87
|
-
"globals": "^16.
|
|
87
|
+
"globals": "^16.5.0",
|
|
88
88
|
{{/if}}
|
|
89
89
|
"husky": "^9.1.7",
|
|
90
90
|
{{#if (includes plugins 'style')}}
|
|
91
|
-
"lint-staged": "^16.2.
|
|
91
|
+
"lint-staged": "^16.2.6",
|
|
92
92
|
{{/if}}
|
|
93
93
|
{{#if (includes plugins 'vitest')}}
|
|
94
94
|
"nyc": "^17.1.0",
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
"tsx": "^4.20.6",
|
|
103
103
|
"typescript": "^5.9.3",
|
|
104
104
|
{{#if (includes plugins 'vitest')}}
|
|
105
|
-
"vitest": "^
|
|
105
|
+
"vitest": "^4.0.14",
|
|
106
106
|
{{/if}}
|
|
107
|
-
"rimraf": "^6.0
|
|
107
|
+
"rimraf": "^6.1.0"
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -64,15 +64,19 @@ const after = async result => {
|
|
|
64
64
|
if (inspectorProcess) {
|
|
65
65
|
kill(inspectorProcess.pid, 'SIGINT')
|
|
66
66
|
}
|
|
67
|
-
inspectorProcess = spawn(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
inspectorProcess = spawn(
|
|
68
|
+
'npx',
|
|
69
|
+
['@modelcontextprotocol/inspector', '--config', './src/assets/mcp.json', '--server', 'mcp-stdio'],
|
|
70
|
+
{
|
|
71
|
+
stdio: 'inherit',
|
|
72
|
+
shell: true,
|
|
73
|
+
env: {
|
|
74
|
+
...process.env,
|
|
75
|
+
DANGEROUSLY_OMIT_AUTH: true,
|
|
76
|
+
MCP_AUTO_OPEN_ENABLED: autoOpenBrowser,
|
|
77
|
+
},
|
|
74
78
|
},
|
|
75
|
-
|
|
79
|
+
)
|
|
76
80
|
autoOpenBrowser = false
|
|
77
81
|
|
|
78
82
|
if (process.env.TRANSPORT === 'web') {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"mcp-stdio": {
|
|
4
|
+
"type": "node",
|
|
5
|
+
"args": ["build/index.js"],
|
|
6
|
+
"env": {}
|
|
7
|
+
},
|
|
8
|
+
"mcp-streamable": {
|
|
9
|
+
"type": "streamable-http",
|
|
10
|
+
"url": "http://localhost:8401/mcp"
|
|
11
|
+
},
|
|
12
|
+
"mcp-sse": {
|
|
13
|
+
"type": "sse",
|
|
14
|
+
"url": "http://localhost:8401/sse"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -10,7 +10,7 @@ import { webServer } from './web'
|
|
|
10
10
|
{{/if}}
|
|
11
11
|
import type { OptionsType } from '@/types'
|
|
12
12
|
|
|
13
|
-
const createServer = (options: OptionsType) => {
|
|
13
|
+
export const createServer = (options: OptionsType) => {
|
|
14
14
|
const server = new McpServer({
|
|
15
15
|
name: options.name,
|
|
16
16
|
version: options.version,
|
|
@@ -6,6 +6,7 @@ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
|
|
|
6
6
|
{{/if}}
|
|
7
7
|
{{#if (includes transports 'sse')}}
|
|
8
8
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'
|
|
9
|
+
import { createServer } from '@/services'
|
|
9
10
|
{{/if}}
|
|
10
11
|
{{#if (includes transports 'streamable')}}
|
|
11
12
|
import { generateSessionId } from '@/utils'
|
|
@@ -83,10 +84,16 @@ export async function webServer(server: McpServer, options: OptionsType) {
|
|
|
83
84
|
const transport = new SSEServerTransport('/messages', res)
|
|
84
85
|
transports.sse[transport.sessionId] = transport
|
|
85
86
|
|
|
87
|
+
const interval = setInterval(() => {
|
|
88
|
+
res.raw.write(`event: ping\ndata: {"time":"${new Date().toISOString()}"}\n\n`)
|
|
89
|
+
}, 15000)
|
|
90
|
+
|
|
86
91
|
res.on('close', () => {
|
|
87
92
|
delete transports.sse[transport.sessionId]
|
|
93
|
+
clearInterval(interval)
|
|
88
94
|
})
|
|
89
95
|
|
|
96
|
+
const server = createServer(options)
|
|
90
97
|
await server.connect(transport)
|
|
91
98
|
})
|
|
92
99
|
|
|
@@ -17,12 +17,7 @@ export default defineConfig({
|
|
|
17
17
|
},
|
|
18
18
|
{{#if (or (includes transports 'streamable') (includes transports 'sse'))}}
|
|
19
19
|
pool: 'threads',
|
|
20
|
-
|
|
21
|
-
threads: {
|
|
22
|
-
maxThreads: 1,
|
|
23
|
-
minThreads: 1,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
20
|
+
maxWorkers: 1,
|
|
26
21
|
{{/if}}
|
|
27
22
|
},
|
|
28
23
|
})
|
|
@@ -21,7 +21,7 @@ const stdioClientTransport = new StdioClientTransport({
|
|
|
21
21
|
command: 'c8',
|
|
22
22
|
args: ['--reporter=lcov', '--reporter=text', 'tsx', './src/index.ts'],
|
|
23
23
|
env: {
|
|
24
|
-
...process.env as Record<string, string
|
|
24
|
+
...(process.env as Record<string, string>),
|
|
25
25
|
NODE_V8_COVERAGE: './coverage/tmp',
|
|
26
26
|
},
|
|
27
27
|
})
|