@apify/mcpc 0.1.11 → 0.2.0-beta.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 +72 -3
- package/README.md +231 -201
- package/dist/bridge/index.js +224 -34
- package/dist/bridge/index.js.map +1 -1
- package/dist/cli/commands/auth.d.ts +2 -0
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +11 -1
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/logging.d.ts.map +1 -1
- package/dist/cli/commands/logging.js +1 -4
- package/dist/cli/commands/logging.js.map +1 -1
- package/dist/cli/commands/sessions.d.ts +3 -1
- package/dist/cli/commands/sessions.d.ts.map +1 -1
- package/dist/cli/commands/sessions.js +178 -141
- package/dist/cli/commands/sessions.js.map +1 -1
- package/dist/cli/commands/tasks.d.ts +5 -0
- package/dist/cli/commands/tasks.d.ts.map +1 -0
- package/dist/cli/commands/tasks.js +53 -0
- package/dist/cli/commands/tasks.js.map +1 -0
- package/dist/cli/commands/tools.d.ts +2 -0
- package/dist/cli/commands/tools.d.ts.map +1 -1
- package/dist/cli/commands/tools.js +158 -12
- package/dist/cli/commands/tools.js.map +1 -1
- package/dist/cli/commands/x402.d.ts.map +1 -1
- package/dist/cli/commands/x402.js +20 -6
- package/dist/cli/commands/x402.js.map +1 -1
- package/dist/cli/helpers.d.ts +2 -6
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/helpers.js +27 -185
- package/dist/cli/helpers.js.map +1 -1
- package/dist/cli/index.js +436 -203
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +7 -3
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +135 -16
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/parser.d.ts +11 -8
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +89 -65
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/shell.d.ts.map +1 -1
- package/dist/cli/shell.js +30 -3
- package/dist/cli/shell.js.map +1 -1
- package/dist/core/mcp-client.d.ts +17 -3
- package/dist/core/mcp-client.d.ts.map +1 -1
- package/dist/core/mcp-client.js +236 -3
- package/dist/core/mcp-client.js.map +1 -1
- package/dist/lib/auth/keychain.d.ts.map +1 -1
- package/dist/lib/auth/keychain.js +3 -2
- package/dist/lib/auth/keychain.js.map +1 -1
- package/dist/lib/auth/oauth-flow.d.ts +4 -1
- package/dist/lib/auth/oauth-flow.d.ts.map +1 -1
- package/dist/lib/auth/oauth-flow.js +108 -16
- package/dist/lib/auth/oauth-flow.js.map +1 -1
- package/dist/lib/auth/oauth-provider.d.ts +5 -0
- package/dist/lib/auth/oauth-provider.d.ts.map +1 -1
- package/dist/lib/auth/oauth-provider.js +16 -1
- package/dist/lib/auth/oauth-provider.js.map +1 -1
- package/dist/lib/bridge-client.d.ts +1 -1
- package/dist/lib/bridge-client.d.ts.map +1 -1
- package/dist/lib/bridge-client.js +18 -4
- package/dist/lib/bridge-client.js.map +1 -1
- package/dist/lib/bridge-manager.d.ts +1 -0
- package/dist/lib/bridge-manager.d.ts.map +1 -1
- package/dist/lib/bridge-manager.js +39 -17
- package/dist/lib/bridge-manager.js.map +1 -1
- package/dist/lib/errors.js +2 -2
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/file-lock.d.ts.map +1 -1
- package/dist/lib/file-lock.js +4 -2
- package/dist/lib/file-lock.js.map +1 -1
- package/dist/lib/session-client.d.ts +16 -3
- package/dist/lib/session-client.d.ts.map +1 -1
- package/dist/lib/session-client.js +121 -15
- package/dist/lib/session-client.js.map +1 -1
- package/dist/lib/sessions.d.ts.map +1 -1
- package/dist/lib/sessions.js +9 -4
- package/dist/lib/sessions.js.map +1 -1
- package/dist/lib/types.d.ts +37 -6
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -19
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/x402/fetch-middleware.d.ts.map +1 -1
- package/dist/lib/x402/fetch-middleware.js +41 -8
- package/dist/lib/x402/fetch-middleware.js.map +1 -1
- package/docs/TODOs.md +87 -26
- package/package.json +2 -2
- package/renovate.json +2 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { signPayment, parsePaymentRequired, } from './signer.js';
|
|
2
2
|
import { createLogger } from '../logger.js';
|
|
3
3
|
const logger = createLogger('x402-middleware');
|
|
4
|
+
const MCP_PAYMENT_META_KEY = 'x402/payment';
|
|
4
5
|
export function createX402FetchMiddleware(baseFetch, options) {
|
|
5
6
|
const { wallet, getToolByName } = options;
|
|
6
7
|
return async (url, init) => {
|
|
7
8
|
const proactiveHeader = await tryProactiveSigning(init, wallet, getToolByName);
|
|
8
9
|
if (proactiveHeader) {
|
|
9
10
|
logger.debug('Proactively signing x402 payment for tools/call');
|
|
10
|
-
const enhancedInit =
|
|
11
|
+
const enhancedInit = injectPayment(init, proactiveHeader);
|
|
11
12
|
const response = await baseFetch(url, enhancedInit);
|
|
12
13
|
if (response.status !== 402) {
|
|
13
14
|
return response;
|
|
@@ -89,7 +90,7 @@ async function handle402Fallback(url, originalInit, response402, baseFetch, wall
|
|
|
89
90
|
resource: header.resource,
|
|
90
91
|
});
|
|
91
92
|
logger.debug(`402 fallback payment signed: $${result.amountUsd.toFixed(4)} to ${result.to} on ${result.networkLabel}`);
|
|
92
|
-
const retryInit =
|
|
93
|
+
const retryInit = injectPayment(originalInit, result.paymentSignatureBase64);
|
|
93
94
|
return await baseFetch(url, retryInit);
|
|
94
95
|
}
|
|
95
96
|
catch (error) {
|
|
@@ -122,12 +123,44 @@ function extractToolCallName(body) {
|
|
|
122
123
|
return undefined;
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function injectPayment(init, paymentSignatureBase64) {
|
|
126
127
|
const headers = new Headers(init?.headers);
|
|
127
|
-
headers.set('PAYMENT-SIGNATURE',
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
headers.set('PAYMENT-SIGNATURE', paymentSignatureBase64);
|
|
129
|
+
const result = { ...init, headers };
|
|
130
|
+
if (init?.body && typeof init.body === 'string') {
|
|
131
|
+
try {
|
|
132
|
+
const paymentPayload = JSON.parse(Buffer.from(paymentSignatureBase64, 'base64').toString('utf-8'));
|
|
133
|
+
result.body = injectPaymentMeta(init.body, paymentPayload);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
logger.debug('Failed to inject payment into body _meta:', error);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
function injectPaymentMeta(body, paymentPayload) {
|
|
142
|
+
try {
|
|
143
|
+
const parsed = JSON.parse(body);
|
|
144
|
+
if (Array.isArray(parsed)) {
|
|
145
|
+
return body;
|
|
146
|
+
}
|
|
147
|
+
const req = parsed;
|
|
148
|
+
if (req.method === 'tools/call' && req.params) {
|
|
149
|
+
return JSON.stringify({
|
|
150
|
+
...req,
|
|
151
|
+
params: {
|
|
152
|
+
...req.params,
|
|
153
|
+
_meta: {
|
|
154
|
+
...(req.params._meta || {}),
|
|
155
|
+
[MCP_PAYMENT_META_KEY]: paymentPayload,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return body;
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return body;
|
|
164
|
+
}
|
|
132
165
|
}
|
|
133
166
|
//# sourceMappingURL=fetch-middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-middleware.js","sourceRoot":"","sources":["../../../src/lib/x402/fetch-middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-middleware.js","sourceRoot":"","sources":["../../../src/lib/x402/fetch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AM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAMzC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,GAAG,GAAG,MAAwB,CAAC;QACrC,IAAI,GAAG,CAAC,MAAM,KAAK,YAAY,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YAC9C,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,GAAG,GAAG;gBACN,MAAM,EAAE;oBACN,GAAG,GAAG,CAAC,MAAM;oBACb,KAAK,EAAE;wBACL,GAAG,CAAE,GAAG,CAAC,MAAM,CAAC,KAAiC,IAAI,EAAE,CAAC;wBACxD,CAAC,oBAAoB,CAAC,EAAE,cAAc;qBACvC;iBACF;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/docs/TODOs.md
CHANGED
|
@@ -2,50 +2,111 @@
|
|
|
2
2
|
# TODOs
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## NEW
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- the README should show explain each command, show the full options from "mcpc help command" - perhaps this could be on start of the readme,
|
|
9
|
+
with links to the more detailed sections below
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
- mcp-cli inspiration
|
|
13
|
+
Add glob-based tool search across all servers like `mcpc grep *mail*` or `mcpc grep *@session/mail*`.
|
|
14
|
+
Consider making `tools-list` more succinct for discovery.
|
|
15
|
+
Use https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool for inspiration/compatibility?
|
|
16
|
+
-
|
|
17
|
+
|
|
18
|
+
$ mcpc grep "*file*"
|
|
19
|
+
$ mcpc grep "@github/*"
|
|
20
|
+
$ mcpc grep -F "anything really"
|
|
21
|
+
|
|
22
|
+
RETURNS
|
|
23
|
+
@github
|
|
24
|
+
- create_or_update_file(name: string, )
|
|
25
|
+
@filesystem
|
|
26
|
+
- read_file
|
|
27
|
+
@filesystem
|
|
28
|
+
- write_file
|
|
29
|
+
|
|
30
|
+
Then we can have
|
|
31
|
+
$ mcpc @github tools-call get_file_contents arg:="yes" # NOW
|
|
32
|
+
$ mcpc @github/get_file_contents arg:="yes" # NEW
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Bugs !
|
|
37
|
+
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## UX/AX
|
|
42
|
+
|
|
43
|
+
- MAYBE LATER:
|
|
44
|
+
Connects to all entries from file - the
|
|
45
|
+
$ mcpc connect ~/.vscode/mcp.json:puppeteer @puppeteer
|
|
46
|
+
$ mcpc connect ~/.vscode/mcp.json
|
|
47
|
+
$ mcpc connect # Auto-discovery of existing MCP configs like mcporter
|
|
48
|
+
|
|
49
|
+
- Make "mcpc connect mcp.apify.com" work without @session, and generate session name on best effort basis (e.g. use the main hostname without TLD
|
|
50
|
+
+ suffix)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
- Show tools also when running just "mcpc @apify"
|
|
54
|
+
|
|
5
55
|
- mcpc @apify tools-get fetch-actor-details => should print also "object" properties in human mode
|
|
6
56
|
|
|
57
|
+
- mcpc @apify tools-call xxx --help / "mcpc @apify/xxx --help" should print tools-get + command info
|
|
58
|
+
|
|
59
|
+
## Later
|
|
60
|
+
|
|
61
|
+
|
|
7
62
|
- `--capabilities '{"tools":...,"prompts":...}"` to limit access to selected MCP features and tools,
|
|
8
63
|
for both proxy and normal session, for simplicity. The command could work on the fly, to give
|
|
9
64
|
agents less room to wiggle.
|
|
10
|
-
|
|
11
|
-
automatically update the -o file on changes, without it just keep track of changed files in
|
|
12
|
-
bridge process' cache, and report in resources-list/resources-read operation
|
|
65
|
+
|
|
13
66
|
|
|
14
|
-
- Ensure "logging-set-level" works well
|
|
15
67
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
68
|
+
## Code mode
|
|
69
|
+
- Emit tools to dirs ("codegen" variant?) - see https://cursor.com/blog/dynamic-context-discovery - generate skills file too?
|
|
70
|
+
- feature: enable generation of TypeScript stubs based on the server schema, with access to session and schema validation, for TS code mode.
|
|
71
|
+
For simplicity they an just "mcpc" command, later we can use IPC for more efficiency.
|
|
20
72
|
|
|
21
73
|
|
|
22
|
-
|
|
74
|
+
# Misc
|
|
23
75
|
|
|
24
|
-
- Emit tools to dirs ("codegen" variant?) - see https://cursor.com/blog/dynamic-context-discovery - generate skills file too?
|
|
25
76
|
|
|
26
|
-
- Support for Markdown generation with shebang?
|
|
27
77
|
|
|
28
|
-
|
|
29
|
-
- Tool list refresh - how about printing it to stderr on first time after it happens? then the agent/user would notice and tools-list again
|
|
78
|
+
## Nice to have
|
|
30
79
|
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
80
|
+
- $ mcpc @apify tools-call search-apify-docs query:="test"
|
|
81
|
+
Should skip `structuredContent` in results if there is `content` with "type": "text", and print it as text. AI agents can use --json
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
- Implement resources-subscribe/resources-unsubscribe, --o file command properly, --max-size
|
|
85
|
+
automatically update the -o file on changes, without it just keep track of changed files in
|
|
86
|
+
bridge process' cache, and report in resources-list/resources-read operatio
|
|
87
|
+
|
|
88
|
+
- Add support for "mcpc close @session", "mcpc restart @session" and "mcpc shell @session" - add to docs
|
|
89
|
+
|
|
90
|
+
- Add ASCII diagrams to README to help explain major concepts: tool calling, auth, bridge process, etc.
|
|
91
|
+
For inspiration, see https://github.com/philschmid/mcp-cli
|
|
92
|
+
|
|
93
|
+
- "login" and "logout" commands could work also with file:entry and @session, just use the remote server URL from the config file or session host.
|
|
94
|
+
it would make "connect" and "login" command consistent.
|
|
95
|
+
- Restart of expired OAuth session is too many steps - why not add "mcpc login <session>" to refresh?
|
|
96
|
+
|
|
97
|
+
- revise the session states: maybe introduce new session status `auth-failed` or `unauthed` (or some better name?)
|
|
98
|
+
consider forking "alive" session state to "alive" and "disconnected", to indicate the remote server is not responding but bridge
|
|
34
99
|
runs fine. We can use lastSeenAt + ping interval info for that, or status of last ping.
|
|
100
|
+
|
|
35
101
|
- ux: Be even more forgiving with `args:=x`, when we know from tools/prompt schema the text is compatible with `x` even if the exact type is not -
|
|
36
102
|
just re-type it dynamically to make it work.
|
|
37
103
|
- nit: Cooler OAuth flow finish web page with CSS animation, add Apify example there, show mcpc info. E.g. next step - check Apify rather than close
|
|
38
104
|
- security: For auth profiles, fetch the detailed user info via http, save to profiles.json and show in 'mcpc', ensure the info is up-to-date
|
|
39
|
-
- later: Add unique Session.id and Profile.id and use it for OS keychain keys, to truly enable using multiple independent mcpc profiles.
|
|
40
|
-
- nit: Implement typing completions (e.g. "mcpc @ap...") - not sure if that's even possible
|
|
41
|
-
-
|
|
42
|
-
- feature: enable generation of TypeScript stubs based on the server schema, with access to session and schema validation, for TS code mode.
|
|
43
|
-
For simplicity they an just "mcpc" command, later we can use IPC for more efficiency.
|
|
105
|
+
- later: Add unique Session.id and Profile.id and use it for OS keychain keys, to truly enable using multiple independent mcpc profiles.
|
|
106
|
+
- nit: Implement typing tab-completions (e.g. "mcpc @ap...") - not sure if that's even possible
|
|
107
|
+
- Consider adding `--dry-run` https://justin.poehnelt.com/posts/rewrite-your-cli-for-ai-agents/
|
|
44
108
|
- Show protocolVersion also for stdio - but for that we need to update the SDK to save it! See setProtocolVersion
|
|
45
109
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Questions
|
|
110
|
+
- nit: show also header / open auth statuses for HTTP servers?
|
|
50
111
|
|
|
51
|
-
-
|
|
112
|
+
- consider adding --idle-timeout to "connect" and then automatically disconnet from remote server, to avoid handing infinitely
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/mcpc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-beta.0",
|
|
4
4
|
"description": "Universal command-line client for the Model Context Protocol (MCP).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build": "tsc",
|
|
33
33
|
"build:watch": "tsc --watch",
|
|
34
34
|
"build:readme": "./scripts/update-readme.sh",
|
|
35
|
-
"test": "npm run build && npm run test:unit && ./test/e2e/run.sh --no-build --parallel
|
|
35
|
+
"test": "npm run build && npm run test:unit && ./test/e2e/run.sh --no-build --parallel 8 && ./test/e2e/run.sh --no-build --parallel 8 --runtime bun",
|
|
36
36
|
"test:unit": "jest",
|
|
37
37
|
"test:watch": "jest --watch",
|
|
38
38
|
"test:coverage": "npm run test:coverage:unit && npm run test:coverage:e2e && npm run test:coverage:merge",
|