mcp-pentester-cli 1.0.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.
Files changed (40) hide show
  1. package/LICENSE +75 -0
  2. package/README.md +327 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +183 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/mcp-client.d.ts +23 -0
  8. package/dist/mcp-client.d.ts.map +1 -0
  9. package/dist/mcp-client.js +163 -0
  10. package/dist/mcp-client.js.map +1 -0
  11. package/dist/transport/base.d.ts +18 -0
  12. package/dist/transport/base.d.ts.map +1 -0
  13. package/dist/transport/base.js +64 -0
  14. package/dist/transport/base.js.map +1 -0
  15. package/dist/transport/http.d.ts +14 -0
  16. package/dist/transport/http.d.ts.map +1 -0
  17. package/dist/transport/http.js +137 -0
  18. package/dist/transport/http.js.map +1 -0
  19. package/dist/transport/stdio.d.ts +15 -0
  20. package/dist/transport/stdio.d.ts.map +1 -0
  21. package/dist/transport/stdio.js +89 -0
  22. package/dist/transport/stdio.js.map +1 -0
  23. package/dist/transport/websocket.d.ts +15 -0
  24. package/dist/transport/websocket.d.ts.map +1 -0
  25. package/dist/transport/websocket.js +109 -0
  26. package/dist/transport/websocket.js.map +1 -0
  27. package/dist/types.d.ts +103 -0
  28. package/dist/types.d.ts.map +1 -0
  29. package/dist/types.js +3 -0
  30. package/dist/types.js.map +1 -0
  31. package/dist/ui/tui.d.ts +43 -0
  32. package/dist/ui/tui.d.ts.map +1 -0
  33. package/dist/ui/tui.js +872 -0
  34. package/dist/ui/tui.js.map +1 -0
  35. package/examples/http-burp-config.json +9 -0
  36. package/examples/https-burp-config.json +13 -0
  37. package/examples/stdio-config.json +10 -0
  38. package/examples/tor-config.json +9 -0
  39. package/examples/websocket-config.json +9 -0
  40. package/package.json +44 -0
package/LICENSE ADDED
@@ -0,0 +1,75 @@
1
+ INTEGSEC PROPRIETARY SOFTWARE LICENSE
2
+
3
+ Copyright (c) 2025 IntegSec. All Rights Reserved.
4
+
5
+ NOTICE: This software and associated documentation files (the "Software") are
6
+ proprietary and confidential to IntegSec.
7
+
8
+ GRANT OF LICENSE:
9
+ Subject to the terms and conditions of this License, IntegSec grants you a
10
+ limited, non-exclusive, non-transferable, revocable license to use the Software
11
+ solely for:
12
+ (a) Internal security testing and penetration testing purposes
13
+ (b) Educational and research purposes in an academic setting
14
+ (c) Security consulting engagements conducted by authorized security professionals
15
+
16
+ RESTRICTIONS:
17
+ You may NOT:
18
+ 1. Use the Software for any commercial purpose without a separate written
19
+ commercial license agreement with IntegSec
20
+ 2. Redistribute, sublicense, sell, rent, lease, or lend the Software
21
+ 3. Modify, adapt, translate, reverse engineer, decompile, or disassemble
22
+ the Software
23
+ 4. Remove or alter any proprietary notices, labels, or marks on the Software
24
+ 5. Create derivative works based upon the Software
25
+ 6. Use the Software in any manner that competes with IntegSec's business
26
+ 7. Transfer, assign, or sublicense your rights under this License
27
+
28
+ COMMERCIAL USE:
29
+ Any commercial use of this Software requires a separate commercial license from
30
+ IntegSec. Commercial use includes, but is not limited to:
31
+ - Using the Software as part of a commercial service offering
32
+ - Incorporating the Software into commercial products
33
+ - Using the Software in a commercial consulting engagement for profit
34
+ - Providing the Software as a managed service
35
+
36
+ For commercial licensing inquiries, contact: licensing@integsec.com
37
+
38
+ INTELLECTUAL PROPERTY:
39
+ This Software is protected by copyright laws and international copyright treaties,
40
+ as well as other intellectual property laws and treaties. IntegSec retains all
41
+ right, title, and interest in and to the Software, including all copyrights,
42
+ patents, trade secrets, trademarks, and other intellectual property rights.
43
+
44
+ NO WARRANTY:
45
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
48
+ INTEGSEC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
49
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
50
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
+
52
+ LIMITATION OF LIABILITY:
53
+ IN NO EVENT SHALL INTEGSEC BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT,
54
+ OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES
55
+ FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
56
+ INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
57
+ INABILITY TO USE THIS SOFTWARE.
58
+
59
+ TERMINATION:
60
+ This License is effective until terminated. Your rights under this License will
61
+ terminate automatically without notice from IntegSec if you fail to comply with
62
+ any term(s) of this License. Upon termination, you shall cease all use of the
63
+ Software and destroy all copies, full or partial, of the Software.
64
+
65
+ GOVERNING LAW:
66
+ This License shall be governed by and construed in accordance with the laws of
67
+ the jurisdiction in which IntegSec is registered, without regard to its conflict
68
+ of law provisions.
69
+
70
+ ENTIRE AGREEMENT:
71
+ This License constitutes the entire agreement between you and IntegSec relating
72
+ to the Software and supersedes all prior or contemporaneous understandings
73
+ regarding such subject matter.
74
+
75
+ For questions about this License, contact: legal@integsec.com
package/README.md ADDED
@@ -0,0 +1,327 @@
1
+ # MCP Pentester CLI
2
+
3
+ **IntegSec Proprietary Security Tool**
4
+
5
+ An interactive console tool for penetration testers to interact with Model Context Protocol (MCP) servers via JSON-RPC 2.0. Supports multiple transport protocols (stdio, HTTP/HTTPS, WebSocket) with full proxy support for tools like Burp Suite.
6
+
7
+ ![My screenshot](client-screenshot.png)
8
+
9
+ **Copyright © 2025 IntegSec. All Rights Reserved.**
10
+
11
+ ## Features
12
+
13
+ - **Multiple Transport Protocols**
14
+ - stdio (process communication)
15
+ - HTTP/HTTPS
16
+ - WebSocket (ws/wss)
17
+
18
+ - **Proxy Support**
19
+ - HTTP/HTTPS proxies (Burp Suite, etc.)
20
+ - SOCKS5 proxies (Tor, etc.)
21
+ - Authentication support
22
+
23
+ - **Interactive TUI**
24
+ - Graphical console interface using blessed
25
+ - Real-time traffic logging
26
+ - Navigate tools, resources, and prompts
27
+ - Execute MCP operations interactively
28
+
29
+ - **Traffic Inspection**
30
+ - View all JSON-RPC requests and responses
31
+ - Traffic logging for analysis
32
+ - Compatible with HTTP intercepting proxies
33
+
34
+ - **Pentesting Features**
35
+ - Redirect all traffic through Burp Suite or similar tools
36
+ - Inspect and modify MCP protocol messages
37
+ - Test server implementations
38
+ - Analyze security of MCP servers
39
+
40
+ ## Installation
41
+
42
+ ### Install from npm (when published)
43
+
44
+ ```bash
45
+ npm install -g mcp-pentester-cli
46
+ ```
47
+
48
+ ### Install from source
49
+
50
+ ```bash
51
+ npm install
52
+ npm run build
53
+ ```
54
+
55
+ Or install globally from source:
56
+
57
+ ```bash
58
+ npm install -g .
59
+ ```
60
+
61
+ ## Quick Start
62
+
63
+ ### Connect to an MCP server via stdio
64
+
65
+ ```bash
66
+ mcp-cli connect --transport stdio --command "npx" --args "-y" "@modelcontextprotocol/server-filesystem" "/tmp"
67
+ ```
68
+
69
+ ### Connect via HTTP through Burp Suite
70
+
71
+ ```bash
72
+ mcp-cli connect --transport http --url "http://localhost:3000/mcp" --proxy-host 127.0.0.1 --proxy-port 8080
73
+ ```
74
+
75
+ ### Connect via WebSocket through SOCKS5 (Tor)
76
+
77
+ ```bash
78
+ mcp-cli connect --transport wss --url "wss://api.example.com/mcp" --proxy-host 127.0.0.1 --proxy-port 9050 --proxy-protocol socks5
79
+ ```
80
+
81
+ ### Using Configuration Files
82
+
83
+ Generate example configs:
84
+
85
+ ```bash
86
+ mcp-cli gen-config -o my-config.json
87
+ ```
88
+
89
+ Connect using a config file:
90
+
91
+ ```bash
92
+ mcp-cli connect --config examples/http-burp-config.json
93
+ ```
94
+
95
+ ## Usage
96
+
97
+ ### Command Line Options
98
+
99
+ ```
100
+ mcp-cli connect [options]
101
+
102
+ Options:
103
+ -t, --transport <type> Transport type: stdio, http, https, ws, wss (default: "stdio")
104
+ -u, --url <url> URL for HTTP/WebSocket transports
105
+ -c, --command <command> Command for stdio transport
106
+ -a, --args <args...> Arguments for stdio command
107
+ --proxy-host <host> Proxy server host
108
+ --proxy-port <port> Proxy server port
109
+ --proxy-protocol <protocol> Proxy protocol: http, https, socks, socks5
110
+ --proxy-user <username> Proxy username
111
+ --proxy-pass <password> Proxy password
112
+ -f, --config <file> Load configuration from JSON file
113
+ -h, --help Display help for command
114
+ ```
115
+
116
+ ### Configuration File Format
117
+
118
+ ```json
119
+ {
120
+ "type": "https",
121
+ "url": "https://api.example.com/mcp",
122
+ "proxy": {
123
+ "host": "127.0.0.1",
124
+ "port": 8080,
125
+ "protocol": "http",
126
+ "auth": {
127
+ "username": "pentester",
128
+ "password": "changeme"
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ ### TUI Keyboard Shortcuts
135
+
136
+ **Function Keys:**
137
+ - **F1** - Focus navigation sidebar
138
+ - **F2** - Focus main content panel
139
+ - **F3** - Focus traffic log panel
140
+ - **F4** - Close popup window
141
+ - **F5** - Refresh current view
142
+ - **F10** - Quit application
143
+
144
+ **Navigation:**
145
+ - **↑/↓** (Up/Down Arrows) - Navigate through lists
146
+ - **Enter** - Execute selected item (call tool, read resource, use prompt, view traffic details)
147
+
148
+ **Traffic Log:**
149
+ - Most recent entries appear at the top
150
+ - Shows detailed information: timestamps, tool names, parameters, URIs
151
+ - Press Enter on any entry to see full request/response pair side-by-side
152
+
153
+ ### Navigation Menu
154
+
155
+ 1. **Tools** - View and execute available MCP tools
156
+ 2. **Resources** - Browse and read MCP resources
157
+ 3. **Prompts** - View and use MCP prompts
158
+ 4. **Traffic Log** - View detailed JSON-RPC traffic
159
+
160
+ ## Example Configurations
161
+
162
+ ### Testing a Local MCP Server with Burp Suite
163
+
164
+ ```json
165
+ {
166
+ "type": "http",
167
+ "url": "http://localhost:3000/mcp",
168
+ "proxy": {
169
+ "host": "127.0.0.1",
170
+ "port": 8080,
171
+ "protocol": "http"
172
+ }
173
+ }
174
+ ```
175
+
176
+ ### Connecting to Remote MCP Server via Tor
177
+
178
+ ```json
179
+ {
180
+ "type": "wss",
181
+ "url": "wss://api.example.onion/mcp",
182
+ "proxy": {
183
+ "host": "127.0.0.1",
184
+ "port": 9050,
185
+ "protocol": "socks5"
186
+ }
187
+ }
188
+ ```
189
+
190
+ ### Local stdio Server
191
+
192
+ ```json
193
+ {
194
+ "type": "stdio",
195
+ "command": "node",
196
+ "args": ["./my-mcp-server.js"],
197
+ "env": {
198
+ "DEBUG": "true"
199
+ }
200
+ }
201
+ ```
202
+
203
+ ## Pentesting Workflow
204
+
205
+ 1. **Setup Burp Suite**
206
+ - Configure Burp to listen on 127.0.0.1:8080
207
+ - Disable SSL validation if testing with self-signed certs
208
+
209
+ 2. **Launch MCP CLI with Proxy**
210
+ ```bash
211
+ mcp-cli connect --transport https --url "https://target.com/mcp" \
212
+ --proxy-host 127.0.0.1 --proxy-port 8080
213
+ ```
214
+
215
+ 3. **Intercept Traffic**
216
+ - All JSON-RPC requests will flow through Burp
217
+ - Modify requests to test for vulnerabilities
218
+ - Analyze responses for sensitive data
219
+
220
+ 4. **Test MCP Operations**
221
+ - Navigate to Tools in the TUI
222
+ - Execute tools with crafted inputs
223
+ - Monitor responses in Traffic Log
224
+
225
+ 5. **Analyze Security**
226
+ - Check for authentication bypass
227
+ - Test input validation
228
+ - Look for information disclosure
229
+ - Verify proper error handling
230
+
231
+ ## MCP Protocol Operations
232
+
233
+ The tool supports all standard MCP protocol operations:
234
+
235
+ - **initialize** - Establish connection with server
236
+ - **tools/list** - List available tools
237
+ - **tools/call** - Execute a tool with arguments
238
+ - **resources/list** - List available resources
239
+ - **resources/read** - Read resource content
240
+ - **prompts/list** - List available prompts
241
+ - **prompts/get** - Get a prompt with arguments
242
+
243
+ ## Traffic Logging
244
+
245
+ All JSON-RPC traffic is logged in real-time:
246
+
247
+ - Timestamp for each message
248
+ - Direction (sent/received)
249
+ - Full JSON payload
250
+ - Method name for easy filtering
251
+
252
+ Traffic can be cleared at any time using the 'c' key in the traffic panel.
253
+
254
+ ## Security Considerations
255
+
256
+ This tool is designed for authorized security testing only. Use responsibly:
257
+
258
+ - Only test systems you have permission to test
259
+ - Be aware that proxy configurations may expose credentials
260
+ - Traffic logs may contain sensitive information
261
+ - Follow responsible disclosure practices
262
+
263
+ ## Development
264
+
265
+ ### Build
266
+
267
+ ```bash
268
+ npm run build
269
+ ```
270
+
271
+ ### Development Mode
272
+
273
+ ```bash
274
+ npm run dev
275
+ ```
276
+
277
+ ### Project Structure
278
+
279
+ ```
280
+ src/
281
+ ├── index.ts # CLI entry point
282
+ ├── types.ts # TypeScript type definitions
283
+ ├── mcp-client.ts # MCP protocol client
284
+ ├── transport/
285
+ │ ├── base.ts # Base transport abstraction
286
+ │ ├── stdio.ts # stdio transport
287
+ │ ├── http.ts # HTTP/HTTPS transport
288
+ │ └── websocket.ts # WebSocket transport
289
+ └── ui/
290
+ └── tui.ts # Terminal UI
291
+ ```
292
+
293
+ ## Troubleshooting
294
+
295
+ ### Connection Issues
296
+
297
+ - Verify the target server is running
298
+ - Check firewall settings
299
+ - Ensure proxy is configured correctly
300
+ - For stdio: verify command path and arguments
301
+
302
+ ### Proxy Issues
303
+
304
+ - Test proxy connection with curl first
305
+ - Check proxy authentication credentials
306
+ - For SOCKS5: ensure you're using the correct protocol
307
+ - For Burp: verify invisible proxying is disabled
308
+
309
+ ### TUI Display Issues
310
+
311
+ - Ensure terminal supports colors
312
+ - Try resizing the terminal window
313
+ - Check terminal emulator compatibility
314
+
315
+ ## License
316
+
317
+ This software is proprietary and confidential to IntegSec. See the LICENSE file for full terms and conditions.
318
+
319
+ **Commercial use requires a separate license agreement. Contact: licensing@integsec.com**
320
+
321
+ ## Contributing
322
+
323
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
324
+
325
+ ## Disclaimer
326
+
327
+ This tool is for educational and authorized security testing purposes only. The authors are not responsible for any misuse or damage caused by this tool.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,183 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ const commander_1 = require("commander");
38
+ const mcp_client_1 = require("./mcp-client");
39
+ const tui_1 = require("./ui/tui");
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const program = new commander_1.Command();
43
+ program
44
+ .name('mcp-cli')
45
+ .description('Interactive console tool for pentesting MCP servers via JSON-RPC 2.0')
46
+ .version('1.0.0');
47
+ program
48
+ .command('connect')
49
+ .description('Connect to an MCP server')
50
+ .option('-t, --transport <type>', 'Transport type: stdio, http, https, ws, wss', 'stdio')
51
+ .option('-u, --url <url>', 'URL for HTTP/WebSocket transports')
52
+ .option('-c, --command <command>', 'Command for stdio transport')
53
+ .option('-a, --args <args...>', 'Arguments for stdio command')
54
+ .option('--proxy-host <host>', 'Proxy server host')
55
+ .option('--proxy-port <port>', 'Proxy server port')
56
+ .option('--proxy-protocol <protocol>', 'Proxy protocol: http, https, socks, socks5')
57
+ .option('--proxy-user <username>', 'Proxy username')
58
+ .option('--proxy-pass <password>', 'Proxy password')
59
+ .option('-f, --config <file>', 'Load configuration from JSON file')
60
+ .action(async (options) => {
61
+ let config;
62
+ // Load from config file if provided
63
+ if (options.config) {
64
+ try {
65
+ const configPath = path.resolve(options.config);
66
+ const configData = fs.readFileSync(configPath, 'utf-8');
67
+ config = JSON.parse(configData);
68
+ }
69
+ catch (error) {
70
+ console.error(`Failed to load config file: ${error}`);
71
+ process.exit(1);
72
+ }
73
+ }
74
+ else {
75
+ // Build config from command line options
76
+ config = {
77
+ type: options.transport,
78
+ };
79
+ if (options.url) {
80
+ config.url = options.url;
81
+ }
82
+ if (options.command) {
83
+ config.command = options.command;
84
+ config.args = options.args || [];
85
+ }
86
+ if (options.proxyHost && options.proxyPort) {
87
+ config.proxy = {
88
+ host: options.proxyHost,
89
+ port: parseInt(options.proxyPort, 10),
90
+ protocol: options.proxyProtocol,
91
+ };
92
+ if (options.proxyUser && options.proxyPass) {
93
+ config.proxy.auth = {
94
+ username: options.proxyUser,
95
+ password: options.proxyPass,
96
+ };
97
+ }
98
+ }
99
+ }
100
+ // Validate config
101
+ if (config.type === 'stdio' && !config.command) {
102
+ console.error('Error: --command is required for stdio transport');
103
+ process.exit(1);
104
+ }
105
+ if ((config.type === 'http' || config.type === 'https' ||
106
+ config.type === 'ws' || config.type === 'wss') && !config.url) {
107
+ console.error(`Error: --url is required for ${config.type} transport`);
108
+ process.exit(1);
109
+ }
110
+ // Create TUI
111
+ const tui = new tui_1.TUI();
112
+ // Create and connect client
113
+ const client = new mcp_client_1.MCPClient(config);
114
+ tui.setClient(client);
115
+ try {
116
+ // Add a timeout to prevent hanging forever
117
+ const connectPromise = client.connect();
118
+ const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout after 30 seconds')), 30000));
119
+ await Promise.race([connectPromise, timeoutPromise]);
120
+ tui.render();
121
+ }
122
+ catch (error) {
123
+ // Make sure to destroy the screen before exiting
124
+ if (tui && tui.screen) {
125
+ tui.screen.destroy();
126
+ }
127
+ console.error(`\nFailed to connect: ${error}`);
128
+ process.exit(1);
129
+ }
130
+ });
131
+ program
132
+ .command('gen-config')
133
+ .description('Generate example configuration files')
134
+ .option('-o, --output <file>', 'Output file path', 'mcp-config.json')
135
+ .action((options) => {
136
+ const exampleConfigs = {
137
+ stdio: {
138
+ type: 'stdio',
139
+ command: 'npx',
140
+ args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
141
+ env: {},
142
+ },
143
+ http: {
144
+ type: 'http',
145
+ url: 'http://localhost:3000/mcp',
146
+ proxy: {
147
+ host: '127.0.0.1',
148
+ port: 8080,
149
+ protocol: 'http',
150
+ },
151
+ },
152
+ https: {
153
+ type: 'https',
154
+ url: 'https://api.example.com/mcp',
155
+ proxy: {
156
+ host: '127.0.0.1',
157
+ port: 8080,
158
+ protocol: 'http',
159
+ auth: {
160
+ username: 'user',
161
+ password: 'pass',
162
+ },
163
+ },
164
+ },
165
+ websocket: {
166
+ type: 'wss',
167
+ url: 'wss://api.example.com/mcp',
168
+ proxy: {
169
+ host: '127.0.0.1',
170
+ port: 9050,
171
+ protocol: 'socks5',
172
+ },
173
+ },
174
+ };
175
+ const outputPath = path.resolve(options.output);
176
+ fs.writeFileSync(outputPath, JSON.stringify(exampleConfigs, null, 2), 'utf-8');
177
+ console.log(`Example configurations written to: ${outputPath}`);
178
+ console.log('\nExample usage:');
179
+ console.log(` mcp-cli connect --config ${outputPath} --transport stdio`);
180
+ console.log(' (Edit the file to select a specific config by extracting one transport)');
181
+ });
182
+ program.parse();
183
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,6CAAyC;AACzC,kCAA+B;AAE/B,uCAAyB;AACzB,2CAA6B;AAE7B,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,sEAAsE,CAAC;KACnF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,wBAAwB,EAAE,6CAA6C,EAAE,OAAO,CAAC;KACxF,MAAM,CAAC,iBAAiB,EAAE,mCAAmC,CAAC;KAC9D,MAAM,CAAC,yBAAyB,EAAE,6BAA6B,CAAC;KAChE,MAAM,CAAC,sBAAsB,EAAE,6BAA6B,CAAC;KAC7D,MAAM,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;KAClD,MAAM,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;KAClD,MAAM,CAAC,6BAA6B,EAAE,4CAA4C,CAAC;KACnF,MAAM,CAAC,yBAAyB,EAAE,gBAAgB,CAAC;KACnD,MAAM,CAAC,yBAAyB,EAAE,gBAAgB,CAAC;KACnD,MAAM,CAAC,qBAAqB,EAAE,mCAAmC,CAA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AK,EAAE;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,QAAQ;aACnB;SACF;KACF,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,EAAE,CAAC,aAAa,CACd,UAAU,EACV,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,EACvC,OAAO,CACR,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,8BAA8B,UAAU,oBAAoB,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;AAC3F,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { EventEmitter } from 'events';
2
+ import { TransportConfig, MCPTool, MCPResource, MCPPrompt, TrafficLog, MCPClientState } from './types';
3
+ export declare class MCPClient extends EventEmitter {
4
+ private config;
5
+ private transport?;
6
+ private state;
7
+ constructor(config: TransportConfig);
8
+ connect(): Promise<void>;
9
+ disconnect(): Promise<void>;
10
+ private initialize;
11
+ listTools(): Promise<MCPTool[]>;
12
+ callTool(name: string, args?: any): Promise<any>;
13
+ listResources(): Promise<MCPResource[]>;
14
+ readResource(uri: string): Promise<any>;
15
+ listPrompts(): Promise<MCPPrompt[]>;
16
+ getPrompt(name: string, args?: any): Promise<any>;
17
+ refreshAll(): Promise<void>;
18
+ getState(): MCPClientState;
19
+ getTrafficLog(): TrafficLog[];
20
+ clearTrafficLog(): void;
21
+ private logTraffic;
22
+ }
23
+ //# sourceMappingURL=mcp-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKtC,OAAO,EACL,eAAe,EAEf,OAAO,EACP,WAAW,EACX,SAAS,EACT,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,qBAAa,SAAU,SAAQ,YAAY;IAU7B,OAAO,CAAC,MAAM;IAT1B,OAAO,CAAC,SAAS,CAAC,CAAY;IAC9B,OAAO,CAAC,KAAK,CAMX;gBAEkB,MAAM,EAAE,eAAe;IAIrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAoExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAQnB,UAAU;IAqBlB,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAM/B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAOpD,aAAa,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAMvC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvC,WAAW,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAMnC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAOrD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC,QAAQ,IAAI,cAAc;IAI1B,aAAa,IAAI,UAAU,EAAE;IAI7B,eAAe,IAAI,IAAI;IAIvB,OAAO,CAAC,UAAU;CAcnB"}