Skip to content

Commit e223056

Browse files
committed
feat: implement UI registry and custom UI support for tools
- Added UIRegistry class to manage custom and default UI HTML for tools. - Integrated custom UI support in the Server and ToolBase classes. - Created ListDatabases tool with a corresponding UI component. - Introduced Vite configuration for building UI components and generating HTML entries. - Updated TypeScript configuration to support JSX and include UI components. - Enhanced package.json with new dependencies for React and Vite. - Updated .gitignore to exclude generated UI files.
1 parent 7e32ef1 commit e223056

File tree

19 files changed

+2839
-251
lines changed

19 files changed

+2839
-251
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
dist
22
node_modules
3+
34
.vscode/mcp.json
45
.github/prompts/*
56

package.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
"types": "./dist/cjs/tools/index.d.ts",
2626
"default": "./dist/cjs/tools/index.js"
2727
}
28+
},
29+
"./ui": {
30+
"import": {
31+
"types": "./dist/esm/ui/index.d.ts",
32+
"default": "./dist/esm/ui/index.js"
33+
},
34+
"require": {
35+
"types": "./dist/cjs/ui/index.d.ts",
36+
"default": "./dist/cjs/ui/index.js"
37+
}
2838
}
2939
},
3040
"main": "./dist/cjs/lib.js",
@@ -51,8 +61,9 @@
5161
"build:update-package-version": "tsx scripts/updatePackageVersion.ts",
5262
"build:esm": "tsc --project tsconfig.esm.json && chmod +x dist/esm/index.js",
5363
"build:cjs": "tsc --project tsconfig.cjs.json",
64+
"build:ui": "vite build --config vite.ui.config.ts",
5465
"build:universal-package": "tsx scripts/createUniversalPackage.ts",
55-
"build": "pnpm run build:clean && concurrently \"pnpm run build:esm\" \"pnpm run build:cjs\" && pnpm run build:universal-package",
66+
"build": "pnpm run build:clean && concurrently \"pnpm run build:esm\" \"pnpm run build:cjs\" && pnpm run build:ui && pnpm run build:universal-package",
5667
"inspect": "pnpm run build && mcp-inspector -- dist/esm/index.js",
5768
"prettier": "prettier",
5869
"check": "concurrently \"pnpm run build\" \"pnpm run check:types\" \"pnpm run check:lint\" \"pnpm run check:format\" \"pnpm run check:dependencies\"",
@@ -86,9 +97,12 @@
8697
"@types/express": "^5.0.3",
8798
"@types/node": "^24.5.2",
8899
"@types/proper-lockfile": "^4.1.4",
100+
"@types/react": "^18.0.0",
101+
"@types/react-dom": "^19.2.3",
89102
"@types/semver": "^7.7.0",
90103
"@types/yargs-parser": "^21.0.3",
91104
"@typescript-eslint/parser": "^8.44.0",
105+
"@vitejs/plugin-react": "^5.1.1",
92106
"@vitest/coverage-v8": "^3.2.4",
93107
"@vitest/eslint-plugin": "^1.3.4",
94108
"concurrently": "^9.2.1",
@@ -112,9 +126,15 @@
112126
"typescript": "^5.9.2",
113127
"typescript-eslint": "^8.41.0",
114128
"uuid": "^13.0.0",
129+
"vite": "^5.4.21",
130+
"vite-plugin-node-polyfills": "^0.24.0",
131+
"vite-plugin-singlefile": "^2.3.0",
115132
"vitest": "^3.2.4"
116133
},
117134
"dependencies": {
135+
"@emotion/css": "^11.13.5",
136+
"@leafygreen-ui/table": "^15.2.2",
137+
"@mcp-ui/server": "^5.13.1",
118138
"@modelcontextprotocol/sdk": "^1.24.2",
119139
"@mongodb-js/device-id": "^0.3.1",
120140
"@mongodb-js/devtools-proxy-support": "^0.5.3",
@@ -132,6 +152,8 @@
132152
"node-machine-id": "1.1.12",
133153
"oauth4webapi": "^3.8.0",
134154
"openapi-fetch": "^0.15.0",
155+
"react": "^18.0.0",
156+
"react-dom": "^18.0.0",
135157
"ts-levenshtein": "^1.0.7",
136158
"voyage-ai-provider": "^2.0.0",
137159
"zod": "^3.25.76"

0 commit comments

Comments
 (0)