@apify/mcpc 0.2.0-beta.1 → 0.2.0-beta.2
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 +6 -0
- package/README.md +48 -3
- package/dist/cli/commands/grep.d.ts +13 -0
- package/dist/cli/commands/grep.d.ts.map +1 -0
- package/dist/cli/commands/grep.js +373 -0
- package/dist/cli/commands/grep.js.map +1 -0
- package/dist/cli/commands/sessions.d.ts +11 -0
- package/dist/cli/commands/sessions.d.ts.map +1 -1
- package/dist/cli/commands/sessions.js +10 -4
- package/dist/cli/commands/sessions.js.map +1 -1
- package/dist/cli/index.js +74 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +3 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +20 -19
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +4 -0
- package/dist/cli/parser.js.map +1 -1
- package/docs/TODOs.md +15 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,8 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- New `mcpc grep <pattern>` command to search tools, resources, prompts, and server instructions across all active sessions, with support for regex (`-E`), type filters (`--tools`, `--resources`, `--prompts`, `--instructions`), single-session search (`mcpc @session grep`), and capability-aware querying (skips unsupported list operations)
|
|
13
|
+
- Recovery hints for crashed and expired sessions in `mcpc` session list output
|
|
14
|
+
|
|
10
15
|
### Fixed
|
|
11
16
|
|
|
17
|
+
- Fixed `mcpc help <command>` showing truncated usage line (e.g. `Usage: resources-read <uri>`) — now correctly shows `Usage: mcpc <@session> resources-read <uri>`
|
|
12
18
|
- Fixed auth loss when reconnecting an unauthorized session via `mcpc connect` — the `unauthorized` status was not cleared, causing all subsequent operations to fail with "Authentication required by server" even after successful reconnection
|
|
13
19
|
- HTTP proxy support (`HTTP_PROXY`/`HTTPS_PROXY` env vars) now works for MCP server connections, OAuth token refresh, and x402 payment signing — previously the MCP SDK transport and OAuth calls bypassed the global proxy dispatcher
|
|
14
20
|
|
package/README.md
CHANGED
|
@@ -129,13 +129,15 @@ Commands:
|
|
|
129
129
|
login <server> Interactively login to a server using OAuth and save profile
|
|
130
130
|
logout <server> Delete an authentication profile for a server
|
|
131
131
|
clean [resources...] Clean up mcpc data (sessions, profiles, logs, all)
|
|
132
|
+
grep <pattern> Search tools and instructions across all active sessions
|
|
132
133
|
x402 [subcommand] [args...] Configure an x402 payment wallet (EXPERIMENTAL)
|
|
133
134
|
help [command] [subcommand] Show help for a specific command
|
|
134
135
|
|
|
135
136
|
MCP session commands (after connecting):
|
|
136
|
-
<@session> Show MCP server info and
|
|
137
|
-
<@session> tools
|
|
138
|
-
<@session> tools-
|
|
137
|
+
<@session> Show MCP server info, capabilities, and tools
|
|
138
|
+
<@session> grep <pattern> Search tools, resources, or prompts
|
|
139
|
+
<@session> tools-list List all server tools
|
|
140
|
+
<@session> tools-get <name> Get tool details and schema
|
|
139
141
|
<@session> tools-call <name> [arg:=val ... | <json> | <stdin]
|
|
140
142
|
<@session> prompts-list
|
|
141
143
|
<@session> prompts-get <name> [arg:=val ... | <json> | <stdin]
|
|
@@ -265,6 +267,49 @@ mcpc @apify shell
|
|
|
265
267
|
Shell commands: `help`, `exit`/`quit`/Ctrl+D, Ctrl+C to cancel.
|
|
266
268
|
Arrow keys navigate history (saved to `~/.mcpc/history`).
|
|
267
269
|
|
|
270
|
+
### Grep (search across sessions)
|
|
271
|
+
|
|
272
|
+
`mcpc grep` searches tools, resources, and prompts across all active sessions or within a single session:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Search tools in all active sessions (default: tools only)
|
|
276
|
+
mcpc grep "search"
|
|
277
|
+
|
|
278
|
+
# Search within a single session
|
|
279
|
+
mcpc @apify grep "actor"
|
|
280
|
+
|
|
281
|
+
# Search resources or prompts instead of tools
|
|
282
|
+
mcpc grep "config" --resources
|
|
283
|
+
mcpc grep "greeting" --prompts
|
|
284
|
+
|
|
285
|
+
# Combine type flags
|
|
286
|
+
mcpc grep "data" --tools --resources --prompts
|
|
287
|
+
|
|
288
|
+
# Regex search
|
|
289
|
+
mcpc grep "search|find" -E
|
|
290
|
+
|
|
291
|
+
# Case-sensitive search (default is case-insensitive)
|
|
292
|
+
mcpc grep "Search" --case-sensitive
|
|
293
|
+
|
|
294
|
+
# Limit results
|
|
295
|
+
mcpc grep "e" -m 5
|
|
296
|
+
|
|
297
|
+
# JSON output for scripting
|
|
298
|
+
mcpc grep "actor" --json
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
By default, `grep` searches only tools. Use `--resources` or `--prompts` to search those types
|
|
302
|
+
(combine with `--tools` to include tools too). Sessions that are crashed or unavailable are shown
|
|
303
|
+
with their status rather than silently skipped.
|
|
304
|
+
|
|
305
|
+
The `grep` command is useful for **dynamic tool discovery**,
|
|
306
|
+
also called [Advanced tool use](https://www.anthropic.com/engineering/advanced-tool-use) by Anthropic
|
|
307
|
+
or [Dynamic context discovery](https://cursor.com/blog/dynamic-context-discovery) by Cursor.
|
|
308
|
+
Rather than loading all tools into context, the AI agent can use `grep` to discover the right tool
|
|
309
|
+
for the job,and only load the matching tools into the context to reduce token usage and improve accuracy.
|
|
310
|
+
|
|
311
|
+
<!-- TODO: explain this more, show diagram -->
|
|
312
|
+
|
|
268
313
|
### JSON mode
|
|
269
314
|
|
|
270
315
|
By default, `mcpc` prints output in Markdown-ish text format with colors, making it easy to read by both humans and AIs.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CommandOptions } from '../../lib/types.js';
|
|
2
|
+
export interface GrepOptions extends CommandOptions {
|
|
3
|
+
tools?: boolean | undefined;
|
|
4
|
+
resources?: boolean | undefined;
|
|
5
|
+
prompts?: boolean | undefined;
|
|
6
|
+
instructions?: boolean | undefined;
|
|
7
|
+
regex?: boolean | undefined;
|
|
8
|
+
caseSensitive?: boolean | undefined;
|
|
9
|
+
maxResults?: number | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function grepSession(session: string, pattern: string, options: GrepOptions): Promise<number>;
|
|
12
|
+
export declare function grepAllSessions(pattern: string, options: GrepOptions): Promise<number>;
|
|
13
|
+
//# sourceMappingURL=grep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/grep.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA0B,cAAc,EAAe,MAAM,oBAAoB,CAAC;AAgB9F,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAoVD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC,CA+CjB;AAyBD,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAmL5F"}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { ClientError } from '../../lib/errors.js';
|
|
3
|
+
import { isProcessAlive } from '../../lib/utils.js';
|
|
4
|
+
import { consolidateSessions } from '../../lib/sessions.js';
|
|
5
|
+
import { withSessionClient } from '../../lib/session-client.js';
|
|
6
|
+
import { withMcpClient } from '../helpers.js';
|
|
7
|
+
import { formatJson, formatToolParamsInline, formatToolAnnotations, grayBacktick, inBackticks, } from '../output.js';
|
|
8
|
+
import { getBridgeStatus, formatBridgeStatus } from './sessions.js';
|
|
9
|
+
function buildMatcher(pattern, options) {
|
|
10
|
+
if (options.regex) {
|
|
11
|
+
let re;
|
|
12
|
+
try {
|
|
13
|
+
re = new RegExp(pattern, options.caseSensitive ? '' : 'i');
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
throw new ClientError(`Invalid regex pattern: ${pattern}\n${err instanceof Error ? err.message : String(err)}`);
|
|
17
|
+
}
|
|
18
|
+
return (text) => re.test(text);
|
|
19
|
+
}
|
|
20
|
+
if (options.caseSensitive) {
|
|
21
|
+
return (text) => text.includes(pattern);
|
|
22
|
+
}
|
|
23
|
+
const lowerPattern = pattern.toLowerCase();
|
|
24
|
+
return (text) => text.toLowerCase().includes(lowerPattern);
|
|
25
|
+
}
|
|
26
|
+
function getSearchTypes(options) {
|
|
27
|
+
const anyFilter = options.tools || options.resources || options.prompts || options.instructions;
|
|
28
|
+
return {
|
|
29
|
+
searchTools: anyFilter ? !!options.tools : true,
|
|
30
|
+
searchResources: !!options.resources,
|
|
31
|
+
searchPrompts: !!options.prompts,
|
|
32
|
+
searchInstructions: anyFilter ? !!options.instructions : true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function buildToolSearchText(tool, sessionName) {
|
|
36
|
+
return `${sessionName}/${tool.name} ${JSON.stringify(tool, null, 2)}`;
|
|
37
|
+
}
|
|
38
|
+
function buildResourceSearchText(resource, sessionName) {
|
|
39
|
+
return `${sessionName}/${resource.uri} ${JSON.stringify(resource, null, 2)}`;
|
|
40
|
+
}
|
|
41
|
+
function buildPromptSearchText(prompt, sessionName) {
|
|
42
|
+
return `${sessionName}/${prompt.name} ${JSON.stringify(prompt, null, 2)}`;
|
|
43
|
+
}
|
|
44
|
+
function buildInstructionsSearchText(instructions, sessionName) {
|
|
45
|
+
return `${sessionName} ${instructions}`;
|
|
46
|
+
}
|
|
47
|
+
async function searchClient(client, matcher, options, sessionName = '') {
|
|
48
|
+
const { searchTools, searchResources, searchPrompts, searchInstructions } = getSearchTypes(options);
|
|
49
|
+
const serverDetails = await client.getServerDetails();
|
|
50
|
+
const capabilities = serverDetails.capabilities;
|
|
51
|
+
const canListTools = searchTools && !!capabilities?.tools;
|
|
52
|
+
const canListResources = searchResources && !!capabilities?.resources;
|
|
53
|
+
const canListPrompts = searchPrompts && !!capabilities?.prompts;
|
|
54
|
+
const [toolsResult, resourcesResult, promptsResult] = await Promise.all([
|
|
55
|
+
canListTools ? client.listAllTools() : null,
|
|
56
|
+
canListResources ? fetchAllResources(client) : null,
|
|
57
|
+
canListPrompts ? fetchAllPrompts(client) : null,
|
|
58
|
+
]);
|
|
59
|
+
const matchedTools = (toolsResult?.tools ?? []).filter((t) => matcher(buildToolSearchText(t, sessionName)));
|
|
60
|
+
const matchedResources = (resourcesResult ?? []).filter((r) => matcher(buildResourceSearchText(r, sessionName)));
|
|
61
|
+
const matchedPrompts = (promptsResult ?? []).filter((p) => matcher(buildPromptSearchText(p, sessionName)));
|
|
62
|
+
const instructionsText = searchInstructions ? serverDetails.instructions : undefined;
|
|
63
|
+
const matchedInstructions = !!instructionsText && matcher(buildInstructionsSearchText(instructionsText, sessionName));
|
|
64
|
+
return {
|
|
65
|
+
tools: matchedTools,
|
|
66
|
+
resources: matchedResources,
|
|
67
|
+
prompts: matchedPrompts,
|
|
68
|
+
instructions: matchedInstructions,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async function fetchAllResources(client) {
|
|
72
|
+
const all = [];
|
|
73
|
+
let cursor;
|
|
74
|
+
do {
|
|
75
|
+
const result = await client.listResources(cursor);
|
|
76
|
+
all.push(...result.resources);
|
|
77
|
+
cursor = result.nextCursor;
|
|
78
|
+
} while (cursor);
|
|
79
|
+
return all;
|
|
80
|
+
}
|
|
81
|
+
async function fetchAllPrompts(client) {
|
|
82
|
+
const all = [];
|
|
83
|
+
let cursor;
|
|
84
|
+
do {
|
|
85
|
+
const result = await client.listPrompts(cursor);
|
|
86
|
+
all.push(...result.prompts);
|
|
87
|
+
cursor = result.nextCursor;
|
|
88
|
+
} while (cursor);
|
|
89
|
+
return all;
|
|
90
|
+
}
|
|
91
|
+
function countMatches(result) {
|
|
92
|
+
return (result.tools.length +
|
|
93
|
+
result.resources.length +
|
|
94
|
+
result.prompts.length +
|
|
95
|
+
(result.instructions ? 1 : 0));
|
|
96
|
+
}
|
|
97
|
+
function countMatchesByType(result) {
|
|
98
|
+
return {
|
|
99
|
+
tools: result.tools.length,
|
|
100
|
+
resources: result.resources.length,
|
|
101
|
+
prompts: result.prompts.length,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function sumMatchesByType(results) {
|
|
105
|
+
return results.reduce((acc, r) => ({
|
|
106
|
+
tools: acc.tools + r.tools.length,
|
|
107
|
+
resources: acc.resources + r.resources.length,
|
|
108
|
+
prompts: acc.prompts + r.prompts.length,
|
|
109
|
+
}), { tools: 0, resources: 0, prompts: 0 });
|
|
110
|
+
}
|
|
111
|
+
function truncateResult(result, limit) {
|
|
112
|
+
const total = countMatches(result);
|
|
113
|
+
if (total <= limit)
|
|
114
|
+
return { result, truncated: 0 };
|
|
115
|
+
let remaining = limit;
|
|
116
|
+
const instructions = result.instructions && remaining > 0 ? true : false;
|
|
117
|
+
if (instructions)
|
|
118
|
+
remaining--;
|
|
119
|
+
const tools = result.tools.slice(0, remaining);
|
|
120
|
+
remaining -= tools.length;
|
|
121
|
+
const resources = result.resources.slice(0, remaining);
|
|
122
|
+
remaining -= resources.length;
|
|
123
|
+
const prompts = result.prompts.slice(0, remaining);
|
|
124
|
+
return {
|
|
125
|
+
result: { tools, resources, prompts, instructions },
|
|
126
|
+
truncated: total - limit,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function formatToolLine(tool) {
|
|
130
|
+
const bullet = chalk.dim('*');
|
|
131
|
+
const params = formatToolParamsInline(tool.inputSchema);
|
|
132
|
+
const parts = [];
|
|
133
|
+
const annotationsStr = formatToolAnnotations(tool.annotations);
|
|
134
|
+
if (annotationsStr)
|
|
135
|
+
parts.push(annotationsStr);
|
|
136
|
+
const toolAny = tool;
|
|
137
|
+
const execution = toolAny.execution;
|
|
138
|
+
const taskSupport = execution?.taskSupport;
|
|
139
|
+
if (taskSupport)
|
|
140
|
+
parts.push(`task:${taskSupport}`);
|
|
141
|
+
const suffix = parts.length > 0 ? ` ${chalk.gray(`[${parts.join(', ')}]`)}` : '';
|
|
142
|
+
return `${bullet} ${grayBacktick()}${chalk.cyan(tool.name)}${params}${grayBacktick()}${suffix}`;
|
|
143
|
+
}
|
|
144
|
+
function formatResourceLine(resource) {
|
|
145
|
+
const bullet = chalk.dim('*');
|
|
146
|
+
return `${bullet} ${inBackticks(resource.uri)}`;
|
|
147
|
+
}
|
|
148
|
+
function formatPromptLine(prompt) {
|
|
149
|
+
const bullet = chalk.dim('*');
|
|
150
|
+
return `${bullet} ${inBackticks(prompt.name)}`;
|
|
151
|
+
}
|
|
152
|
+
function formatResultSection(label, items, formatLine, indent) {
|
|
153
|
+
if (items.length === 0)
|
|
154
|
+
return [];
|
|
155
|
+
const lines = [];
|
|
156
|
+
lines.push(`${indent}${chalk.bold(`${label} (${items.length}):`)}`);
|
|
157
|
+
for (const item of items) {
|
|
158
|
+
lines.push(`${indent} ${formatLine(item)}`);
|
|
159
|
+
}
|
|
160
|
+
return lines;
|
|
161
|
+
}
|
|
162
|
+
function formatGrepResultHuman(result, indent = '') {
|
|
163
|
+
const lines = [];
|
|
164
|
+
if (result.instructions) {
|
|
165
|
+
lines.push(`${indent}${chalk.bold('Instructions')}`);
|
|
166
|
+
}
|
|
167
|
+
lines.push(...formatResultSection('Tools', result.tools, formatToolLine, indent));
|
|
168
|
+
lines.push(...formatResultSection('Resources', result.resources, formatResourceLine, indent));
|
|
169
|
+
lines.push(...formatResultSection('Prompts', result.prompts, formatPromptLine, indent));
|
|
170
|
+
return lines;
|
|
171
|
+
}
|
|
172
|
+
export async function grepSession(session, pattern, options) {
|
|
173
|
+
const matcher = buildMatcher(pattern, options);
|
|
174
|
+
const sessionRef = session.startsWith('@') ? session : `@${session}`;
|
|
175
|
+
return await withMcpClient(session, options, async (client) => {
|
|
176
|
+
const fullResult = await searchClient(client, matcher, options, sessionRef);
|
|
177
|
+
const total = countMatches(fullResult);
|
|
178
|
+
const { result, truncated } = options.maxResults != null
|
|
179
|
+
? truncateResult(fullResult, options.maxResults)
|
|
180
|
+
: { result: fullResult, truncated: 0 };
|
|
181
|
+
if (options.outputMode === 'json') {
|
|
182
|
+
const matchCounts = countMatchesByType(fullResult);
|
|
183
|
+
const jsonOutput = {
|
|
184
|
+
sessions: [
|
|
185
|
+
{
|
|
186
|
+
name: sessionRef,
|
|
187
|
+
status: 'live',
|
|
188
|
+
instructions: result.instructions,
|
|
189
|
+
tools: result.tools,
|
|
190
|
+
resources: result.resources,
|
|
191
|
+
prompts: result.prompts,
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
totalMatches: {
|
|
195
|
+
...matchCounts,
|
|
196
|
+
...(truncated > 0 ? { truncated } : {}),
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
console.log(formatJson(jsonOutput));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
if (total === 0) {
|
|
203
|
+
console.log('No matches found.');
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const lines = formatGrepResultHuman(result);
|
|
207
|
+
lines.push('');
|
|
208
|
+
const suffix = truncated > 0 ? ` (showing ${countMatches(result)})` : '';
|
|
209
|
+
lines.push(chalk.dim(`${total} ${total === 1 ? 'match' : 'matches'}${suffix}.`));
|
|
210
|
+
console.log(lines.join('\n'));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return total > 0 ? 0 : 1;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function formatSkippedSession(skipped) {
|
|
217
|
+
const { dot, text } = formatBridgeStatus(skipped.status);
|
|
218
|
+
return `${chalk.cyan(skipped.name)} ${dot} ${text}`;
|
|
219
|
+
}
|
|
220
|
+
function isSessionQueryable(session) {
|
|
221
|
+
return !!session.pid && isProcessAlive(session.pid);
|
|
222
|
+
}
|
|
223
|
+
export async function grepAllSessions(pattern, options) {
|
|
224
|
+
const matcher = buildMatcher(pattern, options);
|
|
225
|
+
const { sessions } = await consolidateSessions(false);
|
|
226
|
+
const allSessionEntries = Object.values(sessions);
|
|
227
|
+
if (allSessionEntries.length === 0) {
|
|
228
|
+
if (options.outputMode === 'json') {
|
|
229
|
+
console.log(formatJson({ sessions: [], totalMatches: { tools: 0, resources: 0, prompts: 0 } }));
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
console.log(chalk.bold('No active sessions.'));
|
|
233
|
+
console.log(chalk.dim(' \u21B3 run: mcpc connect mcp.example.com @test'));
|
|
234
|
+
}
|
|
235
|
+
return 1;
|
|
236
|
+
}
|
|
237
|
+
const toSessionRef = (name) => (name.startsWith('@') ? name : `@${name}`);
|
|
238
|
+
const queryableSessions = [];
|
|
239
|
+
const skippedSessions = [];
|
|
240
|
+
for (const session of allSessionEntries) {
|
|
241
|
+
if (isSessionQueryable(session)) {
|
|
242
|
+
queryableSessions.push(session);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const status = getBridgeStatus(session);
|
|
246
|
+
skippedSessions.push({
|
|
247
|
+
name: toSessionRef(session.name),
|
|
248
|
+
status,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const settled = await Promise.allSettled(queryableSessions.map(async (session) => {
|
|
253
|
+
const sessionName = toSessionRef(session.name);
|
|
254
|
+
const result = await withSessionClient(sessionName, async (client) => {
|
|
255
|
+
return searchClient(client, matcher, options, sessionName);
|
|
256
|
+
});
|
|
257
|
+
return {
|
|
258
|
+
name: sessionName,
|
|
259
|
+
...result,
|
|
260
|
+
};
|
|
261
|
+
}));
|
|
262
|
+
const results = [];
|
|
263
|
+
const resultsWithMatches = [];
|
|
264
|
+
const errors = [];
|
|
265
|
+
for (const [i, outcome] of settled.entries()) {
|
|
266
|
+
if (outcome.status === 'fulfilled') {
|
|
267
|
+
results.push(outcome.value);
|
|
268
|
+
if (countMatches(outcome.value) > 0) {
|
|
269
|
+
resultsWithMatches.push(outcome.value);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
const reason = outcome.reason;
|
|
274
|
+
errors.push({
|
|
275
|
+
name: toSessionRef(queryableSessions[i].name),
|
|
276
|
+
error: reason instanceof Error ? reason.message : String(reason),
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const totalMatches = sumMatchesByType(results);
|
|
281
|
+
const totalMatchCount = results.reduce((sum, r) => sum + countMatches(r), 0);
|
|
282
|
+
let displayResultsWithMatches = resultsWithMatches;
|
|
283
|
+
let totalTruncated = 0;
|
|
284
|
+
if (options.maxResults != null) {
|
|
285
|
+
let remaining = options.maxResults;
|
|
286
|
+
displayResultsWithMatches = [];
|
|
287
|
+
for (const r of resultsWithMatches) {
|
|
288
|
+
if (remaining <= 0) {
|
|
289
|
+
totalTruncated += countMatches(r);
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const { result: truncR, truncated } = truncateResult(r, remaining);
|
|
293
|
+
remaining -= countMatches(truncR);
|
|
294
|
+
totalTruncated += truncated;
|
|
295
|
+
displayResultsWithMatches.push({ ...r, ...truncR });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (options.outputMode === 'json') {
|
|
299
|
+
const truncatedResultsByName = new Map(displayResultsWithMatches.map((r) => [r.name, r]));
|
|
300
|
+
const sessionEntries = [
|
|
301
|
+
...results.map((r) => {
|
|
302
|
+
if (options.maxResults == null) {
|
|
303
|
+
return {
|
|
304
|
+
name: r.name,
|
|
305
|
+
status: 'live',
|
|
306
|
+
instructions: r.instructions,
|
|
307
|
+
tools: r.tools,
|
|
308
|
+
resources: r.resources,
|
|
309
|
+
prompts: r.prompts,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
const display = truncatedResultsByName.get(r.name);
|
|
313
|
+
return {
|
|
314
|
+
name: r.name,
|
|
315
|
+
status: 'live',
|
|
316
|
+
instructions: display?.instructions ?? false,
|
|
317
|
+
tools: display?.tools ?? [],
|
|
318
|
+
resources: display?.resources ?? [],
|
|
319
|
+
prompts: display?.prompts ?? [],
|
|
320
|
+
};
|
|
321
|
+
}),
|
|
322
|
+
...errors.map((e) => ({
|
|
323
|
+
name: e.name,
|
|
324
|
+
status: 'error',
|
|
325
|
+
error: e.error,
|
|
326
|
+
})),
|
|
327
|
+
...skippedSessions.map((s) => ({
|
|
328
|
+
name: s.name,
|
|
329
|
+
status: s.status,
|
|
330
|
+
})),
|
|
331
|
+
];
|
|
332
|
+
const jsonOutput = {
|
|
333
|
+
sessions: sessionEntries,
|
|
334
|
+
totalMatches: {
|
|
335
|
+
...totalMatches,
|
|
336
|
+
...(totalTruncated > 0 ? { truncated: totalTruncated } : {}),
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
console.log(formatJson(jsonOutput));
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
const lines = [];
|
|
343
|
+
for (const skipped of skippedSessions) {
|
|
344
|
+
lines.push(formatSkippedSession(skipped));
|
|
345
|
+
}
|
|
346
|
+
for (const r of displayResultsWithMatches) {
|
|
347
|
+
lines.push(chalk.cyan(r.name));
|
|
348
|
+
lines.push(...formatGrepResultHuman(r, ' '));
|
|
349
|
+
lines.push('');
|
|
350
|
+
}
|
|
351
|
+
for (const err of errors) {
|
|
352
|
+
lines.push(chalk.yellow(`Warning: ${err.name} \u2014 ${err.error}`));
|
|
353
|
+
}
|
|
354
|
+
if (totalMatchCount === 0 && skippedSessions.length === 0) {
|
|
355
|
+
console.log('No matches found.');
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
if (totalMatchCount > 0) {
|
|
359
|
+
const sessionCount = resultsWithMatches.length;
|
|
360
|
+
const showing = totalMatchCount - totalTruncated;
|
|
361
|
+
const suffix = totalTruncated > 0 ? ` (showing ${showing})` : '';
|
|
362
|
+
lines.push(chalk.dim(`${totalMatchCount} ${totalMatchCount === 1 ? 'match' : 'matches'} across ${sessionCount} ${sessionCount === 1 ? 'session' : 'sessions'}${suffix}.`));
|
|
363
|
+
}
|
|
364
|
+
else if (lines.length > 0) {
|
|
365
|
+
lines.push('');
|
|
366
|
+
lines.push('No matches found.');
|
|
367
|
+
}
|
|
368
|
+
console.log(lines.join('\n'));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return totalMatchCount > 0 ? 0 : 1;
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=grep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../src/cli/commands/grep.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAwCpE,SAAS,YAAY,CAAC,OAAe,EAAE,OAAoB;IACzD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QA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AY,GAAG,kBAAkB,CAAC,MAAM,CAAC;gBAC/C,MAAM,OAAO,GAAG,eAAe,GAAG,cAAc,CAAC;gBACjD,MAAM,MAAM,GAAG,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjE,KAAK,CAAC,IAAI,CACR,KAAK,CAAC,GAAG,CACP,GAAG,eAAe,IAAI,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,WAAW,YAAY,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,MAAM,GAAG,CACpJ,CACF,CAAC;YACJ,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -12,6 +12,17 @@ export declare function connectSession(target: string, name: string, options: {
|
|
|
12
12
|
x402?: boolean;
|
|
13
13
|
insecure?: boolean;
|
|
14
14
|
}): Promise<void>;
|
|
15
|
+
export type DisplayStatus = 'live' | 'disconnected' | 'crashed' | 'unauthorized' | 'expired';
|
|
16
|
+
export declare function getBridgeStatus(session: {
|
|
17
|
+
status?: string;
|
|
18
|
+
pid?: number;
|
|
19
|
+
lastSeenAt?: string;
|
|
20
|
+
}): DisplayStatus;
|
|
21
|
+
export declare function formatBridgeStatus(status: DisplayStatus): {
|
|
22
|
+
dot: string;
|
|
23
|
+
text: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function formatTimeAgo(isoDate: string | undefined): string;
|
|
15
26
|
export declare function listSessionsAndAuthProfiles(options: {
|
|
16
27
|
outputMode: OutputMode;
|
|
17
28
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/sessions.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,UAAU,EAMX,MAAM,oBAAoB,CAAC;AA+D5B,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IACP,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GACA,OAAO,CAAC,IAAI,CAAC,CAiOf;
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/sessions.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,UAAU,EAMX,MAAM,oBAAoB,CAAC;AA+D5B,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IACP,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;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,CAAC,EAAE,OAAO,CAAC;CACtB,GACA,OAAO,CAAC,IAAI,CAAC,CAyCf;AAKD,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GACrD,OAAO,CAAC,IAAI,CAAC,CA8Gf;AAKD,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjG;AAKD,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7D"}
|
|
@@ -195,7 +195,7 @@ export async function connectSession(target, name, options) {
|
|
|
195
195
|
logger.debug(`showServerDetails failed for new session ${name}: ${detailsError.message}`);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
function getBridgeStatus(session) {
|
|
198
|
+
export function getBridgeStatus(session) {
|
|
199
199
|
if (session.status === 'unauthorized') {
|
|
200
200
|
return 'unauthorized';
|
|
201
201
|
}
|
|
@@ -213,7 +213,7 @@ function getBridgeStatus(session) {
|
|
|
213
213
|
}
|
|
214
214
|
return 'live';
|
|
215
215
|
}
|
|
216
|
-
function formatBridgeStatus(status) {
|
|
216
|
+
export function formatBridgeStatus(status) {
|
|
217
217
|
switch (status) {
|
|
218
218
|
case 'live':
|
|
219
219
|
return { dot: chalk.green('●'), text: chalk.green('live') };
|
|
@@ -227,7 +227,7 @@ function formatBridgeStatus(status) {
|
|
|
227
227
|
return { dot: chalk.red('○'), text: chalk.red('expired') };
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function formatTimeAgo(isoDate) {
|
|
230
|
+
export function formatTimeAgo(isoDate) {
|
|
231
231
|
if (!isoDate)
|
|
232
232
|
return '';
|
|
233
233
|
const date = new Date(isoDate);
|
|
@@ -291,6 +291,12 @@ export async function listSessionsAndAuthProfiles(options) {
|
|
|
291
291
|
const target = getServerHost(session.server.url || session.server.command || '');
|
|
292
292
|
console.log(chalk.dim(` ↳ run: mcpc login ${target} && mcpc ${session.name} restart`));
|
|
293
293
|
}
|
|
294
|
+
else if (status === 'crashed') {
|
|
295
|
+
console.log(chalk.dim(` ↳ run: mcpc ${session.name}`));
|
|
296
|
+
}
|
|
297
|
+
else if (status === 'expired') {
|
|
298
|
+
console.log(chalk.dim(` ↳ run: mcpc ${session.name} restart`));
|
|
299
|
+
}
|
|
294
300
|
}
|
|
295
301
|
}
|
|
296
302
|
console.log('');
|
|
@@ -299,7 +305,7 @@ export async function listSessionsAndAuthProfiles(options) {
|
|
|
299
305
|
console.log(chalk.dim(' ↳ run: mcpc login mcp.example.com'));
|
|
300
306
|
}
|
|
301
307
|
else {
|
|
302
|
-
console.log(chalk.bold('
|
|
308
|
+
console.log(chalk.bold('Saved OAuth profiles:'));
|
|
303
309
|
for (const profile of profiles) {
|
|
304
310
|
const hostStr = getServerHost(profile.serverUrl);
|
|
305
311
|
const nameStr = chalk.magenta(profile.name);
|