@apify/mcpc 0.1.3 → 0.1.4
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/.claude/settings.local.json +30 -1
- package/.idea/codeStyles/Project.xml +4 -0
- package/.idea/workspace.xml +281 -277
- package/CONTRIBUTING.md +210 -0
- package/README.md +156 -367
- package/TODOs.md +27 -66
- package/dist/bridge/index.js +29 -17
- package/dist/bridge/index.js.map +1 -1
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +9 -4
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/clean.d.ts.map +1 -1
- package/dist/cli/commands/clean.js +13 -19
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/prompts.d.ts.map +1 -1
- package/dist/cli/commands/prompts.js +24 -1
- package/dist/cli/commands/prompts.js.map +1 -1
- package/dist/cli/commands/sessions.d.ts +5 -1
- package/dist/cli/commands/sessions.d.ts.map +1 -1
- package/dist/cli/commands/sessions.js +94 -139
- package/dist/cli/commands/sessions.js.map +1 -1
- package/dist/cli/commands/tools.d.ts.map +1 -1
- package/dist/cli/commands/tools.js +39 -1
- package/dist/cli/commands/tools.js.map +1 -1
- package/dist/cli/helpers.d.ts +2 -2
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/helpers.js +32 -68
- package/dist/cli/helpers.js.map +1 -1
- package/dist/cli/index.js +47 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +19 -3
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +370 -82
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/parser.d.ts +4 -0
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +88 -1
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/shell.d.ts.map +1 -1
- package/dist/cli/shell.js +4 -5
- package/dist/cli/shell.js.map +1 -1
- package/dist/core/factory.d.ts +2 -4
- package/dist/core/factory.d.ts.map +1 -1
- package/dist/core/factory.js +2 -34
- package/dist/core/factory.js.map +1 -1
- package/dist/core/mcp-client.d.ts +2 -2
- package/dist/core/mcp-client.d.ts.map +1 -1
- package/dist/core/mcp-client.js +10 -10
- package/dist/core/mcp-client.js.map +1 -1
- package/dist/core/transports.d.ts +2 -2
- package/dist/core/transports.d.ts.map +1 -1
- package/dist/core/transports.js +36 -45
- package/dist/core/transports.js.map +1 -1
- package/dist/lib/auth/oauth-flow.d.ts.map +1 -1
- package/dist/lib/auth/oauth-flow.js +3 -0
- package/dist/lib/auth/oauth-flow.js.map +1 -1
- package/dist/lib/auth/oauth-provider.d.ts.map +1 -1
- package/dist/lib/auth/oauth-provider.js +5 -23
- package/dist/lib/auth/oauth-provider.js.map +1 -1
- package/dist/lib/auth/oauth-token-manager.d.ts.map +1 -1
- package/dist/lib/auth/oauth-token-manager.js +0 -10
- package/dist/lib/auth/oauth-token-manager.js.map +1 -1
- package/dist/lib/auth/profiles.d.ts +5 -1
- package/dist/lib/auth/profiles.d.ts.map +1 -1
- package/dist/lib/auth/profiles.js +80 -13
- package/dist/lib/auth/profiles.js.map +1 -1
- package/dist/lib/bridge-manager.d.ts +2 -2
- package/dist/lib/bridge-manager.d.ts.map +1 -1
- package/dist/lib/bridge-manager.js +18 -19
- package/dist/lib/bridge-manager.js.map +1 -1
- package/dist/lib/config.d.ts +3 -3
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/logger.d.ts +5 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +10 -1
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/schema-validator.d.ts +36 -0
- package/dist/lib/schema-validator.d.ts.map +1 -0
- package/dist/lib/schema-validator.js +220 -0
- package/dist/lib/schema-validator.js.map +1 -0
- package/dist/lib/session-client.d.ts +2 -2
- package/dist/lib/session-client.d.ts.map +1 -1
- package/dist/lib/session-client.js +3 -3
- package/dist/lib/session-client.js.map +1 -1
- package/dist/lib/sessions.js +1 -1
- package/dist/lib/sessions.js.map +1 -1
- package/dist/lib/types.d.ts +13 -24
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +8 -0
- package/dist/lib/utils.js.map +1 -1
- package/docs/claude-skill/SKILL.md +2 -2
- package/package.json +12 -8
- package/TESTING.md +0 -212
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/mcpc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Universal command-line client for the Model Context Protocol (MCP).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -31,11 +31,14 @@
|
|
|
31
31
|
"build": "tsc",
|
|
32
32
|
"build:watch": "tsc --watch",
|
|
33
33
|
"build:toc": "doctoc README.md --github --notitle && sed -i '' '/^- \\[mcpc:/d' README.md",
|
|
34
|
-
"test": "npm run
|
|
35
|
-
"test:unit": "jest
|
|
34
|
+
"test": "npm run build && npm run test:unit && ./test/e2e/run.sh --no-build",
|
|
35
|
+
"test:unit": "jest",
|
|
36
36
|
"test:watch": "jest --watch",
|
|
37
|
-
"test:coverage": "
|
|
38
|
-
"test:
|
|
37
|
+
"test:coverage": "npm run test:coverage:unit && npm run test:coverage:e2e && npm run test:coverage:merge",
|
|
38
|
+
"test:coverage:unit": "jest --coverage && find test/coverage/unit -name '*.html' -exec sed -i '' -e 's/Code coverage report for All files/mcpc Coverage (Unit Tests)/g' -e 's/<h1>All files<\\/h1>/<h1>Unit Test Coverage<\\/h1>/g' {} \\;",
|
|
39
|
+
"test:coverage:e2e": "./test/e2e/run.sh --coverage",
|
|
40
|
+
"test:coverage:merge": "test/coverage/coverage-merge.sh",
|
|
41
|
+
"test:e2e": "./test/e2e/run.sh --keep",
|
|
39
42
|
"lint": "eslint src/**/*.ts",
|
|
40
43
|
"lint:fix": "eslint src/**/*.ts --fix",
|
|
41
44
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
@@ -45,8 +48,7 @@
|
|
|
45
48
|
"prepublishOnly": "npm run lint && npm run build && npm test",
|
|
46
49
|
"release": "bash scripts/publish.sh",
|
|
47
50
|
"release:minor": "bash scripts/publish.sh minor",
|
|
48
|
-
"release:major": "bash scripts/publish.sh major"
|
|
49
|
-
"publish:placeholder": "bash scripts/publish-placeholder.sh"
|
|
51
|
+
"release:major": "bash scripts/publish.sh major"
|
|
50
52
|
},
|
|
51
53
|
"dependencies": {
|
|
52
54
|
"@inquirer/input": "^5.0.3",
|
|
@@ -61,14 +63,16 @@
|
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
63
65
|
"@types/jest": "^30.0.0",
|
|
64
|
-
"doctoc": "^2.2.1",
|
|
65
66
|
"@types/node": "^25.0.3",
|
|
66
67
|
"@types/proper-lockfile": "^4.1.4",
|
|
67
68
|
"@types/uuid": "^11.0.0",
|
|
68
69
|
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
69
70
|
"@typescript-eslint/parser": "^8.50.0",
|
|
71
|
+
"c8": "^10.1.3",
|
|
72
|
+
"doctoc": "^2.2.1",
|
|
70
73
|
"eslint": "^8.57.1",
|
|
71
74
|
"jest": "^30.2.0",
|
|
75
|
+
"nyc": "^17.1.0",
|
|
72
76
|
"prettier": "^3.7.4",
|
|
73
77
|
"ts-jest": "^29.4.6",
|
|
74
78
|
"typescript": "^5.9.3"
|
package/TESTING.md
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
# Quick Testing Guide for mcpc
|
|
2
|
-
|
|
3
|
-
This guide provides quick commands to test the current implementation of mcpc.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install
|
|
9
|
-
npm run build
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Quick Tests
|
|
13
|
-
|
|
14
|
-
### 1. Help and Version
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Show help
|
|
18
|
-
node dist/cli/index.js --help
|
|
19
|
-
|
|
20
|
-
# Show version
|
|
21
|
-
node dist/cli/index.js --version
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### 2. HTTP URL Targets
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
# Try to connect to a URL (will fail - no real server)
|
|
28
|
-
node dist/cli/index.js https://example.com/mcp tools-list
|
|
29
|
-
|
|
30
|
-
# With verbose logging
|
|
31
|
-
node dist/cli/index.js https://example.com/mcp --verbose tools-list
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### 3. Config File Loading
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# List servers in config
|
|
38
|
-
cat examples/test-config.json
|
|
39
|
-
|
|
40
|
-
# Use HTTP server from config (will fail to connect)
|
|
41
|
-
node dist/cli/index.js --config examples/test-config.json example-http tools-list
|
|
42
|
-
|
|
43
|
-
# Try non-existent server (shows error)
|
|
44
|
-
node dist/cli/index.js --config examples/test-config.json bad-server tools-list
|
|
45
|
-
|
|
46
|
-
# Test environment variable substitution
|
|
47
|
-
EXAMPLE_API_TOKEN=secret123 node dist/cli/index.js \
|
|
48
|
-
--config examples/test-config.json example-http tools-list
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 4. Package Resolution
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
# Create test package in node_modules
|
|
55
|
-
mkdir -p node_modules/example-mcp-server
|
|
56
|
-
cp -r examples/test-package/* node_modules/example-mcp-server/
|
|
57
|
-
|
|
58
|
-
# Try to use the package (will fail - not a real MCP server)
|
|
59
|
-
node dist/cli/index.js example-mcp-server tools-list
|
|
60
|
-
|
|
61
|
-
# Try non-existent package (shows helpful error)
|
|
62
|
-
node dist/cli/index.js nonexistent-package tools-list
|
|
63
|
-
|
|
64
|
-
# With verbose to see resolution details
|
|
65
|
-
node dist/cli/index.js example-mcp-server --verbose tools-list
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 5. Named Sessions (Not Implemented)
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# Try named session (shows "not implemented")
|
|
72
|
-
node dist/cli/index.js @my-session tools-list
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Real MCP Server Testing
|
|
76
|
-
|
|
77
|
-
To test with an actual MCP server, you can:
|
|
78
|
-
|
|
79
|
-
### Option 1: Install an official MCP server package
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
# Install a real MCP server (example - adjust as needed)
|
|
83
|
-
npm install -g @modelcontextprotocol/server-filesystem
|
|
84
|
-
|
|
85
|
-
# Use it with mcpc
|
|
86
|
-
mcpc @modelcontextprotocol/server-filesystem tools-list
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Option 2: Use a remote MCP server
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# If you have access to a real MCP server URL
|
|
93
|
-
mcpc https://your-mcp-server.com tools-list
|
|
94
|
-
mcpc https://your-mcp-server.com resources-list
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Option 3: Create a config file for your servers
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"mcpServers": {
|
|
102
|
-
"my-server": {
|
|
103
|
-
"url": "https://my-real-mcp-server.com",
|
|
104
|
-
"headers": {
|
|
105
|
-
"Authorization": "Bearer ${MY_API_KEY}"
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"filesystem": {
|
|
109
|
-
"command": "npx",
|
|
110
|
-
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Then use it:
|
|
117
|
-
```bash
|
|
118
|
-
MY_API_KEY=secret mcpc --config my-config.json my-server tools-list
|
|
119
|
-
mcpc --config my-config.json filesystem resources-list
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Unit Tests
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Run all tests
|
|
126
|
-
npm test
|
|
127
|
-
|
|
128
|
-
# Run specific test file
|
|
129
|
-
npm test -- test/lib/config.test.ts
|
|
130
|
-
npm test -- test/lib/logger.test.ts
|
|
131
|
-
|
|
132
|
-
# Run with coverage
|
|
133
|
-
npm run test:coverage
|
|
134
|
-
|
|
135
|
-
# Watch mode
|
|
136
|
-
npm run test:watch
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Linting
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
# Check for issues
|
|
143
|
-
npm run lint
|
|
144
|
-
|
|
145
|
-
# Auto-fix issues
|
|
146
|
-
npm run lint:fix
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## Expected Behaviors
|
|
150
|
-
|
|
151
|
-
### ✅ Should Work
|
|
152
|
-
|
|
153
|
-
- CLI help and version display
|
|
154
|
-
- HTTP URL parsing and resolution
|
|
155
|
-
- Config file loading and parsing
|
|
156
|
-
- Environment variable substitution in configs
|
|
157
|
-
- Package discovery in node_modules
|
|
158
|
-
- Global package discovery (npm and Bun)
|
|
159
|
-
- Clear error messages for missing files/packages
|
|
160
|
-
- Verbose logging with --verbose flag
|
|
161
|
-
|
|
162
|
-
### ❌ Will Fail (Expected)
|
|
163
|
-
|
|
164
|
-
These will fail because they require actual MCP servers:
|
|
165
|
-
|
|
166
|
-
- Connecting to example.com (not an MCP server)
|
|
167
|
-
- Using the test package (doesn't implement MCP protocol)
|
|
168
|
-
- Any command that needs actual MCP communication
|
|
169
|
-
|
|
170
|
-
These will fail because they're not implemented yet:
|
|
171
|
-
|
|
172
|
-
- Named sessions (@session-name)
|
|
173
|
-
- Session commands (connect, close)
|
|
174
|
-
- Interactive shell
|
|
175
|
-
|
|
176
|
-
## Troubleshooting
|
|
177
|
-
|
|
178
|
-
### "Package not found" error
|
|
179
|
-
- Make sure the package is installed in node_modules or globally
|
|
180
|
-
- Check the package name spelling
|
|
181
|
-
- Verify package.json exists in the package
|
|
182
|
-
|
|
183
|
-
### "Config file not found" error
|
|
184
|
-
- Check the path to the config file
|
|
185
|
-
- Use absolute path or path relative to current directory
|
|
186
|
-
|
|
187
|
-
### "Server not found in config" error
|
|
188
|
-
- Check the server name matches exactly (case-sensitive)
|
|
189
|
-
- List available servers in the error message
|
|
190
|
-
|
|
191
|
-
### "Failed to connect" error
|
|
192
|
-
- This is expected when testing with non-real MCP servers
|
|
193
|
-
- Use a real MCP server URL or package to test actual connections
|
|
194
|
-
|
|
195
|
-
## What's Next
|
|
196
|
-
|
|
197
|
-
After confirming tests work, you can proceed with:
|
|
198
|
-
|
|
199
|
-
**Phase 2: Bridge & Sessions**
|
|
200
|
-
- Persistent MCP connections
|
|
201
|
-
- Session management
|
|
202
|
-
- Unix socket IPC
|
|
203
|
-
|
|
204
|
-
**Phase 3: Authentication**
|
|
205
|
-
- OAuth 2.1 support
|
|
206
|
-
- Keychain integration
|
|
207
|
-
- Auth profile management
|
|
208
|
-
|
|
209
|
-
**Phase 4: Enhancements**
|
|
210
|
-
- Interactive shell
|
|
211
|
-
- Caching
|
|
212
|
-
- Tab completion
|