@loop_ouroboros/mcp-hub-lite 1.1.1 → 1.2.0
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/CHANGELOG.md +141 -0
- package/README.md +74 -116
- package/dist/server/src/cli/commands/mcp-tool-use.d.ts +62 -0
- package/dist/server/src/cli/commands/mcp-tool-use.d.ts.map +1 -0
- package/dist/server/src/cli/commands/mcp-tool-use.js +174 -0
- package/dist/server/src/cli/commands/tool-use.d.ts +95 -0
- package/dist/server/src/cli/commands/tool-use.d.ts.map +1 -0
- package/dist/server/src/cli/commands/tool-use.js +255 -0
- package/dist/server/src/cli/index.d.ts +4 -2
- package/dist/server/src/cli/index.d.ts.map +1 -1
- package/dist/server/src/cli/index.js +35 -3
- package/dist/server/src/config/config-loader.js +1 -1
- package/dist/server/src/config/config-manager.js +1 -1
- package/dist/server/src/models/system-tools.constants.d.ts +2 -2
- package/dist/server/src/models/system-tools.constants.d.ts.map +1 -1
- package/dist/server/src/models/system-tools.constants.js +2 -2
- package/dist/server/src/services/connection/tool-cache.d.ts.map +1 -1
- package/dist/server/src/services/connection/tool-cache.js +3 -1
- package/dist/server/src/services/gateway/request-handlers/system-tools-handler.js +2 -2
- package/dist/server/src/services/hub-tools/system-tool-definitions.d.ts +1 -0
- package/dist/server/src/services/hub-tools/system-tool-definitions.d.ts.map +1 -1
- package/dist/server/src/services/hub-tools/system-tool-definitions.js +4 -3
- package/dist/server/src/services/hub-tools.service.d.ts +3 -2
- package/dist/server/src/services/hub-tools.service.d.ts.map +1 -1
- package/dist/server/src/services/hub-tools.service.js +36 -19
- package/dist/server/src/services/system-tool-handler.js +2 -2
- package/dist/server/src/utils/index.d.ts +1 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/src/utils/index.js +1 -0
- package/dist/server/src/utils/name-converter.d.ts +17 -0
- package/dist/server/src/utils/name-converter.d.ts.map +1 -0
- package/dist/server/src/utils/name-converter.js +27 -0
- package/dist/server/tests/unit/services/hub-tools.service.test.js +1 -1
- package/dist/server/tests/unit/utils/name-converter.test.d.ts +2 -0
- package/dist/server/tests/unit/utils/name-converter.test.d.ts.map +1 -0
- package/dist/server/tests/unit/utils/name-converter.test.js +69 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,146 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-04-14
|
|
4
|
+
|
|
5
|
+
- **CLI Fix**: Fix CLI entry detection for Windows/npm symlink environments
|
|
6
|
+
- **CLI Refactor**: Fix command count and rename mcpToolUseCommand to toolUseCommand
|
|
7
|
+
- **Config Refactor**: Change config loading logs from info to debug level
|
|
8
|
+
- **Docs**: Complete CLAUDE.md documentation for all submodules
|
|
9
|
+
- **Test**: Add unit tests for normalizeToolName function
|
|
10
|
+
- **System Tools Refactor**: Rename list_tools_in_server to list_tools
|
|
11
|
+
- **Core Feature**: Add normalizeToolName for cross-format tool name matching
|
|
12
|
+
- **CLI Feature**: Add tool-use command for MCP server tool operations
|
|
13
|
+
- **Version**: Bump version to 1.1.1
|
|
14
|
+
- **Gateway Feature**: Implement per-request transport mode to fix connection errors
|
|
15
|
+
|
|
16
|
+
## 2026-04-13
|
|
17
|
+
|
|
18
|
+
- **Deps**: Add undici dependency for HTTP transport
|
|
19
|
+
- **Frontend Fix**: Prevent runtime error when tool is undefined in groupedTools
|
|
20
|
+
- **Version**: Bump version to 1.1.0
|
|
21
|
+
- **Core Refactor**: Use composite key serverName-serverIndex instead of serverId
|
|
22
|
+
- **Resource Feature**: Implement MCP native resource forwarding
|
|
23
|
+
- **Docs**: Update search functionality description in CLAUDE.md
|
|
24
|
+
- **Hub Tools Refactor**: Add non-strict mode to selectBestInstance
|
|
25
|
+
- **Search Refactor**: Remove complex search module, simplify to string matching
|
|
26
|
+
- **Test Refactor**: Remove evaluation tests not compliant with MCP spec
|
|
27
|
+
|
|
28
|
+
## 2026-04-12
|
|
29
|
+
|
|
30
|
+
- **Config Refactor**: Move instance selection strategy to template
|
|
31
|
+
- **Frontend Refactor**: Improve type declarations and test type safety
|
|
32
|
+
- **Frontend Refactor**: Compute instance counts from server.instances directly
|
|
33
|
+
- **Gateway Feature**: Restrict call_tool from invoking system tools
|
|
34
|
+
- **Docs**: Compress use-guide from 13 to 7 sections
|
|
35
|
+
- **Gateway Fix**: Return 400 for missing Accept header
|
|
36
|
+
|
|
37
|
+
## 2026-04-10
|
|
38
|
+
|
|
39
|
+
- **Transport Refactor**: Use official SDK StdioClientTransport
|
|
40
|
+
- **Stdio Transport Refactor**: Log non-JSON-RPC stdout and unify stderr log level
|
|
41
|
+
- **Frontend Fix**: Fix tools and resources not displaying in server detail
|
|
42
|
+
- **Frontend Fix**: Add description field to ConfigTemplateForm
|
|
43
|
+
- **Tools Fix**: Handle nested toolArgs in updateServerDescription
|
|
44
|
+
|
|
45
|
+
## 2026-04-09
|
|
46
|
+
|
|
47
|
+
- **Security Feature**: Mask sensitive values in config change logs
|
|
48
|
+
- **Frontend Fix**: Improve instance status reactivity and management
|
|
49
|
+
- **i18n Fix**: Improve noToolsFound message to reflect tool aggregation
|
|
50
|
+
- **Frontend Fix**: Add bottom padding to prevent save button cutoff on scroll
|
|
51
|
+
- **Gateway Refactor**: Extract version and protocol version to shared utility
|
|
52
|
+
- **Config Refactor**: Unify instance ID generation with content hash
|
|
53
|
+
|
|
54
|
+
## 2026-04-08
|
|
55
|
+
|
|
56
|
+
- **MCP Status Fix**: Prevent automatic enabled field updates on connect/disconnect
|
|
57
|
+
- **Chore**: Update .gitignore to ignore .full-review directory
|
|
58
|
+
|
|
59
|
+
## 2026-04-07
|
|
60
|
+
|
|
61
|
+
- **Frontend Fix**: Fix TypeScript type errors in component event handlers
|
|
62
|
+
|
|
63
|
+
## 2026-04-04
|
|
64
|
+
|
|
65
|
+
- **Test Refactor**: Simplify ServerStatusTags tests with mocks
|
|
66
|
+
- **Config Feature**: Sort env and headers keys on config save
|
|
67
|
+
- **Proxy Feature**: Add proxy configuration support for SSE and Streamable HTTP transports
|
|
68
|
+
|
|
69
|
+
## 2026-04-03
|
|
70
|
+
|
|
71
|
+
- **Config Feature**: Sort env and headers keys on config save
|
|
72
|
+
- **Config Refactor**: Optimize updateServerInstance logging
|
|
73
|
+
- **Connection Refactor**: Improve serverId handling and protocol version support
|
|
74
|
+
|
|
75
|
+
## 2026-04-02
|
|
76
|
+
|
|
77
|
+
- **Docs**: Update CLAUDE.md documentation for logging and composables
|
|
78
|
+
- **Logging Refactor**: Enhance transport logging with serverId context
|
|
79
|
+
- **Transports Feature**: Add LineBuffer for proper stderr line buffering
|
|
80
|
+
- **Logging Refactor**: Enhance logging module and configuration change tracking
|
|
81
|
+
- **Docs**: Update CLAUDE.md documentation for v1.1 config refactor
|
|
82
|
+
|
|
83
|
+
## 2026-04-01
|
|
84
|
+
|
|
85
|
+
- **Config Refactor**: Complete v1.1 multi-instance configuration refactoring
|
|
86
|
+
- **Docs**: Update CLAUDE.md files to reflect session removal
|
|
87
|
+
- **Session Refactor**: Remove session persistence mechanism and use SDK native stateless mode
|
|
88
|
+
- **Session Refactor**: Remove session persistence mechanism
|
|
89
|
+
|
|
90
|
+
## 2026-03-31
|
|
91
|
+
|
|
92
|
+
- **UI Fix**: Ensure log viewer area fills available container height
|
|
93
|
+
- **Frontend Feature**: Add instance tab routing synchronization
|
|
94
|
+
|
|
95
|
+
## 2026-03-29
|
|
96
|
+
|
|
97
|
+
- **i18n Fix**: Correct missing translation key in InstanceConfig component
|
|
98
|
+
|
|
99
|
+
## 2026-03-28
|
|
100
|
+
|
|
101
|
+
- **Hub Tools Feature**: Implement instance selection strategies
|
|
102
|
+
|
|
103
|
+
## 2026-03-27
|
|
104
|
+
|
|
105
|
+
- **Docs**: Update CLAUDE.md files across project modules
|
|
106
|
+
- **Session Feature**: Remove cwd and project fields from session management
|
|
107
|
+
- **UI Fix**: Optimize instance list display in English and hide redundant Running tag
|
|
108
|
+
- **Config Fix**: Ensure server instance indexes from config load and migration
|
|
109
|
+
|
|
110
|
+
## 2026-03-26
|
|
111
|
+
|
|
112
|
+
- **Config Feature**: Implement v1.1 instance configuration system
|
|
113
|
+
|
|
114
|
+
## 2026-03-25
|
|
115
|
+
|
|
116
|
+
- **Config Fix**: Support string index type for server instance operations
|
|
117
|
+
- **Docs**: Update CLAUDE.md files to reflect recent v1.1 config changes
|
|
118
|
+
- **Config Feature**: Enhance instance management with display name and route selection
|
|
119
|
+
|
|
120
|
+
## 2026-03-24
|
|
121
|
+
|
|
122
|
+
- **Config Refactor**: Activate v1.1 config format with instance support
|
|
123
|
+
- **Gateway Fix**: Only include tools from servers with allowedTools configured
|
|
124
|
+
- **Hub Tools Fix**: Support both toolArgs and arguments for backward compatibility
|
|
125
|
+
|
|
126
|
+
## 2026-03-23
|
|
127
|
+
|
|
128
|
+
- **Config Refactor**: Activate v1.1 config format, remove v1.0 compatibility code
|
|
129
|
+
- **Config Feature**: Add empty value cleaning when saving config
|
|
130
|
+
|
|
131
|
+
## 2026-03-20
|
|
132
|
+
|
|
133
|
+
- **UI Fix**: Correct dark mode background color and refine instance UI
|
|
134
|
+
- **UI Feature**: Add server instance management UI components
|
|
135
|
+
- **Config Feature**: Add index and displayName to ServerInstanceConfig with reassignment API
|
|
136
|
+
- **UI Feature**: Add tag management UI with TagManager component
|
|
137
|
+
- **Config Feature**: Add v1.1 config schema with auto-migration support
|
|
138
|
+
|
|
139
|
+
## 2026-03-19
|
|
140
|
+
|
|
141
|
+
- **i18n Fix**: Fix headers label and add button text in server config
|
|
142
|
+
- **UI Feature**: Add description field support in AddServerModal
|
|
143
|
+
|
|
3
144
|
## 2026-03-17
|
|
4
145
|
|
|
5
146
|
- **UI Enhancement**: Update resource detail and list views with hub tools integration
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# MCP-HUB-LITE
|
|
2
2
|
|
|
3
|
-
[![License]
|
|
4
|
-
[![Node.js]
|
|
5
|
-
[![TypeScript]
|
|
6
|
-
[![Vitest]
|
|
7
|
-
[![Fastify]
|
|
8
|
-
[![Vue.js]
|
|
9
|
-
[![Claude Code]
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://vitest.dev/)
|
|
7
|
+
[](https://fastify.io/)
|
|
8
|
+
[](https://vuejs.org/)
|
|
9
|
+
[](https://claude.ai/code)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
***
|
|
12
12
|
|
|
13
13
|
[中文文档](./README_zh.md)
|
|
14
14
|
|
|
@@ -18,32 +18,22 @@ A lightweight MCP management platform designed for independent developers, provi
|
|
|
18
18
|
|
|
19
19
|
MCP-HUB-LITE is an MCP server gateway designed specifically for independent developers. It acts as a proxy between your frontend and multiple backend MCP servers, providing a unified access interface with support for the MCP JSON-RPC 2.0 protocol.
|
|
20
20
|
|
|
21
|
-
### Dashboard
|
|
22
|
-
|
|
23
|
-

|
|
24
|
-
|
|
25
21
|
### Core Features
|
|
26
22
|
|
|
27
23
|
- **MCP Gateway Service**: Unified proxy interface for multiple backend MCP servers
|
|
24
|
+
- **MCP CLI Tool**: Command-line tool for listing and calling MCP tools across servers
|
|
28
25
|
- **Server Management**: Manage multiple MCP servers through a web interface
|
|
29
|
-
- **Tool Search**:
|
|
26
|
+
- **Tool Search**: Search and tool discovery across all servers with aggregation
|
|
30
27
|
- **Process Management**: Launch and manage MCP server processes via npx/uvx
|
|
31
|
-
- **Session Management**:
|
|
28
|
+
- **Session Management**: Native stateless session management via MCP SDK
|
|
29
|
+
- **Multi-Instance Support**: Run multiple instances of the same MCP server with load balancing
|
|
30
|
+
- **Instance Selection Strategies**: Support random, round-robin, and unique-by-tag selection
|
|
32
31
|
- **Tag System**: Organize multiple MCP servers by environment, category, function, etc.
|
|
33
32
|
- **Fault Tolerance**: System continues to operate when individual servers fail
|
|
34
33
|
- **Bilingual Interface**: Support for Chinese/English interface switching
|
|
35
34
|
- **Configuration Management**: Support for hot-reloading and maintenance of `.mcp-hub.json`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- **TypeScript 5.x** + Node.js 22.x
|
|
40
|
-
- **Fastify**: High-performance HTTP server
|
|
41
|
-
- **MCP SDK**: Official MCP protocol support (@modelcontextprotocol/sdk)
|
|
42
|
-
- **Vitest**: Unit testing framework
|
|
43
|
-
- **Zod**: Data validation
|
|
44
|
-
- **Vue 3**: Frontend UI framework
|
|
45
|
-
- **Pinia**: Frontend state management
|
|
46
|
-
- **Element Plus**: UI component library
|
|
35
|
+
- **MCP Native Resources**: Forward resource calls to backend MCP servers
|
|
36
|
+
- **Security**: Mask sensitive values in config change logs
|
|
47
37
|
|
|
48
38
|
## Quick Start
|
|
49
39
|
|
|
@@ -93,7 +83,7 @@ npm run status
|
|
|
93
83
|
npm run ui
|
|
94
84
|
```
|
|
95
85
|
|
|
96
|
-
The server will start at http://localhost:7788
|
|
86
|
+
The server will start at <http://localhost:7788>.
|
|
97
87
|
|
|
98
88
|
## Server Management
|
|
99
89
|
|
|
@@ -115,32 +105,17 @@ Discover and call tools from all connected MCP servers through the unified gatew
|
|
|
115
105
|
|
|
116
106
|
Browse and manage MCP resources from all connected servers.
|
|
117
107
|
|
|
118
|
-
## Sessions
|
|
119
|
-
|
|
120
|
-

|
|
121
|
-
|
|
122
|
-
Session management with persistence support. Sessions are automatically saved to disk and can be restored after service restart.
|
|
123
|
-
|
|
124
|
-
## Settings
|
|
125
|
-
|
|
126
|
-

|
|
127
|
-
|
|
128
|
-
Configure language, logging, and other settings through the settings page.
|
|
129
|
-
|
|
130
108
|
### Testing
|
|
131
109
|
|
|
132
110
|
```bash
|
|
133
111
|
# Run all tests
|
|
134
112
|
npm test
|
|
135
113
|
|
|
136
|
-
#
|
|
137
|
-
npm run test:
|
|
138
|
-
|
|
139
|
-
# Integration tests
|
|
140
|
-
npm run test:integration
|
|
114
|
+
# Backend tests
|
|
115
|
+
npm run test:backend
|
|
141
116
|
|
|
142
|
-
#
|
|
143
|
-
npm run test:
|
|
117
|
+
# Frontend tests
|
|
118
|
+
npm run test:frontend
|
|
144
119
|
```
|
|
145
120
|
|
|
146
121
|
## CLI Commands
|
|
@@ -166,6 +141,32 @@ node dist/index.js ui
|
|
|
166
141
|
node dist/index.js --help
|
|
167
142
|
```
|
|
168
143
|
|
|
144
|
+
### Tool Use Command
|
|
145
|
+
|
|
146
|
+
The `tool-use` command provides MCP server tool operations:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# List system tools (default server: mcp-hub-lite)
|
|
150
|
+
npm run tool-use -- list-tools
|
|
151
|
+
mcp-hub-lite tool-use list-tools
|
|
152
|
+
|
|
153
|
+
# List tools from a specific server
|
|
154
|
+
npm run tool-use -- list-tools --server baidu-search
|
|
155
|
+
mcp-hub-lite tool-use list-tools --server baidu-search
|
|
156
|
+
|
|
157
|
+
# Get tool schema
|
|
158
|
+
npm run tool-use -- get-tool --tool list_tools
|
|
159
|
+
mcp-hub-lite tool-use get-tool --tool list_tools
|
|
160
|
+
|
|
161
|
+
# Call a system tool
|
|
162
|
+
npm run tool-use -- call-tool --tool list_tools --args '{}'
|
|
163
|
+
mcp-hub-lite tool-use call-tool --tool list_tools --args '{}'
|
|
164
|
+
|
|
165
|
+
# Call a server tool
|
|
166
|
+
npm run tool-use -- call-tool --server baidu-search --tool search --args '{"query":"hello"}'
|
|
167
|
+
mcp-hub-lite tool-use call-tool --server baidu-search --tool search --args '{"query":"hello"}'
|
|
168
|
+
```
|
|
169
|
+
|
|
169
170
|
## Configuration
|
|
170
171
|
|
|
171
172
|
MCP-HUB-LITE uses a `.mcp-hub.json` file for configuration. Configuration lookup priority:
|
|
@@ -177,24 +178,33 @@ MCP-HUB-LITE uses a `.mcp-hub.json` file for configuration. Configuration lookup
|
|
|
177
178
|
|
|
178
179
|
```json
|
|
179
180
|
{
|
|
180
|
-
"version": "1.
|
|
181
|
+
"version": "1.1.0",
|
|
181
182
|
"servers": [
|
|
182
183
|
{
|
|
183
184
|
"id": "server-1",
|
|
184
185
|
"name": "My MCP Server",
|
|
185
186
|
"description": "Example server",
|
|
187
|
+
"transport": "streamable-http",
|
|
186
188
|
"endpoint": "http://localhost:8080",
|
|
187
|
-
"transport": "http-stream",
|
|
188
189
|
"tags": {
|
|
189
190
|
"env": "development",
|
|
190
191
|
"category": "api-server",
|
|
191
192
|
"function": "http-api",
|
|
192
193
|
"priority": "medium"
|
|
193
194
|
},
|
|
195
|
+
"allowedTools": [],
|
|
196
|
+
"instances": [
|
|
197
|
+
{
|
|
198
|
+
"index": 0,
|
|
199
|
+
"displayName": "Instance 1",
|
|
200
|
+
"enabled": true,
|
|
201
|
+
"env": {}
|
|
202
|
+
}
|
|
203
|
+
],
|
|
194
204
|
"managedProcess": {
|
|
195
205
|
"command": "npx my-mcp-server",
|
|
196
206
|
"managedMode": "npx",
|
|
197
|
-
"processType": "http
|
|
207
|
+
"processType": "streamable-http"
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
210
|
],
|
|
@@ -225,50 +235,11 @@ MCP-HUB-LITE uses a `.mcp-hub.json` file for configuration. Configuration lookup
|
|
|
225
235
|
|
|
226
236
|
Through the web interface:
|
|
227
237
|
|
|
228
|
-
1. Open http://localhost:7788
|
|
238
|
+
1. Open <http://localhost:7788>
|
|
229
239
|
2. Navigate to the "Servers" page
|
|
230
240
|
3. Click "Add Server"
|
|
231
241
|
4. Fill in server details and save
|
|
232
242
|
|
|
233
|
-
### MCP Protocol Usage
|
|
234
|
-
|
|
235
|
-
MCP-HUB-LITE exposes the MCP protocol interface on the same port:
|
|
236
|
-
|
|
237
|
-
#### List All Tools
|
|
238
|
-
|
|
239
|
-
```json
|
|
240
|
-
{
|
|
241
|
-
"jsonrpc": "2.0",
|
|
242
|
-
"method": "tools/list",
|
|
243
|
-
"params": {}
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
#### Call a Tool
|
|
248
|
-
|
|
249
|
-
```json
|
|
250
|
-
{
|
|
251
|
-
"jsonrpc": "2.0",
|
|
252
|
-
"method": "tool/call",
|
|
253
|
-
"params": {
|
|
254
|
-
"toolId": "server1:example-tool",
|
|
255
|
-
"arguments": {}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
#### Get Server Status
|
|
261
|
-
|
|
262
|
-
```json
|
|
263
|
-
{
|
|
264
|
-
"jsonrpc": "2.0",
|
|
265
|
-
"method": "server/status",
|
|
266
|
-
"params": {
|
|
267
|
-
"serverId": "server-1"
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
|
|
272
243
|
## Process Management
|
|
273
244
|
|
|
274
245
|
MCP-HUB-LITE supports launching and managing MCP servers using your local environment:
|
|
@@ -297,9 +268,15 @@ src/
|
|
|
297
268
|
│ └── web-api/ # Web API routes
|
|
298
269
|
├── models/ # Data models
|
|
299
270
|
├── services/ # Core business logic
|
|
271
|
+
│ ├── gateway/ # MCP gateway service
|
|
272
|
+
│ ├── connection/ # Connection management
|
|
273
|
+
│ └── hub-tools/ # Hub tools service
|
|
300
274
|
├── utils/ # Utility functions
|
|
275
|
+
│ ├── logger/ # Logging utilities
|
|
276
|
+
│ └── transports/ # MCP transport implementations
|
|
301
277
|
├── config/ # Configuration
|
|
302
278
|
├── cli/ # CLI commands
|
|
279
|
+
│ └── commands/ # CLI command implementations
|
|
303
280
|
├── pid/ # Process ID management
|
|
304
281
|
└── server/ # Server runtime
|
|
305
282
|
|
|
@@ -308,17 +285,21 @@ frontend/
|
|
|
308
285
|
│ ├── components/ # Reusable UI components
|
|
309
286
|
│ ├── views/ # Page view components
|
|
310
287
|
│ ├── stores/ # Pinia state management
|
|
288
|
+
│ ├── composables/ # Vue composables
|
|
311
289
|
│ ├── router/ # Vue Router configuration
|
|
312
|
-
│
|
|
290
|
+
│ ├── i18n/ # Internationalization
|
|
291
|
+
│ └── types/ # Frontend type definitions
|
|
313
292
|
|
|
314
293
|
shared/
|
|
315
294
|
├── models/ # Shared models
|
|
316
|
-
└── types/
|
|
295
|
+
└── types/ # Shared types
|
|
317
296
|
|
|
318
297
|
tests/
|
|
319
|
-
├── unit/
|
|
320
|
-
├── integration/
|
|
321
|
-
|
|
298
|
+
├── unit/ # Unit tests
|
|
299
|
+
├── integration/ # Integration tests
|
|
300
|
+
├── contract/ # Contract tests
|
|
301
|
+
├── helpers/ # Test helpers
|
|
302
|
+
└── types/ # Test types
|
|
322
303
|
```
|
|
323
304
|
|
|
324
305
|
### Adding New Features
|
|
@@ -329,14 +310,6 @@ tests/
|
|
|
329
310
|
4. Write tests (tests/)
|
|
330
311
|
5. Update configuration files
|
|
331
312
|
|
|
332
|
-
## Constraints and Limits
|
|
333
|
-
|
|
334
|
-
- Maximum servers: 50
|
|
335
|
-
- Maximum memory usage: 4GB
|
|
336
|
-
- CPU usage threshold: 80%
|
|
337
|
-
- Search response time: <500ms (90%)
|
|
338
|
-
- Gateway latency: <100ms
|
|
339
|
-
|
|
340
313
|
## Detailed Technical Documentation
|
|
341
314
|
|
|
342
315
|
Complete project architecture, constraints, and design decisions can be found in:
|
|
@@ -352,18 +325,3 @@ MIT
|
|
|
352
325
|
Pull Requests and Issues are welcome!
|
|
353
326
|
|
|
354
327
|
<!-- Badges -->
|
|
355
|
-
|
|
356
|
-
[license-src]: https://img.shields.io/badge/license-MIT-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
357
|
-
[license-href]: ./LICENSE
|
|
358
|
-
[node-src]: https://img.shields.io/badge/Node.js-22.x-080f12?style=flat&logo=nodedotjs&logoColor=white&colorA=080f12&colorB=339933
|
|
359
|
-
[node-href]: https://nodejs.org/
|
|
360
|
-
[typescript-src]: https://img.shields.io/badge/TypeScript-5.x-080f12?style=flat&logo=typescript&logoColor=white&colorA=080f12&colorB=3178C6
|
|
361
|
-
[typescript-href]: https://www.typescriptlang.org/
|
|
362
|
-
[vitest-src]: https://img.shields.io/badge/Vitest-Testing-080f12?style=flat&logo=vitest&logoColor=white&colorA=080f12&colorB=6E9F18
|
|
363
|
-
[vitest-href]: https://vitest.dev/
|
|
364
|
-
[fastify-src]: https://img.shields.io/badge/Fastify-Web-080f12?style=flat&logo=fastify&logoColor=white&colorA=080f12&colorB=000000
|
|
365
|
-
[fastify-href]: https://fastify.io/
|
|
366
|
-
[vue-src]: https://img.shields.io/badge/Vue.js-3-080f12?style=flat&logo=vuedotjs&logoColor=white&colorA=080f12&colorB=4FC08D
|
|
367
|
-
[vue-href]: https://vuejs.org/
|
|
368
|
-
[claude-code-src]: https://img.shields.io/badge/Claude-Code-1fa669?style=flat&colorA=080f12&colorB=1fa669
|
|
369
|
-
[claude-code-href]: https://claude.ai/code
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command for dynamic MCP server tool operations via API.
|
|
4
|
+
*
|
|
5
|
+
* This command provides a simplified CLI interface for interacting with MCP server tools,
|
|
6
|
+
* supporting four actions: list-servers, list-tools, get-tool, and call-tool. It wraps
|
|
7
|
+
* the HTTP API endpoints and requires the MCP Hub Lite server to be running.
|
|
8
|
+
*
|
|
9
|
+
* ## Command Format
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* mcp-tool-use <serverName> <action> [toolName] [--args <json>] [--tags <json>]
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Or via npm:
|
|
16
|
+
* ```
|
|
17
|
+
* npm run tool-use <serverName> <action> [toolName] [--args <json>] [--tags <json>]
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ## Supported Actions
|
|
21
|
+
*
|
|
22
|
+
* - `list-servers` - List all connected MCP servers
|
|
23
|
+
* - `list-tools` - List all tools from the specified server
|
|
24
|
+
* - `get-tool <toolName>` - Get complete schema for a specific tool
|
|
25
|
+
* - `call-tool <toolName>` - Call a tool on the specified server
|
|
26
|
+
*
|
|
27
|
+
* ## Options
|
|
28
|
+
*
|
|
29
|
+
* - `--args <json>` - JSON string of tool arguments (for call-tool action)
|
|
30
|
+
* - `--tags <json>` - JSON object of instance selection tags (call-tool only, for multi-instance servers)
|
|
31
|
+
*
|
|
32
|
+
* ## Usage Examples
|
|
33
|
+
*
|
|
34
|
+
* ```bash
|
|
35
|
+
* # List all connected servers
|
|
36
|
+
* mcp-hub-lite mcp-tool-use mcp-hub-lite list-servers
|
|
37
|
+
*
|
|
38
|
+
* # List all tools from a specific server
|
|
39
|
+
* mcp-hub-lite mcp-tool-use mcp-hub-lite list-tools
|
|
40
|
+
*
|
|
41
|
+
* # Get tool schema
|
|
42
|
+
* mcp-hub-lite mcp-tool-use mcp-hub-lite get-tool list_tools
|
|
43
|
+
*
|
|
44
|
+
* # Call a tool with arguments
|
|
45
|
+
* mcp-hub-lite mcp-tool-use mcp-hub-lite call-tool list_tools --args '{"serverName":"mcp-hub-lite"}'
|
|
46
|
+
*
|
|
47
|
+
* # Call a tool with tags for multi-instance selection
|
|
48
|
+
* mcp-hub-lite mcp-tool-use baidu-search call-tool search --args '{"query":"天气"}' --tags '{"env":"prod"}'
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* ## Error Handling
|
|
52
|
+
*
|
|
53
|
+
* - Exits with code 1 if the server is not running
|
|
54
|
+
* - Exits with code 1 if action is unknown
|
|
55
|
+
* - Exits with code 1 if toolName is required but not provided
|
|
56
|
+
* - Exits with code 1 if JSON parsing fails for --args or --tags
|
|
57
|
+
* - Exits with code 1 if the underlying API call fails
|
|
58
|
+
*
|
|
59
|
+
* @returns {Command} The configured mcp-tool-use command instance for registration with Commander.js
|
|
60
|
+
*/
|
|
61
|
+
export declare const mcpToolUseCommand: Command;
|
|
62
|
+
//# sourceMappingURL=mcp-tool-use.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-use.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/mcp-tool-use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,iBAAiB,SAkI1B,CAAC"}
|