wuran commited on
Commit
eb846d0
·
verified ·
1 Parent(s): e5f918f

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .env.example +2 -0
  2. .eslintrc.json +25 -0
  3. .gitattributes +3 -0
  4. .github/FUNDING.yml +15 -0
  5. .github/ISSUE_TEMPLATE/bug-report---bug-报告.md +29 -0
  6. .github/ISSUE_TEMPLATE/feature-request---功能请求.md +20 -0
  7. .github/dependabot.yml +11 -0
  8. .github/workflows/build.yml +61 -0
  9. .github/workflows/npm-publish.yml +58 -0
  10. .github/workflows/release.yml +20 -0
  11. .gitignore +26 -0
  12. .prettierrc +7 -0
  13. Dockerfile +59 -0
  14. LICENSE +201 -0
  15. README.md +11 -6
  16. README.zh.md +234 -0
  17. articals/assets/sr-conf.png +0 -0
  18. articals/assets/sr-dc.png +0 -0
  19. articals/assets/sr-map-call.png +0 -0
  20. articals/assets/sr-map-result.png +0 -0
  21. articals/assets/sr-map-search.png +0 -0
  22. articals/assets/sr-servers.png +0 -0
  23. articals/assets/sr-time.png +0 -0
  24. articals/assets/sr-tools.png +0 -0
  25. articals/assets/sr-web.png +0 -0
  26. articals/intro.md +73 -0
  27. articals/intro2.md +232 -0
  28. articals/smart-routing.md +177 -0
  29. assets/amap-edit.png +0 -0
  30. assets/amap-result.png +0 -0
  31. assets/cherry-mcp.png +0 -0
  32. assets/cursor-mcp.png +0 -0
  33. assets/cursor-query.png +0 -0
  34. assets/cursor-tools.png +0 -0
  35. assets/dashboard.png +0 -0
  36. assets/dashboard.zh.png +0 -0
  37. assets/group.png +0 -0
  38. assets/group.zh.png +0 -0
  39. assets/market.zh.png +0 -0
  40. assets/reward.png +0 -0
  41. assets/smart-routing.png +0 -0
  42. assets/smart-routing.zh.png +0 -0
  43. assets/wegroup.jpg +0 -0
  44. assets/wegroup.png +0 -0
  45. assets/wexin.png +0 -0
  46. bin/cli.js +96 -0
  47. docs/README.md +32 -0
  48. docs/api-reference/endpoint/create.mdx +4 -0
  49. docs/api-reference/endpoint/delete.mdx +4 -0
  50. docs/api-reference/endpoint/get.mdx +4 -0
.env.example ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ PORT=3000
2
+ NODE_ENV=development
.eslintrc.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
4
+ "parserOptions": {
5
+ "ecmaVersion": 2020,
6
+ "sourceType": "module"
7
+ },
8
+ "env": {
9
+ "node": true,
10
+ "es6": true,
11
+ "jest": true
12
+ },
13
+ "rules": {
14
+ "no-console": "off",
15
+ "@typescript-eslint/no-unused-vars": [
16
+ "error",
17
+ {
18
+ "argsIgnorePattern": "^_",
19
+ "varsIgnorePattern": "^_"
20
+ }
21
+ ],
22
+ "@typescript-eslint/no-explicit-any": "off",
23
+ "no-undef": "off",
24
+ }
25
+ }
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ docs/images/checks-passed.png filter=lfs diff=lfs merge=lfs -text
37
+ docs/images/hero-dark.png filter=lfs diff=lfs merge=lfs -text
38
+ docs/images/hero-light.png filter=lfs diff=lfs merge=lfs -text
.github/FUNDING.yml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: samanhappy
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ polar: # Replace with a single Polar username
13
+ buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ thanks_dev: # Replace with a single thanks.dev username
15
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
.github/ISSUE_TEMPLATE/bug-report---bug-报告.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug Report / Bug 报告
3
+ about: Create a report to help us improve / 报告问题以帮助改进
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Bug Description / 问题描述**
11
+ What happened? / 发生了什么?
12
+
13
+ **Steps to Reproduce / 复现步骤**
14
+ 1.
15
+ 2.
16
+ 3.
17
+
18
+ **Expected Behavior / 预期行为**
19
+ What should happen? / 应该发生什么?
20
+
21
+ **Environment / 运行环境**
22
+ - Running on / 运行方式: [docker/npx/local / docker/npx/本地]
23
+ - Version / 版本: [e.g. 1.0.0]
24
+
25
+ **Screenshots / 截图**
26
+ If relevant, add screenshots / 如果有帮助的话,请添加截图
27
+
28
+ **Additional Info / 补充信息**
29
+ Any other details? / 还有其他信息吗?
.github/ISSUE_TEMPLATE/feature-request---功能请求.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request / 功能请求
3
+ about: Suggest an idea for this project / 为项目提出新想法
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Current Problem / 当前问题**
11
+ What problem are you trying to solve? / 您想要解决什么问题?
12
+
13
+ **Proposed Solution / 建议方案**
14
+ How would you like this to work? / 您期望的解决方案是什么?
15
+
16
+ **Alternatives / 替代方案**
17
+ Have you considered any alternatives? / 您是否考虑过其他解决方案?
18
+
19
+ **Additional Context / 补充说明**
20
+ Any screenshots, mockups, or relevant information? / 有任何截图、设计图或相关信息吗?
.github/dependabot.yml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "npm" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "monthly"
.github/workflows/build.yml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build
2
+
3
+ on:
4
+ push:
5
+ tags: ['v*.*.*']
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ variant: ${{ startsWith(github.ref, 'refs/tags/') && fromJSON('["base", "full"]') || fromJSON('["base"]') }}
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Update version from tag
20
+ if: startsWith(github.ref, 'refs/tags/')
21
+ run: |
22
+ VERSION=${GITHUB_REF#refs/tags/v}
23
+ echo "Updating package.json version to $VERSION"
24
+ jq ".version = \"$VERSION\"" package.json > package.json.tmp
25
+ mv package.json.tmp package.json
26
+ echo "Updated version in package.json:"
27
+ grep -m 1 "version" package.json
28
+
29
+ - name: Set up Docker Buildx
30
+ uses: docker/setup-buildx-action@v3
31
+
32
+ - name: Login to Docker Hub
33
+ uses: docker/login-action@v3
34
+ with:
35
+ username: ${{ secrets.DOCKER_USERNAME }}
36
+ password: ${{ secrets.DOCKER_PASSWORD }}
37
+
38
+ - name: Docker metadata
39
+ id: meta
40
+ uses: docker/metadata-action@v5
41
+ with:
42
+ images: samanhappy/mcphub
43
+ tags: |
44
+ type=raw,value=edge${{ matrix.variant == 'full' && '-full' || '' }},enable=${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
45
+ type=semver,pattern={{version}}${{ matrix.variant == 'full' && '-full' || '' }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
46
+ type=raw,value=latest${{ matrix.variant == 'full' && '-full' || '' }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
47
+ flavor: |
48
+ latest=false
49
+
50
+ - name: Build and Push Docker Image
51
+ uses: docker/build-push-action@v5
52
+ with:
53
+ context: .
54
+ push: ${{ github.event_name != 'pull_request' }}
55
+ tags: ${{ steps.meta.outputs.tags }}
56
+ labels: ${{ steps.meta.outputs.labels }}
57
+ cache-from: type=gha
58
+ cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
59
+ platforms: linux/amd64,linux/arm64
60
+ build-args: |
61
+ INSTALL_EXT=${{ matrix.variant == 'full' && 'true' || 'false' }}
.github/workflows/npm-publish.yml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish to NPM
2
+
3
+ on:
4
+ push:
5
+ tags: ['v*.*.*']
6
+
7
+ jobs:
8
+ publish-npm:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout
12
+ uses: actions/checkout@v4
13
+
14
+ - name: Setup Node.js
15
+ uses: actions/setup-node@v4
16
+ with:
17
+ node-version: '20'
18
+ registry-url: 'https://registry.npmjs.org'
19
+
20
+ - name: Setup pnpm
21
+ uses: pnpm/action-setup@v2
22
+ with:
23
+ version: 10
24
+ run_install: false
25
+
26
+ - name: Get pnpm store directory
27
+ id: pnpm-cache
28
+ shell: bash
29
+ run: |
30
+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
31
+
32
+ - name: Setup pnpm cache
33
+ uses: actions/cache@v4
34
+ with:
35
+ path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
36
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
37
+ restore-keys: |
38
+ ${{ runner.os }}-pnpm-store-
39
+
40
+ - name: Install dependencies
41
+ run: pnpm install --frozen-lockfile
42
+
43
+ - name: Update version from tag
44
+ run: |
45
+ VERSION=${GITHUB_REF#refs/tags/v}
46
+ echo "Updating package.json version to $VERSION"
47
+ jq ".version = \"$VERSION\"" package.json > package.json.tmp
48
+ mv package.json.tmp package.json
49
+ echo "Updated version in package.json:"
50
+ grep -m 1 "version" package.json
51
+
52
+ - name: Build package
53
+ run: pnpm build
54
+
55
+ - name: Publish to NPM
56
+ run: pnpm publish --no-git-checks --access public
57
+ env:
58
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
.github/workflows/release.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: GitHub Release
2
+
3
+ on:
4
+ push:
5
+ tags: ['v*.*.*']
6
+
7
+ permissions:
8
+ contents: write
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Release
18
+ uses: softprops/action-gh-release@v2
19
+ with:
20
+ generate_release_notes: true
.gitignore ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dependencies
2
+ /node_modules
3
+ /.pnp
4
+ .pnp.js
5
+
6
+ # production
7
+ dist
8
+
9
+ # env files
10
+ .env
11
+ .env.local
12
+ .env.development.local
13
+ .env.test.local
14
+ .env.production.local
15
+
16
+ # logs
17
+ npm-debug.log*
18
+ yarn-debug.log*
19
+ yarn-error.log*
20
+
21
+ # misc
22
+ .DS_Store
23
+ .idea/
24
+ .vscode/
25
+ *.log
26
+ coverage/
.prettierrc ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "all",
4
+ "singleQuote": true,
5
+ "printWidth": 100,
6
+ "tabWidth": 2
7
+ }
Dockerfile ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm AS base
2
+
3
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
4
+
5
+ # 添加 HTTP_PROXY 和 HTTPS_PROXY 环境变量
6
+ ARG HTTP_PROXY=""
7
+ ARG HTTPS_PROXY=""
8
+ ENV HTTP_PROXY=$HTTP_PROXY
9
+ ENV HTTPS_PROXY=$HTTPS_PROXY
10
+
11
+ RUN apt-get update && apt-get install -y curl gnupg git \
12
+ && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
13
+ && apt-get install -y nodejs \
14
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
15
+
16
+ RUN npm install -g pnpm
17
+
18
+ ARG REQUEST_TIMEOUT=60000
19
+ ENV REQUEST_TIMEOUT=$REQUEST_TIMEOUT
20
+
21
+ ARG BASE_PATH=""
22
+ ENV BASE_PATH=$BASE_PATH
23
+
24
+ ENV PNPM_HOME=/usr/local/share/pnpm
25
+ ENV PATH=$PNPM_HOME:$PATH
26
+ RUN mkdir -p $PNPM_HOME && \
27
+ pnpm add -g @amap/amap-maps-mcp-server @playwright/mcp@latest tavily-mcp@latest @modelcontextprotocol/server-github @modelcontextprotocol/server-slack
28
+
29
+ ARG INSTALL_EXT=false
30
+ RUN if [ "$INSTALL_EXT" = "true" ]; then \
31
+ ARCH=$(uname -m); \
32
+ if [ "$ARCH" = "x86_64" ]; then \
33
+ npx -y playwright install --with-deps chrome; \
34
+ else \
35
+ echo "Skipping Chrome installation on non-amd64 architecture: $ARCH"; \
36
+ fi; \
37
+ fi
38
+
39
+ RUN uv tool install mcp-server-fetch
40
+
41
+ WORKDIR /app
42
+
43
+ COPY package.json pnpm-lock.yaml ./
44
+ RUN pnpm install
45
+
46
+ COPY . .
47
+
48
+ # Download the latest servers.json from mcpm.sh and replace the existing file
49
+ RUN curl -s -f --connect-timeout 10 https://mcpm.sh/api/servers.json -o servers.json || echo "Failed to download servers.json, using bundled version"
50
+
51
+ RUN pnpm frontend:build && pnpm build
52
+
53
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
54
+ RUN chmod +x /usr/local/bin/entrypoint.sh
55
+
56
+ EXPOSE 3000
57
+
58
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
59
+ CMD ["pnpm", "start"]
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md CHANGED
@@ -1,10 +1,15 @@
1
  ---
2
- title: Mcphub
3
- emoji: 💻
4
- colorFrom: purple
5
- colorTo: pink
6
  sdk: docker
7
- pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
1
  ---
2
+ title: "mcphub"
3
+ emoji: "🚀"
4
+ colorFrom: blue
5
+ colorTo: green
6
  sdk: docker
7
+ app_port: 3000
8
  ---
9
 
10
+ ### 🚀 一键部署
11
+ [![Deploy with HFSpaceDeploy](https://img.shields.io/badge/Deploy_with-HFSpaceDeploy-green?style=social&logo=rocket)](https://github.com/kfcx/HFSpaceDeploy)
12
+
13
+ 本项目由[HFSpaceDeploy](https://github.com/kfcx/HFSpaceDeploy)一键部署
14
+
15
+
README.zh.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MCPHub:一站式 MCP 服务器聚合平台
2
+
3
+ [English Version](README.md) | 中文版
4
+
5
+ MCPHub 通过将多个 MCP(Model Context Protocol)服务器组织为灵活的流式 HTTP(SSE)端点,简化了管理与扩展工作。系统支持按需访问全部服务器、单个服务器或按场景分组的服务器集合。
6
+
7
+ ![控制面板预览](assets/dashboard.zh.png)
8
+
9
+ ## 🚀 功能亮点
10
+
11
+ - **广泛的 MCP 服务器支持**:无缝集成任何 MCP 服务器,配置简单。
12
+ - **集中式管理控制台**:在一个简洁的 Web UI 中实时监控所有服务器的状态和性能指标。
13
+ - **灵活的协议兼容**:完全支持 stdio 和 SSE 两种 MCP 协议。
14
+ - **热插拔式配置**:在运行时动态添加、移除或更新服务器配置,无需停机。
15
+ - **基于分组的访问控制**:自定义分组并管理服务器访问权限。
16
+ - **安全认证机制**:内置用户管理,基于 JWT 和 bcrypt,实现角色权限控制。
17
+ - **Docker 就绪**:提供容器化镜像,快速部署。
18
+
19
+ ## 🔧 快速开始
20
+
21
+ ### 配置
22
+
23
+ 通过创建 `mcp_settings.json` 自定义服务器设置:
24
+
25
+ ```json
26
+ {
27
+ "mcpServers": {
28
+ "amap": {
29
+ "command": "npx",
30
+ "args": ["-y", "@amap/amap-maps-mcp-server"],
31
+ "env": {
32
+ "AMAP_MAPS_API_KEY": "your-api-key"
33
+ }
34
+ },
35
+ "playwright": {
36
+ "command": "npx",
37
+ "args": ["@playwright/mcp@latest", "--headless"]
38
+ },
39
+ "fetch": {
40
+ "command": "uvx",
41
+ "args": ["mcp-server-fetch"]
42
+ },
43
+ "slack": {
44
+ "command": "npx",
45
+ "args": ["-y", "@modelcontextprotocol/server-slack"],
46
+ "env": {
47
+ "SLACK_BOT_TOKEN": "your-bot-token",
48
+ "SLACK_TEAM_ID": "your-team-id"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ ### Docker 部署
56
+
57
+ **推荐**:挂载自定义配置:
58
+
59
+ ```bash
60
+ docker run -p 3000:3000 -v $(pwd)/mcp_settings.json:/app/mcp_settings.json samanhappy/mcphub
61
+ ```
62
+
63
+ 或使用默认配置运行:
64
+
65
+ ```bash
66
+ docker run -p 3000:3000 samanhappy/mcphub
67
+ ```
68
+
69
+ ### 访问控制台
70
+
71
+ 打开 `http://localhost:3000`,使用您的账号登录。
72
+
73
+ > **提示**:默认用户名/密码为 `admin` / `admin123`。
74
+
75
+ **控制台功能**:
76
+
77
+ - 实时监控所有 MCP 服务器状态
78
+ - 启用/禁用或重新配置服务器
79
+ - 分组管理,组织服务器访问
80
+ - 用户管理,设定权限
81
+
82
+ ### 支持流式的 HTTP 端点
83
+
84
+ > 截至目前,各家 AI 客户端对流式的 HTTP 端点支持不一,如果遇到问题,可以使用 SSE 端点或者等待更新。
85
+
86
+ 通过以下地址连接 AI 客户端(如 Claude Desktop、Cursor、DeepChat 等):
87
+
88
+ ```
89
+ http://localhost:3000/mcp
90
+ ```
91
+
92
+ 这个端点为所有 MCP 服务器提供统一的流式 HTTP 接口。它允许您:
93
+
94
+ - 向任何配置的 MCP 服务器发送请求
95
+ - 实时接收响应
96
+ - 轻松与各种 AI 客户端和工具集成
97
+ - 对所有服务器使用相同的端点,简化集成过程
98
+
99
+ **智能路由(实验性功能)**:
100
+
101
+ 智能路由是 MCPHub 的智能工具发现系统,使用向量语义搜索自动为任何给定任务找到最相关的工具。
102
+
103
+ ```
104
+ http://localhost:3000/mcp/$smart
105
+ ```
106
+
107
+ **工作原理:**
108
+
109
+ 1. **工具索引**:所有 MCP 工具自动转换为向量嵌入并存储在 PostgreSQL 与 pgvector 中
110
+ 2. **语义搜索**:用户查询转换为向量并使用余弦相似度与工具嵌入匹配
111
+ 3. **智能筛选**:动态阈值确保相关结果且无噪声
112
+ 4. **精确执行**:找到的工具可以直接执行并进行适当的参数验证
113
+
114
+ **设置要求:**
115
+
116
+ ![智能路由](assets/smart-routing.zh.png)
117
+
118
+ 为了启用智能路由,您需要:
119
+
120
+ - 支持 pgvector 扩展的 PostgreSQL
121
+ - OpenAI API 密钥(或兼容的嵌入服务)
122
+ - 在 MCPHub 设置中启用智能路由
123
+
124
+ **基于分组的 HTTP 端点(推荐)**:
125
+ ![分组](assets/group.zh.png)
126
+ 要针对特定服务器分组进行访问,请使用基于分组的 HTTP 端点:
127
+
128
+ ```
129
+ http://localhost:3000/mcp/{group}
130
+ ```
131
+
132
+ 其中 `{group}` 是您在控制面板中创建的分组 ID 或名称。这样做可以:
133
+
134
+ - 连接到按用例组织的特定 MCP 服务器子集
135
+ - 隔离不同的 AI 工具,使其只能访问相关服务器
136
+ - 为不同环境或团队实现更精细的访问控制
137
+ - 通过分组名称轻松识别和管理服务器
138
+ - 允许不同的 AI 客户端使用相同的端点,简化集成过程
139
+
140
+ **针对特定服务器的 HTTP 端点**:
141
+ 要针对特定服务器进行访问,请使用以下格式:
142
+
143
+ ```
144
+ http://localhost:3000/mcp/{server}
145
+ ```
146
+
147
+ 其中 `{server}` 是您要连接的服务器名称。这样做可以直接访问特定的 MCP 服务器。
148
+
149
+ > **提示**:如果服务器名称和分组名称相同,则分组名称优先。
150
+
151
+ ### SSE 端点集成 (未来可能废弃)
152
+
153
+ 通过以下地址连接 AI 客户端(如 Claude Desktop、Cursor、DeepChat 等):
154
+
155
+ ```
156
+ http://localhost:3000/sse
157
+ ```
158
+
159
+ 要启用智能路由,请使用:
160
+
161
+ ```
162
+ http://localhost:3000/sse/$smart
163
+ ```
164
+
165
+ 要针对特定服务器分组进行访问,请使用基于分组的 SSE 端点:
166
+
167
+ ```
168
+ http://localhost:3000/sse/{group}
169
+ ```
170
+
171
+ 要针对特定服务器进行访问,请使用以下格式:
172
+
173
+ ```
174
+ http://localhost:3000/sse/{server}
175
+ ```
176
+
177
+ ## 🧑‍💻 本地开发
178
+
179
+ ```bash
180
+ git clone https://github.com/samanhappy/mcphub.git
181
+ cd mcphub
182
+ pnpm install
183
+ pnpm dev
184
+ ```
185
+
186
+ 此命令将在开发模式下启动前后端,并启用热重载。
187
+
188
+ > 针对 Windows 用户,可能需要分别启动后端服务器和前端:`pnpm backend:dev`,`pnpm frontend:dev`。
189
+
190
+ ## 🛠️ 常见问题
191
+
192
+ ### 使用 nginx 反向代理
193
+
194
+ 如果您在使用 nginx 反向代理 MCPHub,请确保在 nginx 配置中添加以下内容:
195
+
196
+ ```nginx
197
+ proxy_buffering off
198
+ ```
199
+
200
+ ## 🔍 技术栈
201
+
202
+ - **后端**:Node.js、Express、TypeScript
203
+ - **前端**:React、Vite、Tailwind CSS
204
+ - **认证**:JWT & bcrypt
205
+ - **协议**:Model Context Protocol SDK
206
+
207
+ ## 👥 贡献指南
208
+
209
+ 期待您的贡献!
210
+
211
+ - 新功能与优化
212
+ - 文档完善
213
+ - Bug 报告与修复
214
+ - 翻译与建议
215
+
216
+ 欢迎加入企微交流共建群,由于群人数限制,有兴趣的同学可以扫码添加管理员为好友后拉入群聊。
217
+
218
+ <img src="assets/wexin.png" width="350">
219
+
220
+ 如果觉得项目有帮助,不妨请我喝杯咖啡 ☕️
221
+
222
+ <img src="assets/reward.png" width="350">
223
+
224
+ ## 致谢
225
+
226
+ 感谢以下人员的赞赏:小白、琛。你们的支持是我继续前进的动力!
227
+
228
+ ## 🌟 Star 历史趋势
229
+
230
+ [![Star History Chart](https://api.star-history.com/svg?repos=samanhappy/mcphub&type=Date)](https://www.star-history.com/#samanhappy/mcphub&Date)
231
+
232
+ ## 📄 许可证
233
+
234
+ 本项目采用 [Apache 2.0 许可证](LICENSE)。
articals/assets/sr-conf.png ADDED
articals/assets/sr-dc.png ADDED
articals/assets/sr-map-call.png ADDED
articals/assets/sr-map-result.png ADDED
articals/assets/sr-map-search.png ADDED
articals/assets/sr-servers.png ADDED
articals/assets/sr-time.png ADDED
articals/assets/sr-tools.png ADDED
articals/assets/sr-web.png ADDED
articals/intro.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 如何一键部署你的专属 MCP 服务
2
+
3
+ 随着 MCP 逐渐成为行业事实标准,如何高效搭建和管理多个 MCP 服务已成为个人开发者面临的主要挑战。本文将介绍一种简便的解决方案,帮助您快速构建自己的 MCP 服务。
4
+
5
+ ## 什么是 MCP?
6
+
7
+ 模型上下文协议(Model Context Protocol,MCP)是由 Anthropic 推出的开放标准,旨在为大型语言模型(LLMs)提供标准化接口,使其能够直接连接外部数据源和工具。简言之,MCP 如同 AI 应用的 USB-C 接口,统一解决了数据孤岛和定制化集成的问题。
8
+
9
+ 通过 MCP,AI 模型不仅可以实时获取最新信息,还能调用外部工具完成各类任务,实现跨平台、跨数据源的无缝交互,大幅提升 AI 应用的实用性和灵活性。
10
+
11
+ ## 当下的 MCP 生态
12
+
13
+ 尽管 MCP 的标准化接口为 AI 应用开发提供了便利,但在实际应用中,如何快速搭建和高效管理多个 MCP 服务仍然是一个不小的挑战。MCPHub 正是为解决这一痛点而诞生,它提供了集中管理和动态配置的解决方案,让个人开发者能够轻松应对多样化的需求,无需深入了解每个服务的具体实现细节。
14
+
15
+ ## 一键部署,轻松满足个人需求
16
+
17
+ 对于个人开发者而言,繁琐的部署流程常常成为创新的绊脚石。MCPHub 的最大亮点在于其"一键部署"功能:
18
+
19
+ - **极简部署**:只需一条 Docker 命令,即可在几分钟内启动完整的 MCPHub 服务,快速搭建专属 MCP 服务平台,满足个人项目或实验室环境的各种需求。
20
+
21
+ - **动态扩展**:在使用过程中,您可以随时通过 Web 仪表盘添加、移除或调整 MCP 服务器配置,无需重启整个系统。这种灵活性不仅适用于个人开发测试,也为未来功能扩展提供了无限可能。
22
+
23
+ - **标准化接口**:基于 MCP 标准,您的服务可以无缝对接各种 AI 工具,无论是 Claude Desktop、Cursor 还是其他定制化应用,都能通过统一接口调用外部数据或执行工具操作,实现真正的多源协同工作流程。
24
+
25
+ ## 快速上手指南
26
+
27
+ 下面,我们将以一个实例演示如何使用 MCPHub 快速搭建基于高德地图 MCP 服务的行程规划助手。
28
+
29
+ ### 使用 Docker 部署
30
+
31
+ 执行以下命令,即可在本地快速启动 MCPHub 服务:
32
+
33
+ ```bash
34
+ docker run -p 3000:3000 samanhappy/mcphub
35
+ ```
36
+
37
+ ### 访问仪表盘
38
+
39
+ MCPHub 已内置多个常用 MCP 服务,如高德地图、GitHub、Slack、Fetch、Tavily、Playwright 等,开箱即可使用。在浏览器中打开 `http://localhost:3000`,直观的仪表盘将实时显示各个 MCP 服务器的状态,让您轻松管理和监控服务运行情况。
40
+
41
+ ![仪表盘预览](../assets/dashboard.png)
42
+
43
+ 可以看到这些 MCP 服务都已成功连接并正常运行。
44
+
45
+ ### 配置高德地图
46
+
47
+ 由于高德地图的 MCP 服务需要 API Key,我们需要在仪表盘中进行配置。点击 amap-maps 右侧的 Edit 按钮,在弹出窗口的环境变量部分配置高德地图的 API Key。
48
+
49
+ ![配置高德地图](../assets/amap-edit.png)
50
+
51
+ 点击保存后,MCP Hub 将自动重启高德地图的 MCP 服务,使新配置生效。
52
+
53
+ ### 配置 MCP Hub SSE
54
+
55
+ MCP Hub 提供了单一聚合的 MCP Server SSE 端点:`http://localhost:3000/sse`,可在任意支持 MCP 的客户端中配置使用。这里我们选择开源的 Cherry Studio 进行演示。
56
+
57
+ ![配置 Cherry Studio](../assets/cherry-mcp.png)
58
+
59
+ 配置成功后,可用工具列表中将显示所有高德 MCP 服务支持的工具功能。
60
+
61
+ ### 使用高德地图 MCP 服务
62
+
63
+ 现在,我们可以在 Cherry Studio 中使用高德地图的 MCP 服务了。选择智源的 Qwen2.5-7B-Instruct 模型,并确保启用 MCP Server 开关,然后输入:"我明天要从南京去上海旅游,晚上想住在外滩附近,帮我规划一下交通和酒店行程",点击发送按钮。
64
+
65
+ ![高德地图行程规划](../assets/amap-result.png)
66
+
67
+ 可以看到,Cherry Studio 在回答过程中调用了高德地图 MCP 服务的多个工具,包括坐标解析、路线规划、周边搜索等,从而实现了一个更强大的行程规划助手。
68
+
69
+ ## 结语
70
+
71
+ MCPHub 的一键部署和动态配置功能,使个人开发者能够轻松搭建和管理多个 MCP 服务,极大地提升了开发效率和应用灵活性。无论是个人项目还是实验室环境,MCPHub 都能提供高效、便捷的解决方案。
72
+
73
+ 随着 MCP 生态的不断扩展,我们将持续增加更多服务和功能,为开发者提供更加丰富的工具集。MCPHub 完全开源,采用 MIT 许可证,项目地址 [https://github.com/samanhappy/mcphub](https://github.com/samanhappy/mcphub),期待您的体验与反馈,共同推动 MCP 生态的繁荣发展!
articals/intro2.md ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 本地部署、一键安装、分组路由:MCPHub 重塑 MCP 服务器体验
2
+
3
+ ## 概述
4
+
5
+ 现代 AI 应用场景中,将大模型(LLM)与各种数据源和工具无缝对接,往往需要手动编写大量胶水代码,并且无法快速复用​。MCP(Model Context Protocol)协议由 Anthropic 在 2024 年开源,旨在提供类似“USB‑C”接口般的标准化通信方式,简化 AI 助手与内容仓库、业务系统等的集成流程​。然而,MCP 服务器部署常常需要大量环境依赖、手动配置及持续运行,开发者常因安装和配置耗费大量时间和精力​。MCPHub 作为一款开源的一站式聚合平台,通过直观的 Web UI、Docker 镜像和热插拔配置,实现本地或容器里的“一键安装”与“分组路由”,大幅降低 MCP 服务器的使用门槛和运维成本​。
6
+
7
+ ## MCPHub 是什么
8
+
9
+ ### MCP 协议简介
10
+
11
+ Model Context Protocol(MCP)是一种开放标准,类似“USB‑C”接口,为 AI 助手与内容仓库、业务系统和第三方服务之间提供统一通信协议。它支持 stdio 与 SSE(最新协议中被 Streamable HTTP 取代)两种通信方式,既能满足实时流式数据交换,也可用于批量任务。2024 年由 Anthropic 团队开源发布后,MCP 已在各类 AI 客户端(如 Claude Desktop)中得到应用,成功实现与 GitHub、Slack、网页自动化工具等的无缝对接。
12
+
13
+ ### MCPHub 项目概览
14
+
15
+ MCPHub 是一个统一的 MCP 服务器聚合平台,内置 MCP 服务器市场实现一键安装。前端基于 React、Vite 和 Tailwind CSS 构建,后端兼容任意使用 npx 或 uvx 命令启动的 MCP 服务器。它通过一个集中式 Dashboard 实时展示各服务器的运行状态,并支持在运行时热插拔增删改服务器配置,无需停机维护。支持分组式访问控制,可以通过独立的 SSE 端点访问不同的 MCP 服务器组合,管理员可灵活定义不同团队或环境的权限策略。官方提供 Docker 镜像,仅需一条命令即可快速启动本地或云端服务。
16
+
17
+ ![MCPHub 控制面板](../assets/dashboard.zh.png)
18
+
19
+ ## 为什么要使用 MCPHub
20
+
21
+ ### 1. 复杂的环境依赖与配置
22
+
23
+ - MCP 服务器常依赖 Node.js、Python 等多种运行时,需手动维护大量命令、参数和环境变量。
24
+ - MCPHub 内置 MCP 服务器市场,包含众多常用 MCP 服务器,支持一键安装和自动配置,简化了环境搭建过程。
25
+ - 通过 Docker 部署,MCPHub 可在任何支持 Docker 的平台上运行,避免了环境不一致的问题。
26
+
27
+ ![MCPHub 市场](../assets/market.zh.png)
28
+
29
+ ### 2. 持续运行的服务压力
30
+
31
+ - MCP 要求长连接服务常驻内存,重启或升级时需要人工干预,缺乏弹性。
32
+ - 借助 Docker 容器化部署,MCPHub 可快速重建环境,享受容器带来的弹性与隔离优势。
33
+
34
+ ### 3. 路由与分组管理缺乏统一视图
35
+
36
+ - 传统方式下,很难可视化地将不同 MCP 服务按场景分类,容易造成 token 浪费和工具选择精度下降。
37
+ - MCPHub 支持动态创建分组(如“地图检索”、“网页自动化”、“聊天”等),为每个分组生成独立的 SSE 端点,实现各类用例的隔离与优化。
38
+
39
+ ![MCPHub 分组](../assets/group.zh.png)
40
+
41
+ ## 如何使用 MCPHub
42
+
43
+ ### 快速部署
44
+
45
+ ```bash
46
+ docker run -p 3000:3000 samanhappy/mcphub
47
+ ```
48
+
49
+ 一条命令就可以在本地快速启动 MCPHub,默认监听 3000 端口。
50
+
51
+ MCPHub 使用`mcp_settings.json`保存所有服务器、分组和用户的配置。你可以创建一个 `mcp_settings.json` 文件,并将其挂载到 Docker 容器中,以便在重启时保留配置。
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "amap": {
57
+ "command": "npx",
58
+ "args": ["-y", "@amap/amap-maps-mcp-server"],
59
+ "env": {
60
+ "AMAP_MAPS_API_KEY": "your-api-key"
61
+ }
62
+ },
63
+ "time-mcp": {
64
+ "command": "npx",
65
+ "args": [
66
+ "-y",
67
+ "time-mcp"
68
+ ]
69
+ },
70
+ "sequential-thinking": {
71
+ "command": "npx",
72
+ "args": [
73
+ "-y",
74
+ "@modelcontextprotocol/server-sequential-thinking"
75
+ ]
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ 然后挂载配置文件启动:
82
+
83
+ ```bash
84
+ docker run -p 3000:3000 -v $(pwd)/mcp_settings.json:/app/mcp_settings.json samanhappy/mcphub
85
+ ```
86
+
87
+ > 注意:首次运行时,MCPHub 会自动下载并安装所需的依赖包,可能需要一些时间。
88
+
89
+ ### 访问控制台
90
+
91
+ 启动后访问 `http://localhost:3000` 即可进入控制台。
92
+
93
+ > 默认登录用户名和密码为 `admin`/`admin123`,登录后可以修改密码以确保安全。
94
+
95
+ 控制台提供了服务器管理、分组管理和市场管理等功能,你可以在这里查看所有已安装的 MCP 服务器、创建新的分组、添加或删除服务器等。
96
+
97
+ ### 分组路由 & SSE 端点
98
+
99
+ #### 全局 SSE 端点
100
+
101
+ ```
102
+ http://localhost:3000/sse
103
+ ```
104
+
105
+ 通过全局 SSE 端点可以访问所有已启用的 MCP 服务器。
106
+
107
+ #### 基于分组的 SSE 端点
108
+
109
+ 除了全局 SSE 端点,MCPHub 还支持基于分组的 SSE 端点。你可以为每个分组创建独立的 SSE 端点,以便更好地管理和路由请求。
110
+ 分组的 SSE 端点格式如下:
111
+
112
+ ```
113
+ http://localhost:3000/sse/{groupId}
114
+ ```
115
+
116
+ 其中 `{groupId}` 是分组的唯一标识符,可以从控制台获取。比如我在上面的截图中创建了一个名为 `map` 的分组,选择了 `amap` 和 `sequential-thinking` 两个服务器,那么可以通过以下 URL 访问这个分组的 SSE 端点:
117
+
118
+ ```
119
+ http://localhost:3000/sse/a800bef7-c4c1-4460-9557-5f4404cdd0bd
120
+ ```
121
+
122
+ #### 使用分组路由
123
+
124
+ 创建了路由分组后,我们就可以在任意支持 MCP 的客户端中使用这个分组的 SSE 端点了。比如在 `Cursor` 中,我们可以在配置文件中指定分组的 SSE 端点:
125
+
126
+ ```json
127
+ {
128
+ "mcpServers": {
129
+ "mcphub": {
130
+ "url": "http://localhost:3000/sse/a800bef7-c4c1-4460-9557-5f4404cdd0bd"
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ 配置完成后,可以从 `Cursor` 中看到所有可用的 MCP 服务器工具列表。
137
+
138
+ ![Cursor 中的 MCP 配置](../assets/cursor-mcp.png)
139
+
140
+ 然后,我们可以测试一下,比如输入:深度思考一下,帮我制定一个五一假期从南京出发的自驾行出游计划,要求避开拥堵路线,结合天气情况,并且可以体验到不同的自然风光。
141
+
142
+ ![Cursor 中的测试输入](../assets/cursor-query.png)
143
+
144
+ 接着可以看到,`Cursor` 在运行过程中调用了多个工具。
145
+
146
+ ![Cursor 中的工具调用](../assets/cursor-tools.png)
147
+
148
+ 最终生成结果如下:
149
+
150
+ ```markdown
151
+ 基于对路线和天气的全面分析,我为你制定了一个四天的五一自驾游行程方案:
152
+
153
+ ### 第一天(4月29日):南京→黄山
154
+ - 出发时间:建议早上8点出发
155
+ - 行驶路线:G42沪蓉高速 → S11巢黄高速
156
+ - 行驶时间:约4.5小时(282公里)
157
+ - 住宿地点:黄山风景区附近
158
+ - 特别提醒:
159
+ * 路线多隧道,注意安全
160
+ * 天气较好,适合出行
161
+ * 建议提前订好黄山景区附近酒店
162
+
163
+ ### 第二天(4月30日):黄山→婺源
164
+ - 游览时间:上午游览黄山景区
165
+ - 下午出发前往婺源
166
+ - 行驶路线:G3京台高速 → G56杭瑞高速
167
+ - 行驶时间:约2.5小时(139公里)
168
+ - 住宿地点:婺源县城或特色古村落
169
+ - 特别提醒:
170
+ * 注意天气可能有阵雨
171
+ * 建议游览篁岭、李坑等著名古村落
172
+
173
+ ### 第三天(5月1日):婺源→景德镇
174
+ - 上午游览婺源景点
175
+ - 中午后出发前往景德镇
176
+ - 行驶路线:G56杭瑞高速
177
+ - 行驶时间:约1.5小时(77公里)
178
+ - 住宿地点:景德镇市区
179
+ - 特别提醒:
180
+ * 可能遇到阵雨天气
181
+ * 建议参观陶瓷博物馆和古窑址
182
+
183
+ ### 第四天(5月2日):景德镇→南京
184
+ - 建议上午游览景德镇景点
185
+ - 中午后出发返回南京
186
+ - 行驶路线:G35济广高速 → G4211宁芜高速
187
+ - 行驶时间:约5小时(429公里)
188
+ - 特别提醒:
189
+ * 路程较长,建议做好休息安排
190
+ * 注意途中加油站分布
191
+ * 建议错峰返程,避免拥堵
192
+
193
+ ### 整体建议:
194
+ 1. 避堵建议:
195
+ - 选择错峰出行时间
196
+ - 提前查看实时路况
197
+ - 准备备选绕行路线
198
+
199
+ 2. 安全建议:
200
+ - 全程多雨,注意雨天行车安全
201
+ - 保持车距,谨慎驾驶
202
+ - 途经隧道较多,注意灯光使用
203
+
204
+ 3. 行程准备:
205
+ - 提前预订住宿
206
+ - 准备雨具和应急用品
207
+ - 建议下载离线地图
208
+ - 检查车况,特别是雨刮和轮胎
209
+
210
+ 4. 景点安排:
211
+ - 黄山:建议游览迎客松、光明顶等
212
+ - 婺源:篁岭、李坑、江岭等
213
+ - 景德镇:陶瓷博物馆、古窑民俗博览区
214
+
215
+ 这条路线可以让你体验到:
216
+ - 黄山的壮丽山景
217
+ - 婺源的田园风光
218
+ - 景德镇的人文历史
219
+ 既避开了主要拥堵路段,又能欣赏到不同的自然风光。
220
+ ```
221
+
222
+ 可以看到,`Cursor` 通过调用 `amap` 和 `sequential-thinking` 两个服务器,成功生成了一个五一假期的自驾游行程方案,并且避开了拥堵路线,结合了天气情况。但是细心的同学可能发现,计划中的开始时间是 4 月 29 日,而今年的五一假期是 5 月 1 日开始的,产生偏差的原因是 `sequential-thinking` 使用了错误的假期时间。如何解决这个问题呢?我们可以尝试在分组中添加支持搜索的 MCP 服务器,这样就可以在查询时自动纠正错误的假期时间了,具体就不在这里展开了。
223
+
224
+ ## 结语
225
+
226
+ MCPHub 将本地部署、一键安装、分组路由和可视化管理融为一体,以简洁而强大的设计,彻底解决了 MCP 服务器的部署、配置与运维难题。无论是追求快速验证的开发者,还是需要稳定可靠 AI 工具链的企业用户,都能通过 MCPHub 专注于核心业务与创新,而无需被底层细节所困扰。
227
+
228
+ 尽管目前各家平台都在陆续推出各类 MCP 云服务,但在数据隐私、合规性和定制化需求日益增长的背景下,MCPHub 仍然是一个值得关注的本地部署解决方��​。
229
+
230
+ MCPHub 只是我一时兴起开发的小项目,没想到竟收获了这么多关注,非常感谢大家的支持!目前 MCPHub 还有不少地方需要优化和完善,我也专门建了个交流群,方便大家交流反馈。如果你也对这个项目感兴趣,欢迎一起参与建设!项目地址为:https://github.com/samanhappy/mcphub。
231
+
232
+ ![企业微信交流群](../assets/wegroup.jpg)
articals/smart-routing.md ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 无限工具,智能路由:MCPHub 引领 AI 工具使用新范式
2
+
3
+ ## 概述
4
+
5
+ 在现代 AI 应用中,随着 MCP 服务器数量的快速增长和工具种类的不断丰富,如何从数百个可用工具中快速定位最适合当前任务的工具,成为开发者和 AI 助手面临的一项重要挑战。
6
+
7
+ 传统做法要么将所有工具暴露给 AI 助手处理,导致 token 消耗巨大、响应延迟严重;要么依赖开发者手动分组配置,灵活性和智能性不足。
8
+
9
+ MCPHub 推出的智能路由功能,基于向量语义搜索技术,实现了自然语言驱动的工具发现与精准推荐。它让 AI 助手能够像人类专家一样,根据任务描述自动选择最优工具组合,大幅提升了系统效率和用户体验。
10
+
11
+ ## 什么是智能路由
12
+
13
+ ### 技术原理
14
+
15
+ 智能路由是 MCPHub 的核心功能之一。它将每个 MCP 工具的名称和描述嵌入为高维语义向量。当用户发起自然语言任务请求时,系统会将该请求也转换为向量,通过计算相似度,快速返回最相关的工具列表。
16
+
17
+ 这一过程摒弃了传统的关键词匹配,具备更强的语义理解能力,能够处理自然语言的模糊性和多样性。
18
+
19
+ ### 核心组件
20
+
21
+ - **向量嵌入引擎**:支持如 `text-embedding-3-small`、`bge-m3` 等主流模型,将文本描述转为语义向量。
22
+ - **PostgreSQL + pgvector**:使用开源向量数据库方案,支持高效的向量索引和搜索。
23
+ - **两步工作流分离**:
24
+ - `search_tools`:负责语义工具发现
25
+ - `call_tool`:执行实际工具调用逻辑
26
+
27
+ ## 为什么需要智能路由
28
+
29
+ ### 1. 减少认知负荷
30
+
31
+ - 当工具数量超过 100 个,AI 模型难以处理所有工具上下文。
32
+ - 智能路由通过语义压缩,将候选工具缩小至 5~10 个,提高决策效率。
33
+
34
+ ### 2. 显著降低 token 消耗
35
+
36
+ - 传统做法传入全量工具描述,可能消耗上千 token。
37
+ - 使用智能路由,通常可将 token 使用降低 70~90%。
38
+
39
+ ### 3. 提升调用准确率
40
+
41
+ - 理解任务语义:如“图片增强”→选择图像处理工具,而不是依赖命名关键词。
42
+ - 上下文感知:考虑输入/输出格式和工具组合能力,匹配更合理的执行链路。
43
+
44
+ ## 智能路由配置指南
45
+
46
+ ### 1. 启动支持 `pgvector` 的 PostgreSQL 数据库
47
+
48
+ ```bash
49
+ docker run --name mcphub-postgres \
50
+ -e POSTGRES_DB=mcphub \
51
+ -e POSTGRES_USER=mcphub \
52
+ -e POSTGRES_PASSWORD=your_password \
53
+ -p 5432:5432 \
54
+ -d pgvector/pgvector:pg17
55
+ ```
56
+
57
+ 如已部署 PostgreSQL,可直接创建数据库并启用 `pgvector` 扩展:
58
+
59
+ ```sql
60
+ CREATE DATABASE mcphub;
61
+ CREATE EXTENSION vector;
62
+ ```
63
+
64
+ ### 2. 获取 embedding 模型的 API Key
65
+
66
+ 前往 OpenAI 或其他提供商获取嵌入模型的 API Key。国内用户推荐使用硅基流动 `bge-m3` 免费模型,没有注册过的用户可以使用我的邀请链接:[https://cloud.siliconflow.cn/i/TQhVYBvA](https://cloud.siliconflow.cn/i/TQhVYBvA)。
67
+
68
+ ### 3. 控制台配置
69
+
70
+ ![配置](./assets/sr-conf.png)
71
+
72
+ 在 MCPHub 控制台中,进入「智能路由」配置页面,填写以下信息:
73
+
74
+ - **数据库 URL**:`postgresql://mcphub:your_password@localhost:5432/mcphub`
75
+ - **OpenAI API Key** :填写你获取的嵌入模型 API Key
76
+ - **OpenAI 基础 URL**:`https://api.siliconflow.cn/v1`
77
+ - **嵌入模型**:推荐使用 `BAAI/bge-m3`
78
+
79
+ 开启「启用智能路由」后系统会自动:
80
+
81
+ - 对所有工具生成向量嵌入
82
+ - 构建向量索引
83
+ - 自动监听新增工具,更新索引
84
+
85
+ ## 工具定义
86
+
87
+ ### search_tools - 工具搜索
88
+
89
+ ```ts
90
+ {
91
+ "name": "search_tools",
92
+ "arguments": {
93
+ "query": "help me resize and convert images",
94
+ "limit": 10
95
+ }
96
+ }
97
+ ```
98
+
99
+ ### call_tool - 工具执行
100
+
101
+ ```ts
102
+ {
103
+ "name": "call_tool",
104
+ "arguments": {
105
+ "toolName": "image_resizer",
106
+ "arguments": {
107
+ "input_path": "/path/to/image.png",
108
+ "width": 800,
109
+ "height": 600
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ ## 演示
116
+
117
+ 下面我将通过几个示例来展示如何使用智能路由。
118
+
119
+ 首先,我们需要在 mcphub 添加几个不同类型的 MCP 服务器:`amap`、`time-map`、`fetch`。
120
+
121
+ ![添加服务器](./assets/sr-servers.png)
122
+
123
+ 然后我们需要选择一个支持 MCP 的客户端,这里选择国产的 DeepChat,聊天模型选择 `Qwen3-14B`。
124
+
125
+ 接着,在 DeepChat 中添加 mcphub 的智能路由端点:
126
+
127
+ ![添加智能路由](./assets/sr-dc.png)
128
+
129
+ 添加成功后,就可以在工具中看到 `search_tools` 和 `call_tool` 两个工具了:
130
+
131
+ ![工具列表](./assets/sr-tools.png)
132
+
133
+ ### 示例 1:地图导航
134
+
135
+ 输入:从北京如何导航到上海。
136
+
137
+ 结果:
138
+
139
+ ![地图导航](./assets/sr-map-result.png)
140
+
141
+ 可以看到,DeepChat 先调用了 `search_tools` 工具:
142
+
143
+ ![搜索工具](./assets/sr-map-search.png)
144
+
145
+ 然后再调用 `call_tool` 查询具体的导航信息:
146
+
147
+ ![调用工具](./assets/sr-map-call.png)
148
+
149
+ ### 示例 2:查询时间
150
+
151
+ 输入:使用工具查询美国现在���时间是几点
152
+
153
+ 结果:
154
+
155
+ ![查询时间](./assets/sr-time.png)
156
+
157
+ 需要说明的是,由于不同的模型对工具调用的支持程度不同,可能会出现一些差异。比如在这个例子中,为了提高准确性,我在输入中明确提到了“使用工具”。
158
+
159
+ ### 示例 3:查看网页
160
+
161
+ 输入:打开 baidu.com 看看有什么
162
+
163
+ 结果:
164
+
165
+ ![查看网页](./assets/sr-web.png)
166
+
167
+ 可以看到,DeepChat 成功调用了工具,不过由于百度的 robots.txt 限制,无法获取到具体内容。
168
+
169
+ ## 结语
170
+
171
+ 借助 MCPHub 的智能路由功能,AI 助手能够更高效地处理复杂任务,显著减少不必要的 token 消耗,同时提升工具调用的准确性与灵活性。作为面向未来的 AI 工具发现与调用基础设施,智能路由不仅使 AI 更聪明地选择和组合工具,还为多 Agent 协同提供了清晰、可控且可扩展的底层能力支撑。
172
+
173
+ > MCPHub 只是我一时兴起开发的小项目,没想到收获了这么多关注,非常感谢大家的支持!目前 MCPHub 还有不少地方需要优化和完善,我也专门建了个交流群,感兴趣的可以添加下面的微信。
174
+
175
+ ![微信](../assets/wexin.png)
176
+
177
+ > 同时,欢迎大家一起参与建设!项目地址为:[https://github.com/samanhappy/mcphub](https://github.com/samanhappy/mcphub)。
assets/amap-edit.png ADDED
assets/amap-result.png ADDED
assets/cherry-mcp.png ADDED
assets/cursor-mcp.png ADDED
assets/cursor-query.png ADDED
assets/cursor-tools.png ADDED
assets/dashboard.png ADDED
assets/dashboard.zh.png ADDED
assets/group.png ADDED
assets/group.zh.png ADDED
assets/market.zh.png ADDED
assets/reward.png ADDED
assets/smart-routing.png ADDED
assets/smart-routing.zh.png ADDED
assets/wegroup.jpg ADDED
assets/wegroup.png ADDED
assets/wexin.png ADDED
bin/cli.js ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import { execSync } from 'child_process';
6
+ import fs from 'fs';
7
+
8
+ // Enable debug logging if needed
9
+ // process.env.DEBUG = 'true';
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+
14
+ // Start with more debug information
15
+ console.log('📋 MCPHub CLI');
16
+ console.log(`📁 CLI script location: ${__dirname}`);
17
+
18
+ // The npm package directory structure when installed is:
19
+ // node_modules/@samanhappy/mcphub/
20
+ // - dist/
21
+ // - bin/
22
+ // - frontend/dist/
23
+
24
+ // Get the package root - this is where package.json is located
25
+ function findPackageRoot() {
26
+ const isDebug = process.env.DEBUG === 'true';
27
+
28
+ // Possible locations for package.json
29
+ const possibleRoots = [
30
+ // Standard npm package location
31
+ path.resolve(__dirname, '..'),
32
+ // When installed via npx
33
+ path.resolve(__dirname, '..', '..', '..')
34
+ ];
35
+
36
+ // Special handling for npx
37
+ if (process.argv[1] && process.argv[1].includes('_npx')) {
38
+ const npxDir = path.dirname(process.argv[1]);
39
+ possibleRoots.unshift(path.resolve(npxDir, '..'));
40
+ }
41
+
42
+ if (isDebug) {
43
+ console.log('DEBUG: Checking for package.json in:', possibleRoots);
44
+ }
45
+
46
+ for (const root of possibleRoots) {
47
+ const packageJsonPath = path.join(root, 'package.json');
48
+ if (fs.existsSync(packageJsonPath)) {
49
+ try {
50
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
51
+ if (pkg.name === 'mcphub' || pkg.name === '@samanhappy/mcphub') {
52
+ if (isDebug) {
53
+ console.log(`DEBUG: Found package.json at ${packageJsonPath}`);
54
+ }
55
+ return root;
56
+ }
57
+ } catch (e) {
58
+ // Continue to the next potential root
59
+ }
60
+ }
61
+ }
62
+
63
+ console.log('⚠️ Could not find package.json, using default path');
64
+ return path.resolve(__dirname, '..');
65
+ }
66
+
67
+ // Locate and check the frontend distribution
68
+ function checkFrontend(packageRoot) {
69
+ const isDebug = process.env.DEBUG === 'true';
70
+ const frontendDistPath = path.join(packageRoot, 'frontend', 'dist');
71
+
72
+ if (isDebug) {
73
+ console.log(`DEBUG: Checking frontend at: ${frontendDistPath}`);
74
+ }
75
+
76
+ if (fs.existsSync(frontendDistPath) && fs.existsSync(path.join(frontendDistPath, 'index.html'))) {
77
+ console.log('✅ Frontend distribution found');
78
+ return true;
79
+ } else {
80
+ console.log('⚠️ Frontend distribution not found at', frontendDistPath);
81
+ return false;
82
+ }
83
+ }
84
+
85
+ const projectRoot = findPackageRoot();
86
+ console.log(`📦 Using package root: ${projectRoot}`);
87
+
88
+ // Check if frontend exists
89
+ checkFrontend(projectRoot);
90
+
91
+ // Start the server
92
+ console.log('🚀 Starting MCPHub server...');
93
+ import(path.join(projectRoot, 'dist', 'index.js')).catch(err => {
94
+ console.error('Failed to start MCPHub:', err);
95
+ process.exit(1);
96
+ });
docs/README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Mintlify Starter Kit
2
+
3
+ Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including
4
+
5
+ - Guide pages
6
+ - Navigation
7
+ - Customizations
8
+ - API Reference pages
9
+ - Use of popular components
10
+
11
+ ### Development
12
+
13
+ Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command
14
+
15
+ ```
16
+ npm i -g mintlify
17
+ ```
18
+
19
+ Run the following command at the root of your documentation (where docs.json is)
20
+
21
+ ```
22
+ mintlify dev
23
+ ```
24
+
25
+ ### Publishing Changes
26
+
27
+ Install our Github App to auto propagate changes from your repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard.
28
+
29
+ #### Troubleshooting
30
+
31
+ - Mintlify dev isn't running - Run `mintlify install` it'll re-install dependencies.
32
+ - Page loads as a 404 - Make sure you are running in a folder with `docs.json`
docs/api-reference/endpoint/create.mdx ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ---
2
+ title: 'Create Plant'
3
+ openapi: 'POST /plants'
4
+ ---
docs/api-reference/endpoint/delete.mdx ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ---
2
+ title: 'Delete Plant'
3
+ openapi: 'DELETE /plants/{id}'
4
+ ---
docs/api-reference/endpoint/get.mdx ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ---
2
+ title: 'Get Plants'
3
+ openapi: 'GET /plants'
4
+ ---