create-mcp-kit 0.0.2 → 0.0.3
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 +17 -0
- package/dist/index.js +3 -0
- package/package.json +2 -2
- package/template/standard-js/LICENSE +21 -0
- package/template/standard-js/_env +1 -0
- package/template/standard-js/_github/workflows/build.yml +37 -0
- package/template/standard-js/_github/workflows/npm-publish.yml +39 -0
- package/template/standard-js/_gitignore +112 -0
- package/template/standard-js/_husky/commit-msg +1 -0
- package/template/standard-js/_husky/pre-commit +1 -0
- package/template/standard-js/_nvmrc +1 -0
- package/template/standard-js/_prettierrc +11 -0
- package/template/standard-js/changelog-option.js +87 -0
- package/template/standard-js/commitlint.config.js +25 -0
- package/template/standard-js/eslint.config.js +42 -0
- package/template/standard-js/jsconfig.json +17 -0
- package/template/standard-js/lint-staged.config.js +3 -0
- package/template/standard-js/package.json +62 -0
- package/template/standard-js/scripts/base.js +82 -0
- package/template/standard-js/scripts/build.js +4 -0
- package/template/standard-js/scripts/dev.js +7 -0
- package/template/standard-js/src/constants/index.js +1 -0
- package/template/standard-js/src/index.js +50 -0
- package/template/standard-js/src/prompts/index.js +27 -0
- package/template/standard-js/src/resources/index.js +24 -0
- package/template/standard-js/src/services/index.js +27 -0
- package/template/standard-js/src/services/stdio.js +6 -0
- package/template/standard-js/src/services/web.js +88 -0
- package/template/standard-js/src/tools/index.js +5 -0
- package/template/standard-js/src/tools/registerGetData.js +38 -0
- package/template/standard-js/src/utils/index.js +7 -0
- package/template/standard-js/tests/prompts/index.test.js +24 -0
- package/template/standard-js/tests/resources/index.test.js +18 -0
- package/template/standard-js/tests/tools/index.test.js +42 -0
- package/template/standard-js/vitest.config.js +10 -0
- package/template/standard-js/vitest.setup.js +19 -0
- package/template/standard-ts/_github/workflows/build.yml +3 -0
- package/template/standard-ts/_github/workflows/npm-publish.yml +3 -0
- package/template/standard-ts/package.json +1 -1
- package/template/standard-ts/src/prompts/index.ts +1 -1
- package/template/standard-ts/src/resources/index.ts +1 -1
- package/template/standard-ts/src/services/web.ts +1 -1
- package/template/standard-ts/vitest.setup.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# create-mcp-kit
|
|
2
2
|
A CLI tool to create MCP (Model Context Protocol) applications with ease.
|
|
3
3
|
|
|
4
|
+
[![][npm-release-shield]][npm-release-link]
|
|
5
|
+
[![][codecov-shield]][codecov-link]
|
|
6
|
+
[![][github-release-date-shield]][github-release-date-link]
|
|
7
|
+
[![][github-action-build-shield]][github-action-build-link]
|
|
8
|
+
[![][github-license-shield]][github-license-link]
|
|
9
|
+
|
|
4
10
|
## Features
|
|
5
11
|
- 🚀 Quick project scaffolding
|
|
6
12
|
- 📦 TypeScript support out of the box
|
|
@@ -123,3 +129,14 @@ This project exists thanks to all the people who contribute.
|
|
|
123
129
|
## License
|
|
124
130
|
|
|
125
131
|
[MIT](LICENSE) © MichaelSun
|
|
132
|
+
|
|
133
|
+
[npm-release-link]: https://www.npmjs.com/package/create-mcp-kit
|
|
134
|
+
[npm-release-shield]: https://img.shields.io/npm/v/create-mcp-kit?color=1677FF&labelColor=black&logo=npm&logoColor=white&style=flat-square
|
|
135
|
+
[codecov-link]: https://coveralls.io/github/my-mcp-hub/mcp-kit?branch=main
|
|
136
|
+
[codecov-shield]: https://img.shields.io/coverallsCoverage/github/my-mcp-hub/mcp-kit?color=1677FF&labelColor=black&style=flat-square&logo=codecov&logoColor=white
|
|
137
|
+
[github-release-date-link]: https://github.com/my-mcp-hub/mcp-kit/releases
|
|
138
|
+
[github-release-date-shield]: https://img.shields.io/github/release-date/my-mcp-hub/mcp-kit?color=1677FF&labelColor=black&style=flat-square
|
|
139
|
+
[github-action-build-link]: https://github.com/my-mcp-hub/mcp-kit/actions/workflows/build.yml
|
|
140
|
+
[github-action-build-shield]: https://img.shields.io/github/actions/workflow/status/my-mcp-hub/mcp-kit/build.yml?branch=main&color=1677FF&label=build&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
|
|
141
|
+
[github-license-link]: https://github.com/my-mcp-hub/mcp-kit/blob/main/LICENSE
|
|
142
|
+
[github-license-shield]: https://img.shields.io/github/license/my-mcp-hub/mcp-kit?color=1677FF&labelColor=black&style=flat-square
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mcp-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "create mcp tool kit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "zhensherlock",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@clack/prompts": "^0.11.0",
|
|
43
43
|
"picocolors": "^1.1.1",
|
|
44
|
-
"@mcp-tool-kit/shared": "^0.0.
|
|
44
|
+
"@mcp-tool-kit/shared": "^0.0.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@modelcontextprotocol/sdk": "^1.17.1",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) {{YEAR}} {{PROJECT_NAME}}
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PORT=8401
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
if: github.repository == '{{PROJECT_NAME}}'
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
|
|
18
|
+
- name: Install Node
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: 22
|
|
22
|
+
cache: npm
|
|
23
|
+
|
|
24
|
+
- name: Install Package
|
|
25
|
+
run: npm i
|
|
26
|
+
|
|
27
|
+
- name: Lint
|
|
28
|
+
run: npm run lint
|
|
29
|
+
|
|
30
|
+
- name: Build Package
|
|
31
|
+
run: npm run build
|
|
32
|
+
|
|
33
|
+
- name: Test Package
|
|
34
|
+
run: npm run coverage
|
|
35
|
+
|
|
36
|
+
- name: Coveralls
|
|
37
|
+
uses: coverallsapp/github-action@v2
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: npm-publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
if: github.repository == '{{PROJECT_NAME}}'
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
id-token: write
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: Install Node
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 22
|
|
24
|
+
registry-url: https://registry.npmjs.org/
|
|
25
|
+
cache: npm
|
|
26
|
+
|
|
27
|
+
- name: Install Package
|
|
28
|
+
run: npm i
|
|
29
|
+
|
|
30
|
+
- name: Lint
|
|
31
|
+
run: npm run lint
|
|
32
|
+
|
|
33
|
+
- name: Build Package
|
|
34
|
+
run: npm run build
|
|
35
|
+
|
|
36
|
+
- name: Publish NPM Package
|
|
37
|
+
run: npm publish --provenance --access public
|
|
38
|
+
env:
|
|
39
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.idea/
|
|
3
|
+
# Logs
|
|
4
|
+
logs
|
|
5
|
+
*.log
|
|
6
|
+
npm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
lerna-debug.log*
|
|
10
|
+
|
|
11
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
12
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
13
|
+
|
|
14
|
+
# Runtime data
|
|
15
|
+
pids
|
|
16
|
+
*.pid
|
|
17
|
+
*.seed
|
|
18
|
+
*.pid.lock
|
|
19
|
+
|
|
20
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
21
|
+
lib-cov
|
|
22
|
+
|
|
23
|
+
# Coverage directory used by tools like istanbul
|
|
24
|
+
coverage
|
|
25
|
+
*.lcov
|
|
26
|
+
|
|
27
|
+
# nyc test coverage
|
|
28
|
+
.nyc_output
|
|
29
|
+
|
|
30
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
31
|
+
.grunt
|
|
32
|
+
|
|
33
|
+
# Bower dependency directory (https://bower.io/)
|
|
34
|
+
bower_components
|
|
35
|
+
|
|
36
|
+
# node-waf configuration
|
|
37
|
+
.lock-wscript
|
|
38
|
+
|
|
39
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
40
|
+
build/Release
|
|
41
|
+
|
|
42
|
+
# Dependency directories
|
|
43
|
+
node_modules/
|
|
44
|
+
jspm_packages/
|
|
45
|
+
|
|
46
|
+
# TypeScript v1 declaration files
|
|
47
|
+
typings/
|
|
48
|
+
|
|
49
|
+
# TypeScript cache
|
|
50
|
+
*.tsbuildinfo
|
|
51
|
+
|
|
52
|
+
# Optional npm cache directory
|
|
53
|
+
.npm
|
|
54
|
+
|
|
55
|
+
# Optional eslint cache
|
|
56
|
+
.eslintcache
|
|
57
|
+
|
|
58
|
+
# Microbundle cache
|
|
59
|
+
.rpt2_cache/
|
|
60
|
+
.rts2_cache_cjs/
|
|
61
|
+
.rts2_cache_es/
|
|
62
|
+
.rts2_cache_umd/
|
|
63
|
+
|
|
64
|
+
# Optional REPL history
|
|
65
|
+
.node_repl_history
|
|
66
|
+
|
|
67
|
+
# Output of 'npm pack'
|
|
68
|
+
*.tgz
|
|
69
|
+
|
|
70
|
+
# Yarn Integrity file
|
|
71
|
+
.yarn-integrity
|
|
72
|
+
|
|
73
|
+
# dotenv environment variables file
|
|
74
|
+
#.env
|
|
75
|
+
.env.test
|
|
76
|
+
|
|
77
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
78
|
+
.cache
|
|
79
|
+
|
|
80
|
+
# Next.js build output
|
|
81
|
+
.next
|
|
82
|
+
|
|
83
|
+
# Nuxt.js build / generate output
|
|
84
|
+
.nuxt
|
|
85
|
+
dist
|
|
86
|
+
|
|
87
|
+
# Gatsby files
|
|
88
|
+
.cache/
|
|
89
|
+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
|
90
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
91
|
+
# public
|
|
92
|
+
|
|
93
|
+
# vuepress build output
|
|
94
|
+
.vuepress/dist
|
|
95
|
+
|
|
96
|
+
# Serverless directories
|
|
97
|
+
.serverless/
|
|
98
|
+
|
|
99
|
+
# FuseBox cache
|
|
100
|
+
.fusebox/
|
|
101
|
+
|
|
102
|
+
# DynamoDB Local files
|
|
103
|
+
.dynamodb/
|
|
104
|
+
|
|
105
|
+
# TernJS port file
|
|
106
|
+
.tern-port
|
|
107
|
+
|
|
108
|
+
/docs/.vitepress/cache/
|
|
109
|
+
|
|
110
|
+
stats.html
|
|
111
|
+
|
|
112
|
+
build/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no-install commitlint --edit $1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v22
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import compareFunc from 'compare-func'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
writerOpts: {
|
|
5
|
+
transform: (commit, context) => {
|
|
6
|
+
let discard = true
|
|
7
|
+
const issues = []
|
|
8
|
+
|
|
9
|
+
const newCommit = {
|
|
10
|
+
...commit,
|
|
11
|
+
notes: commit.notes.map(note => ({
|
|
12
|
+
...note,
|
|
13
|
+
title: 'BREAKING CHANGES',
|
|
14
|
+
})),
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (newCommit.notes.length > 0) {
|
|
18
|
+
discard = false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const typeMap = {
|
|
22
|
+
feat: '✨ Features | 新功能',
|
|
23
|
+
fix: '🐛 Bug Fixes | Bug 修复',
|
|
24
|
+
perf: '⚡ Performance Improvements | 性能优化',
|
|
25
|
+
revert: '⏪ Reverts | 回退',
|
|
26
|
+
refactor: '♻ Code Refactoring | 代码重构',
|
|
27
|
+
test: '✅ Tests | 测试',
|
|
28
|
+
build: '👷 Build System | 构建',
|
|
29
|
+
chore: '🎫 Chores | 其他更新',
|
|
30
|
+
style: '💄 Styles | 风格',
|
|
31
|
+
ci: '🔧 Continuous Integration | CI 配置',
|
|
32
|
+
docs: '📝 Documentation | 文档',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (typeMap[newCommit.type]) {
|
|
36
|
+
newCommit.type = typeMap[newCommit.type]
|
|
37
|
+
} else if (newCommit.type === 'revert' || newCommit.revert) {
|
|
38
|
+
newCommit.type = typeMap['revert']
|
|
39
|
+
} else if (discard) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (newCommit.scope === '*') {
|
|
44
|
+
newCommit.scope = ''
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof newCommit.hash === 'string') {
|
|
48
|
+
newCommit.shortHash = newCommit.hash.substring(0, 7)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof newCommit.subject === 'string') {
|
|
52
|
+
let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl
|
|
53
|
+
|
|
54
|
+
if (url) {
|
|
55
|
+
url = `${url}/issues/`
|
|
56
|
+
newCommit.subject = newCommit.subject.replace(/#([0-9]+)/g, (_, issue) => {
|
|
57
|
+
issues.push(issue)
|
|
58
|
+
return `[#${issue}](${url}${issue})`
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (context.host) {
|
|
63
|
+
newCommit.subject = newCommit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|
|
64
|
+
if (username.includes('/')) {
|
|
65
|
+
return `@${username}`
|
|
66
|
+
}
|
|
67
|
+
return `[@${username}](${context.host}/${username})`
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
newCommit.references = newCommit.references.filter(reference => {
|
|
73
|
+
if (issues.indexOf(reference.issue) === -1) {
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
76
|
+
return false
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return newCommit
|
|
80
|
+
},
|
|
81
|
+
groupBy: 'type',
|
|
82
|
+
commitGroupsSort: 'title',
|
|
83
|
+
commitsSort: ['scope', 'subject'],
|
|
84
|
+
noteGroupsSort: 'title',
|
|
85
|
+
notesSort: compareFunc,
|
|
86
|
+
},
|
|
87
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
extends: ['@commitlint/config-conventional'],
|
|
3
|
+
rules: {
|
|
4
|
+
'type-enum': [
|
|
5
|
+
2,
|
|
6
|
+
'always',
|
|
7
|
+
[
|
|
8
|
+
'feat',
|
|
9
|
+
'fix',
|
|
10
|
+
'docs',
|
|
11
|
+
'style',
|
|
12
|
+
'refactor',
|
|
13
|
+
'perf',
|
|
14
|
+
'test',
|
|
15
|
+
'build',
|
|
16
|
+
'ci',
|
|
17
|
+
'chore',
|
|
18
|
+
'revert',
|
|
19
|
+
'build',
|
|
20
|
+
'release',
|
|
21
|
+
],
|
|
22
|
+
],
|
|
23
|
+
'subject-case': [0],
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import importPlugin from 'eslint-plugin-import'
|
|
2
|
+
import prettierPlugin from 'eslint-plugin-prettier'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
ignores: ['**/build', '**/node_modules', '**/.*', '**/*.d.ts', '.husky/'],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
files: ['src/**/*.js', 'tests/**/*.js'],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: 'latest',
|
|
16
|
+
sourceType: 'module',
|
|
17
|
+
},
|
|
18
|
+
globals: {
|
|
19
|
+
...globals.es2022,
|
|
20
|
+
...globals.node,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
plugins: {
|
|
24
|
+
import: importPlugin,
|
|
25
|
+
prettier: prettierPlugin,
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'prettier/prettier': 'error',
|
|
29
|
+
'no-console': 'off',
|
|
30
|
+
semi: ['warn', 'never'],
|
|
31
|
+
quotes: ['warn', 'single'],
|
|
32
|
+
'no-unused-vars': 'off',
|
|
33
|
+
},
|
|
34
|
+
settings: {
|
|
35
|
+
'import/resolver': {
|
|
36
|
+
node: {
|
|
37
|
+
extensions: ['.js'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"outDir": "./build",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"paths": {
|
|
12
|
+
"@/*": ["./src/*"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"include": ["src", "tests", "vitest.setup.js", "vitest.config.js"],
|
|
16
|
+
"exclude": ["node_modules"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{PROJECT_NAME}}",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "{{PROJECT_NAME}}",
|
|
5
|
+
"author": "zhensherlock",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"{{PROJECT_NAME}}": "./build/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"build",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"main": "build/index.js",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"prepare": "husky",
|
|
19
|
+
"lint": "npx eslint \"src/**/*.js\"",
|
|
20
|
+
"build": "cross-env NODE_ENV=production node scripts/build.js",
|
|
21
|
+
"dev": "npm run dev:stdio",
|
|
22
|
+
"dev:stdio": "cross-env NODE_ENV=local node scripts/dev.js",
|
|
23
|
+
"dev:web": "cross-env NODE_ENV=local TRANSPORT=web node scripts/dev.js",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"coverage": "rimraf coverage && npm run test && c8 report --reporter=lcov --reporter=html",
|
|
26
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 -n changelog-option.js"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.17.1",
|
|
30
|
+
"cors": "^2.8.5",
|
|
31
|
+
"dotenv": "^17.2.1",
|
|
32
|
+
"express": "^5.1.0",
|
|
33
|
+
"nanoid": "^5.1.5",
|
|
34
|
+
"node-fetch": "^3.3.2",
|
|
35
|
+
"yargs": "^17.7.2",
|
|
36
|
+
"zod": "^3.25.76"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@commitlint/cli": "^19.8.1",
|
|
40
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
41
|
+
"@modelcontextprotocol/inspector": "^0.16.2",
|
|
42
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
43
|
+
"c8": "^10.1.3",
|
|
44
|
+
"compare-func": "^2.0.0",
|
|
45
|
+
"concurrently": "^9.2.0",
|
|
46
|
+
"conventional-changelog-angular": "^8.0.0",
|
|
47
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
48
|
+
"cross-env": "^10.0.0",
|
|
49
|
+
"esbuild": "^0.25.8",
|
|
50
|
+
"eslint": "^9.32.0",
|
|
51
|
+
"eslint-plugin-import": "^2.32.0",
|
|
52
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
53
|
+
"globals": "^16.3.0",
|
|
54
|
+
"husky": "^9.1.7",
|
|
55
|
+
"lint-staged": "^16.1.4",
|
|
56
|
+
"nyc": "^17.1.0",
|
|
57
|
+
"prettier": "^3.6.2",
|
|
58
|
+
"rimraf": "^6.0.1",
|
|
59
|
+
"tree-kill": "^1.2.2",
|
|
60
|
+
"vitest": "^3.2.4"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
import { promises as fs } from 'fs'
|
|
4
|
+
import { spawn } from 'child_process'
|
|
5
|
+
import { rimraf } from 'rimraf'
|
|
6
|
+
import kill from 'tree-kill'
|
|
7
|
+
|
|
8
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
const isProd = process.env.NODE_ENV === 'production'
|
|
10
|
+
const isDev = process.env.NODE_ENV === 'local'
|
|
11
|
+
let inspectorProcess = null
|
|
12
|
+
let webProcess = null
|
|
13
|
+
let autoOpenBrowser = true
|
|
14
|
+
|
|
15
|
+
/** @type {import('esbuild').BuildOptions} */
|
|
16
|
+
export const config = {
|
|
17
|
+
entryPoints: [path.resolve(__dirname, '../src/index.js')],
|
|
18
|
+
outfile: path.resolve(__dirname, '../build/index.js'),
|
|
19
|
+
format: 'esm',
|
|
20
|
+
bundle: true,
|
|
21
|
+
sourcemap: isDev,
|
|
22
|
+
minify: isProd,
|
|
23
|
+
platform: 'node',
|
|
24
|
+
external: ['yargs', 'node-fetch', 'cors', 'express', 'nanoid', 'zod', 'dotenv', '@modelcontextprotocol/sdk'],
|
|
25
|
+
alias: {
|
|
26
|
+
'@': path.resolve(__dirname, '../src'),
|
|
27
|
+
},
|
|
28
|
+
plugins: [
|
|
29
|
+
{
|
|
30
|
+
name: 'build-plugin',
|
|
31
|
+
setup(build) {
|
|
32
|
+
build.onStart(async result => {
|
|
33
|
+
await before(result)
|
|
34
|
+
})
|
|
35
|
+
build.onEnd(async result => {
|
|
36
|
+
await after(result)
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const before = async () => {
|
|
44
|
+
await rimraf('build')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const after = async result => {
|
|
48
|
+
await fs.chmod('build/index.js', 0o755)
|
|
49
|
+
console.log('✅ chmod 755 build/index.js done')
|
|
50
|
+
if (isDev) {
|
|
51
|
+
if (result.errors.length === 0) {
|
|
52
|
+
console.log('✅ Rebuild succeeded')
|
|
53
|
+
} else {
|
|
54
|
+
console.error('❌ Rebuild failed')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log('🚀 Starting @modelcontextprotocol/inspector...')
|
|
58
|
+
if (inspectorProcess) {
|
|
59
|
+
kill(inspectorProcess.pid, 'SIGINT')
|
|
60
|
+
// inspectorProcess.kill('SIGINT')
|
|
61
|
+
}
|
|
62
|
+
inspectorProcess = spawn('npx', ['@modelcontextprotocol/inspector', 'build/index.js'], {
|
|
63
|
+
stdio: 'inherit',
|
|
64
|
+
shell: true,
|
|
65
|
+
env: {
|
|
66
|
+
...process.env,
|
|
67
|
+
DANGEROUSLY_OMIT_AUTH: true,
|
|
68
|
+
MCP_AUTO_OPEN_ENABLED: autoOpenBrowser,
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
autoOpenBrowser = false
|
|
72
|
+
|
|
73
|
+
if (process.env.TRANSPORT === 'web') {
|
|
74
|
+
if (webProcess) {
|
|
75
|
+
webProcess.kill('SIGINT')
|
|
76
|
+
}
|
|
77
|
+
webProcess = spawn('node', ['build/index.js', 'web'], {
|
|
78
|
+
stdio: 'inherit',
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MagicSeparator = '###MAGIC###'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import yargs from 'yargs'
|
|
3
|
+
import { hideBin } from 'yargs/helpers'
|
|
4
|
+
import { startWebServer, startStdioServer } from './services/index.js'
|
|
5
|
+
import { getOptions } from './utils/index.js'
|
|
6
|
+
import 'dotenv/config'
|
|
7
|
+
import pkg from '../package.json' with { type: 'json' }
|
|
8
|
+
|
|
9
|
+
const name = 'node-mcp-server'
|
|
10
|
+
|
|
11
|
+
const argv = await yargs()
|
|
12
|
+
.scriptName(name)
|
|
13
|
+
.usage('$0 <command> [options]')
|
|
14
|
+
.command(
|
|
15
|
+
'stdio',
|
|
16
|
+
'Start the server using the stdio transport protocol.',
|
|
17
|
+
() => {},
|
|
18
|
+
argv => startServer('stdio', argv),
|
|
19
|
+
)
|
|
20
|
+
.command(
|
|
21
|
+
'web',
|
|
22
|
+
'Start the web server transport protocol.',
|
|
23
|
+
() => {},
|
|
24
|
+
argv => startServer('web', argv),
|
|
25
|
+
)
|
|
26
|
+
.options({
|
|
27
|
+
port: {
|
|
28
|
+
describe: 'Specify the port for SSE or streamable transport (default: 8401)',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: process.env.PORT || '8401',
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
.help()
|
|
34
|
+
.parse(hideBin(process.argv))
|
|
35
|
+
|
|
36
|
+
if (!argv._[0]) {
|
|
37
|
+
startServer('stdio', argv)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function startServer(mode, argv) {
|
|
41
|
+
const options = getOptions(argv, {
|
|
42
|
+
name,
|
|
43
|
+
version: pkg.version,
|
|
44
|
+
})
|
|
45
|
+
if (mode === 'stdio') {
|
|
46
|
+
startStdioServer(options).catch(console.error)
|
|
47
|
+
} else if (mode === 'web') {
|
|
48
|
+
startWebServer(options).catch(console.error)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const registerPrompts = server => {
|
|
4
|
+
server.registerPrompt(
|
|
5
|
+
'echo',
|
|
6
|
+
{
|
|
7
|
+
title: 'Echo Prompt',
|
|
8
|
+
description: 'Creates a prompt to process a message.',
|
|
9
|
+
argsSchema: {
|
|
10
|
+
message: z.string(),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
({ message }) => {
|
|
14
|
+
return {
|
|
15
|
+
messages: [
|
|
16
|
+
{
|
|
17
|
+
role: 'user',
|
|
18
|
+
content: {
|
|
19
|
+
type: 'text',
|
|
20
|
+
text: `Please process this message: ${message}`,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
+
|
|
3
|
+
export const registerResources = (server, options) => {
|
|
4
|
+
server.registerResource(
|
|
5
|
+
'search',
|
|
6
|
+
new ResourceTemplate('search://{keyword}', {
|
|
7
|
+
list: undefined,
|
|
8
|
+
}),
|
|
9
|
+
{
|
|
10
|
+
title: 'Search Resource',
|
|
11
|
+
description: 'Dynamic generate search resource',
|
|
12
|
+
},
|
|
13
|
+
async (uri, { keyword }) => {
|
|
14
|
+
return {
|
|
15
|
+
contents: [
|
|
16
|
+
{
|
|
17
|
+
uri: uri.href,
|
|
18
|
+
text: `search ${keyword}`,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
+
import { registerTools } from '../tools/index.js'
|
|
3
|
+
import { registerResources } from '../resources/index.js'
|
|
4
|
+
import { registerPrompts } from '../prompts/index.js'
|
|
5
|
+
import { stdioServer } from './stdio.js'
|
|
6
|
+
import { webServer } from './web.js'
|
|
7
|
+
|
|
8
|
+
const createServer = options => {
|
|
9
|
+
const server = new McpServer({
|
|
10
|
+
name: options.name,
|
|
11
|
+
version: options.version,
|
|
12
|
+
})
|
|
13
|
+
registerTools(server, options)
|
|
14
|
+
registerResources(server, options)
|
|
15
|
+
registerPrompts(server)
|
|
16
|
+
return server
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function startStdioServer(options) {
|
|
20
|
+
const server = createServer(options)
|
|
21
|
+
await stdioServer(server)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function startWebServer(options) {
|
|
25
|
+
const server = createServer(options)
|
|
26
|
+
await webServer(server, options)
|
|
27
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
|
+
import express from 'express'
|
|
3
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js'
|
|
4
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'
|
|
5
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'
|
|
6
|
+
|
|
7
|
+
export async function webServer(server, options) {
|
|
8
|
+
const app = express()
|
|
9
|
+
app.use(express.json())
|
|
10
|
+
|
|
11
|
+
const transports = {
|
|
12
|
+
streamable: {},
|
|
13
|
+
sse: {},
|
|
14
|
+
}
|
|
15
|
+
app.post('/mcp', async (req, res) => {
|
|
16
|
+
const sessionId = req.headers['mcp-session-id']
|
|
17
|
+
let transport
|
|
18
|
+
|
|
19
|
+
if (sessionId && transports.streamable[sessionId]) {
|
|
20
|
+
transport = transports.streamable[sessionId]
|
|
21
|
+
} else if (!sessionId && isInitializeRequest(req.body)) {
|
|
22
|
+
transport = new StreamableHTTPServerTransport({
|
|
23
|
+
sessionIdGenerator: () => nanoid(),
|
|
24
|
+
onsessioninitialized: sessionId => {
|
|
25
|
+
transports.streamable[sessionId] = transport
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
transport.onclose = () => {
|
|
30
|
+
if (transport.sessionId) {
|
|
31
|
+
delete transports.streamable[transport.sessionId]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
await server.connect(transport)
|
|
35
|
+
} else {
|
|
36
|
+
res.status(400).json({
|
|
37
|
+
jsonrpc: '2.0',
|
|
38
|
+
error: {
|
|
39
|
+
code: -32000,
|
|
40
|
+
message: 'Bad Request: No valid session ID provided',
|
|
41
|
+
},
|
|
42
|
+
id: null,
|
|
43
|
+
})
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
await transport.handleRequest(req, res, req.body)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const handleSessionRequest = async (req, res) => {
|
|
51
|
+
const sessionId = req.headers['mcp-session-id']
|
|
52
|
+
if (!sessionId || !transports.streamable[sessionId]) {
|
|
53
|
+
res.status(400).send('Invalid or missing session ID')
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const transport = transports.streamable[sessionId]
|
|
58
|
+
await transport.handleRequest(req, res)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
app.get('/mcp', handleSessionRequest)
|
|
62
|
+
|
|
63
|
+
app.delete('/mcp', handleSessionRequest)
|
|
64
|
+
|
|
65
|
+
app.get('/sse', async (req, res) => {
|
|
66
|
+
const transport = new SSEServerTransport('/messages', res)
|
|
67
|
+
transports.sse[transport.sessionId] = transport
|
|
68
|
+
|
|
69
|
+
res.on('close', () => {
|
|
70
|
+
delete transports.sse[transport.sessionId]
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
await server.connect(transport)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
app.post('/messages', async (req, res) => {
|
|
77
|
+
const sessionId = req.query.sessionId
|
|
78
|
+
const transport = transports.sse[sessionId]
|
|
79
|
+
if (transport) {
|
|
80
|
+
await transport.handlePostMessage(req, res, req.body)
|
|
81
|
+
} else {
|
|
82
|
+
res.status(400).send('No transport found for sessionId')
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
app.listen(options.port)
|
|
87
|
+
console.log(`MCP server started on port ${options.port}. SSE endpoint: /sse, streamable endpoint: /mcp`)
|
|
88
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export default function register(server, options) {
|
|
4
|
+
server.registerTool(
|
|
5
|
+
'GetData',
|
|
6
|
+
{
|
|
7
|
+
title: 'Get Data',
|
|
8
|
+
description: 'Get Data',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
keyword: z.string().describe('search keyword'),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
async ({ keyword }) => {
|
|
14
|
+
const { success, data, message } = await getData(keyword, options)
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: success ? data : message,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const getData = async (keyword, options) => {
|
|
28
|
+
if (!keyword || keyword === 'error') {
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
message: 'not found',
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
success: true,
|
|
36
|
+
data: `keyword: ${keyword};`,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
|
|
3
|
+
describe('echoPrompt', () => {
|
|
4
|
+
test('should return correct prompt content for a valid argument', async () => {
|
|
5
|
+
expect(
|
|
6
|
+
await global.client.getPrompt({
|
|
7
|
+
name: 'echo',
|
|
8
|
+
arguments: {
|
|
9
|
+
message: 'hello',
|
|
10
|
+
},
|
|
11
|
+
}),
|
|
12
|
+
).toStrictEqual({
|
|
13
|
+
messages: [
|
|
14
|
+
{
|
|
15
|
+
role: 'user',
|
|
16
|
+
content: {
|
|
17
|
+
type: 'text',
|
|
18
|
+
text: 'Please process this message: hello',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
|
|
3
|
+
describe('searchResource', () => {
|
|
4
|
+
test('should return correct resource content for a valid URI', async () => {
|
|
5
|
+
expect(
|
|
6
|
+
await global.client.readResource({
|
|
7
|
+
uri: 'search://hello',
|
|
8
|
+
}),
|
|
9
|
+
).toStrictEqual({
|
|
10
|
+
contents: [
|
|
11
|
+
{
|
|
12
|
+
uri: 'search://hello',
|
|
13
|
+
text: 'search hello',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
|
|
3
|
+
describe('getDataTool', () => {
|
|
4
|
+
test('returns data for a valid input', async () => {
|
|
5
|
+
expect(
|
|
6
|
+
await global.client.callTool({
|
|
7
|
+
name: 'GetData',
|
|
8
|
+
arguments: {
|
|
9
|
+
keyword: 'test',
|
|
10
|
+
},
|
|
11
|
+
}),
|
|
12
|
+
).toStrictEqual({
|
|
13
|
+
content: [{ type: 'text', text: 'keyword: test;' }],
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('returns a "not found" response for an unrecognized input', async () => {
|
|
18
|
+
expect(
|
|
19
|
+
await global.client.callTool({
|
|
20
|
+
name: 'GetData',
|
|
21
|
+
arguments: {
|
|
22
|
+
keyword: 'error',
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
).toStrictEqual({
|
|
26
|
+
content: [{ type: 'text', text: 'not found' }],
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('returns a "not found" response for empty input', async () => {
|
|
31
|
+
expect(
|
|
32
|
+
await global.client.callTool({
|
|
33
|
+
name: 'GetData',
|
|
34
|
+
arguments: {
|
|
35
|
+
keyword: '',
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
).toStrictEqual({
|
|
39
|
+
content: [{ type: 'text', text: 'not found' }],
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import 'dotenv/config'
|
|
2
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
|
|
3
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
|
|
4
|
+
|
|
5
|
+
const serverParams = new StdioClientTransport({
|
|
6
|
+
command: 'nyc',
|
|
7
|
+
args: ['--merge-async', '--reporter=lcov', '--reporter=text', 'node', './src/index.js'],
|
|
8
|
+
env: {
|
|
9
|
+
...process.env,
|
|
10
|
+
NODE_V8_COVERAGE: './coverage/tmp',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
const client = new Client({
|
|
14
|
+
name: 'test-mcp-client',
|
|
15
|
+
version: '1.0.0',
|
|
16
|
+
})
|
|
17
|
+
await client.connect(serverParams)
|
|
18
|
+
|
|
19
|
+
global.client = client
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
1
|
+
import { type McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
2
|
import type { OptionsType } from '@/types'
|
|
3
3
|
|
|
4
4
|
export const registerResources = (server: McpServer, options: OptionsType) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { nanoid } from 'nanoid'
|
|
2
2
|
import express from 'express'
|
|
3
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
4
3
|
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js'
|
|
5
4
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'
|
|
6
5
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
7
7
|
import type { OptionsType } from '@/types'
|
|
8
8
|
|
|
9
9
|
export async function webServer(server: McpServer, options: OptionsType) {
|