@mcp-weave/webui 0.1.1
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/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/index.d.mts +178 -0
- package/dist/index.d.ts +178 -0
- package/dist/index.js +2196 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2189 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mcp-weave
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @mcp-weave/webui
|
|
2
|
+
|
|
3
|
+
Web UI dashboard for testing MCP servers interactively.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @mcp-weave/webui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { McpServer, McpTool } from '@mcp-weave/nestjs';
|
|
17
|
+
import { McpWebUI } from '@mcp-weave/webui';
|
|
18
|
+
|
|
19
|
+
@McpServer({ name: 'my-server', version: '1.0.0' })
|
|
20
|
+
class MyServer {
|
|
21
|
+
@McpTool({ name: 'add', description: 'Add two numbers' })
|
|
22
|
+
add(input: { a: number; b: number }) {
|
|
23
|
+
return { result: input.a + input.b };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Start the Web UI
|
|
28
|
+
const webui = new McpWebUI(MyServer, {
|
|
29
|
+
port: 3000,
|
|
30
|
+
title: 'My MCP Server Dashboard',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await webui.start();
|
|
34
|
+
// Dashboard available at http://localhost:3000
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- **Interactive Tool Testing**: Call tools with custom inputs and see results
|
|
40
|
+
- **Resource Browser**: Browse and read resources
|
|
41
|
+
- **Prompt Tester**: Test prompts with different arguments
|
|
42
|
+
- **Real-time Logs**: View server logs and messages
|
|
43
|
+
- **JSON Editor**: Edit complex inputs with syntax highlighting
|
|
44
|
+
- **Schema Validation**: Automatic validation based on tool schemas
|
|
45
|
+
|
|
46
|
+
### CLI Usage
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Start dashboard for your server
|
|
50
|
+
mcp-weave webui --port 3000
|
|
51
|
+
|
|
52
|
+
# With custom title
|
|
53
|
+
mcp-weave webui --port 3000 --title "My Dashboard"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Dashboard Components
|
|
57
|
+
|
|
58
|
+
1. **Server Info Panel**: Shows server name, version, and capabilities
|
|
59
|
+
2. **Tools Panel**: List all tools with input forms
|
|
60
|
+
3. **Resources Panel**: Browse and read resources
|
|
61
|
+
4. **Prompts Panel**: Test prompts with argument inputs
|
|
62
|
+
5. **History Panel**: View call history and responses
|
|
63
|
+
6. **Logs Panel**: Real-time server logs
|
|
64
|
+
|
|
65
|
+
## API Reference
|
|
66
|
+
|
|
67
|
+
### McpWebUI
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
interface McpWebUIOptions {
|
|
71
|
+
port?: number; // Default: 3000
|
|
72
|
+
host?: string; // Default: 'localhost'
|
|
73
|
+
title?: string; // Dashboard title
|
|
74
|
+
theme?: 'light' | 'dark'; // UI theme
|
|
75
|
+
enableLogs?: boolean; // Show server logs
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
class McpWebUI {
|
|
79
|
+
constructor(serverClass: any, options?: McpWebUIOptions);
|
|
80
|
+
|
|
81
|
+
start(): Promise<void>;
|
|
82
|
+
stop(): Promise<void>;
|
|
83
|
+
|
|
84
|
+
getUrl(): string;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Events
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
webui.on('tool:call', (toolName, input) => { ... });
|
|
92
|
+
webui.on('tool:result', (toolName, result) => { ... });
|
|
93
|
+
webui.on('resource:read', (uri) => { ... });
|
|
94
|
+
webui.on('prompt:get', (name, args) => { ... });
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web UI configuration options
|
|
5
|
+
*/
|
|
6
|
+
interface McpWebUIOptions {
|
|
7
|
+
/** Port to run the dashboard (default: 3000) */
|
|
8
|
+
port?: number;
|
|
9
|
+
/** Host to bind to (default: 'localhost') */
|
|
10
|
+
host?: string;
|
|
11
|
+
/** Dashboard title */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** UI theme */
|
|
14
|
+
theme?: 'light' | 'dark';
|
|
15
|
+
/** Enable server logs panel */
|
|
16
|
+
enableLogs?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Server information for the dashboard
|
|
20
|
+
*/
|
|
21
|
+
interface ServerInfo {
|
|
22
|
+
name: string;
|
|
23
|
+
version: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
tools: ToolInfo[];
|
|
26
|
+
resources: ResourceInfo[];
|
|
27
|
+
prompts: PromptInfo[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Tool information for display
|
|
31
|
+
*/
|
|
32
|
+
interface ToolInfo {
|
|
33
|
+
name: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
method: string;
|
|
36
|
+
inputSchema?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resource information for display
|
|
40
|
+
*/
|
|
41
|
+
interface ResourceInfo {
|
|
42
|
+
uri: string;
|
|
43
|
+
name: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
mimeType?: string;
|
|
46
|
+
method: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Prompt information for display
|
|
50
|
+
*/
|
|
51
|
+
interface PromptInfo {
|
|
52
|
+
name: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
method: string;
|
|
55
|
+
arguments?: Array<{
|
|
56
|
+
name: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
required?: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Call history entry
|
|
63
|
+
*/
|
|
64
|
+
interface CallHistoryEntry {
|
|
65
|
+
id: string;
|
|
66
|
+
type: 'tool' | 'resource' | 'prompt';
|
|
67
|
+
name: string;
|
|
68
|
+
input?: unknown;
|
|
69
|
+
output?: unknown;
|
|
70
|
+
error?: string;
|
|
71
|
+
timestamp: Date;
|
|
72
|
+
duration: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* McpWebUI - Web dashboard for testing MCP servers
|
|
76
|
+
*/
|
|
77
|
+
declare class McpWebUI extends EventEmitter {
|
|
78
|
+
private serverClass;
|
|
79
|
+
private serverInstance;
|
|
80
|
+
private options;
|
|
81
|
+
private httpServer;
|
|
82
|
+
private serverInfo;
|
|
83
|
+
private callHistory;
|
|
84
|
+
private logs;
|
|
85
|
+
constructor(serverClass: new (...args: unknown[]) => unknown, options?: McpWebUIOptions);
|
|
86
|
+
/**
|
|
87
|
+
* Initialize server instance and extract metadata
|
|
88
|
+
*/
|
|
89
|
+
private initialize;
|
|
90
|
+
/**
|
|
91
|
+
* Start the Web UI server
|
|
92
|
+
*/
|
|
93
|
+
start(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Stop the Web UI server
|
|
96
|
+
*/
|
|
97
|
+
stop(): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Get the URL of the dashboard
|
|
100
|
+
*/
|
|
101
|
+
getUrl(): string;
|
|
102
|
+
/**
|
|
103
|
+
* Get server information
|
|
104
|
+
*/
|
|
105
|
+
getServerInfo(): ServerInfo | null;
|
|
106
|
+
/**
|
|
107
|
+
* Get call history
|
|
108
|
+
*/
|
|
109
|
+
getCallHistory(): CallHistoryEntry[];
|
|
110
|
+
/**
|
|
111
|
+
* Log a message
|
|
112
|
+
*/
|
|
113
|
+
private log;
|
|
114
|
+
/**
|
|
115
|
+
* Handle HTTP requests
|
|
116
|
+
*/
|
|
117
|
+
private handleRequest;
|
|
118
|
+
/**
|
|
119
|
+
* Serve the main dashboard HTML
|
|
120
|
+
*/
|
|
121
|
+
private serveDashboard;
|
|
122
|
+
/**
|
|
123
|
+
* Serve server info as JSON
|
|
124
|
+
*/
|
|
125
|
+
private serveServerInfo;
|
|
126
|
+
/**
|
|
127
|
+
* Serve tools list
|
|
128
|
+
*/
|
|
129
|
+
private serveTools;
|
|
130
|
+
/**
|
|
131
|
+
* Serve resources list
|
|
132
|
+
*/
|
|
133
|
+
private serveResources;
|
|
134
|
+
/**
|
|
135
|
+
* Serve prompts list
|
|
136
|
+
*/
|
|
137
|
+
private servePrompts;
|
|
138
|
+
/**
|
|
139
|
+
* Serve call history
|
|
140
|
+
*/
|
|
141
|
+
private serveHistory;
|
|
142
|
+
/**
|
|
143
|
+
* Serve server logs
|
|
144
|
+
*/
|
|
145
|
+
private serveLogs;
|
|
146
|
+
/**
|
|
147
|
+
* Handle tool call request
|
|
148
|
+
*/
|
|
149
|
+
private handleCallTool;
|
|
150
|
+
/**
|
|
151
|
+
* Handle resource read request
|
|
152
|
+
*/
|
|
153
|
+
private handleReadResource;
|
|
154
|
+
/**
|
|
155
|
+
* Handle prompt get request
|
|
156
|
+
*/
|
|
157
|
+
private handleGetPrompt;
|
|
158
|
+
/**
|
|
159
|
+
* Read request body
|
|
160
|
+
*/
|
|
161
|
+
private readBody;
|
|
162
|
+
/**
|
|
163
|
+
* Extract parameters from URI template
|
|
164
|
+
*/
|
|
165
|
+
private extractUriParams;
|
|
166
|
+
/**
|
|
167
|
+
* Generate unique ID
|
|
168
|
+
*/
|
|
169
|
+
private generateId;
|
|
170
|
+
/**
|
|
171
|
+
* Generate the dashboard HTML
|
|
172
|
+
*/
|
|
173
|
+
private generateDashboardHTML;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare const VERSION = "0.1.0";
|
|
177
|
+
|
|
178
|
+
export { type CallHistoryEntry, McpWebUI, type McpWebUIOptions, type PromptInfo, type ResourceInfo, type ServerInfo, type ToolInfo, VERSION };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web UI configuration options
|
|
5
|
+
*/
|
|
6
|
+
interface McpWebUIOptions {
|
|
7
|
+
/** Port to run the dashboard (default: 3000) */
|
|
8
|
+
port?: number;
|
|
9
|
+
/** Host to bind to (default: 'localhost') */
|
|
10
|
+
host?: string;
|
|
11
|
+
/** Dashboard title */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** UI theme */
|
|
14
|
+
theme?: 'light' | 'dark';
|
|
15
|
+
/** Enable server logs panel */
|
|
16
|
+
enableLogs?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Server information for the dashboard
|
|
20
|
+
*/
|
|
21
|
+
interface ServerInfo {
|
|
22
|
+
name: string;
|
|
23
|
+
version: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
tools: ToolInfo[];
|
|
26
|
+
resources: ResourceInfo[];
|
|
27
|
+
prompts: PromptInfo[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Tool information for display
|
|
31
|
+
*/
|
|
32
|
+
interface ToolInfo {
|
|
33
|
+
name: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
method: string;
|
|
36
|
+
inputSchema?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resource information for display
|
|
40
|
+
*/
|
|
41
|
+
interface ResourceInfo {
|
|
42
|
+
uri: string;
|
|
43
|
+
name: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
mimeType?: string;
|
|
46
|
+
method: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Prompt information for display
|
|
50
|
+
*/
|
|
51
|
+
interface PromptInfo {
|
|
52
|
+
name: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
method: string;
|
|
55
|
+
arguments?: Array<{
|
|
56
|
+
name: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
required?: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Call history entry
|
|
63
|
+
*/
|
|
64
|
+
interface CallHistoryEntry {
|
|
65
|
+
id: string;
|
|
66
|
+
type: 'tool' | 'resource' | 'prompt';
|
|
67
|
+
name: string;
|
|
68
|
+
input?: unknown;
|
|
69
|
+
output?: unknown;
|
|
70
|
+
error?: string;
|
|
71
|
+
timestamp: Date;
|
|
72
|
+
duration: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* McpWebUI - Web dashboard for testing MCP servers
|
|
76
|
+
*/
|
|
77
|
+
declare class McpWebUI extends EventEmitter {
|
|
78
|
+
private serverClass;
|
|
79
|
+
private serverInstance;
|
|
80
|
+
private options;
|
|
81
|
+
private httpServer;
|
|
82
|
+
private serverInfo;
|
|
83
|
+
private callHistory;
|
|
84
|
+
private logs;
|
|
85
|
+
constructor(serverClass: new (...args: unknown[]) => unknown, options?: McpWebUIOptions);
|
|
86
|
+
/**
|
|
87
|
+
* Initialize server instance and extract metadata
|
|
88
|
+
*/
|
|
89
|
+
private initialize;
|
|
90
|
+
/**
|
|
91
|
+
* Start the Web UI server
|
|
92
|
+
*/
|
|
93
|
+
start(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Stop the Web UI server
|
|
96
|
+
*/
|
|
97
|
+
stop(): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Get the URL of the dashboard
|
|
100
|
+
*/
|
|
101
|
+
getUrl(): string;
|
|
102
|
+
/**
|
|
103
|
+
* Get server information
|
|
104
|
+
*/
|
|
105
|
+
getServerInfo(): ServerInfo | null;
|
|
106
|
+
/**
|
|
107
|
+
* Get call history
|
|
108
|
+
*/
|
|
109
|
+
getCallHistory(): CallHistoryEntry[];
|
|
110
|
+
/**
|
|
111
|
+
* Log a message
|
|
112
|
+
*/
|
|
113
|
+
private log;
|
|
114
|
+
/**
|
|
115
|
+
* Handle HTTP requests
|
|
116
|
+
*/
|
|
117
|
+
private handleRequest;
|
|
118
|
+
/**
|
|
119
|
+
* Serve the main dashboard HTML
|
|
120
|
+
*/
|
|
121
|
+
private serveDashboard;
|
|
122
|
+
/**
|
|
123
|
+
* Serve server info as JSON
|
|
124
|
+
*/
|
|
125
|
+
private serveServerInfo;
|
|
126
|
+
/**
|
|
127
|
+
* Serve tools list
|
|
128
|
+
*/
|
|
129
|
+
private serveTools;
|
|
130
|
+
/**
|
|
131
|
+
* Serve resources list
|
|
132
|
+
*/
|
|
133
|
+
private serveResources;
|
|
134
|
+
/**
|
|
135
|
+
* Serve prompts list
|
|
136
|
+
*/
|
|
137
|
+
private servePrompts;
|
|
138
|
+
/**
|
|
139
|
+
* Serve call history
|
|
140
|
+
*/
|
|
141
|
+
private serveHistory;
|
|
142
|
+
/**
|
|
143
|
+
* Serve server logs
|
|
144
|
+
*/
|
|
145
|
+
private serveLogs;
|
|
146
|
+
/**
|
|
147
|
+
* Handle tool call request
|
|
148
|
+
*/
|
|
149
|
+
private handleCallTool;
|
|
150
|
+
/**
|
|
151
|
+
* Handle resource read request
|
|
152
|
+
*/
|
|
153
|
+
private handleReadResource;
|
|
154
|
+
/**
|
|
155
|
+
* Handle prompt get request
|
|
156
|
+
*/
|
|
157
|
+
private handleGetPrompt;
|
|
158
|
+
/**
|
|
159
|
+
* Read request body
|
|
160
|
+
*/
|
|
161
|
+
private readBody;
|
|
162
|
+
/**
|
|
163
|
+
* Extract parameters from URI template
|
|
164
|
+
*/
|
|
165
|
+
private extractUriParams;
|
|
166
|
+
/**
|
|
167
|
+
* Generate unique ID
|
|
168
|
+
*/
|
|
169
|
+
private generateId;
|
|
170
|
+
/**
|
|
171
|
+
* Generate the dashboard HTML
|
|
172
|
+
*/
|
|
173
|
+
private generateDashboardHTML;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare const VERSION = "0.1.0";
|
|
177
|
+
|
|
178
|
+
export { type CallHistoryEntry, McpWebUI, type McpWebUIOptions, type PromptInfo, type ResourceInfo, type ServerInfo, type ToolInfo, VERSION };
|