Skip to content

Commit caea8c1

Browse files
committed
Merge branch 'main' into claude/auto-restart-bridge-processes-oidW9
Resolve conflicts with PR #100 (grep command) and PR #105 (help fix): - Take main's grep.ts (more features: --instructions, -m, capability-aware) and re-apply reconnectCrashedSessions call - Take main's index.ts grep options - Export DisplayStatus/getBridgeStatus (used by grep.ts) with new states - Merge changelog entries https://claude.ai/code/session_01FJXX4xys8aMoF4iVZbkC86
2 parents 724f4bf + 6bd62e0 commit caea8c1

File tree

10 files changed

+1244
-360
lines changed

10 files changed

+1244
-360
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- New `mcpc grep <pattern>` command to search tools, resources, and prompts across all active sessions, with support for regex (`-E`), type filters (`--tools`, `--resources`, `--prompts`), and single-session search (`mcpc @session grep`)
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)
1313
- Recovery hints for crashed and expired sessions in `mcpc` session list output
1414
- Auto-reconnect crashed bridge processes in the background when enumerating sessions (`mcpc` or `mcpc grep`), with a 10-second cooldown between reconnection attempts
1515
- New `connecting` and `reconnecting` session states shown during initial connection and auto-reconnection of crashed bridges
1616

1717
### Fixed
1818

19+
- Fixed `mcpc help <command>` showing truncated usage line (e.g. `Usage: resources-read <uri>`) — now correctly shows `Usage: mcpc <@session> resources-read <uri>`
1920
- 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
2021
- 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
2122

README.md

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,15 @@ Commands:
129129
login <server> Interactively login to a server using OAuth and save profile
130130
logout <server> Delete an authentication profile for a server
131131
clean [resources...] Clean up mcpc data (sessions, profiles, logs, all)
132+
grep <pattern> Search tools and instructions across all active sessions
132133
x402 [subcommand] [args...] Configure an x402 payment wallet (EXPERIMENTAL)
133134
help [command] [subcommand] Show help for a specific command
134135
135136
MCP session commands (after connecting):
136-
<@session> Show MCP server info and capabilities
137-
<@session> tools-list List MCP tools
138-
<@session> tools-get <name>
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
139141
<@session> tools-call <name> [arg:=val ... | <json> | <stdin]
140142
<@session> prompts-list
141143
<@session> prompts-get <name> [arg:=val ... | <json> | <stdin]
@@ -265,6 +267,49 @@ mcpc @apify shell
265267
Shell commands: `help`, `exit`/`quit`/Ctrl+D, Ctrl+C to cancel.
266268
Arrow keys navigate history (saved to `~/.mcpc/history`).
267269

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+
268313
### JSON mode
269314

270315
By default, `mcpc` prints output in Markdown-ish text format with colors, making it easy to read by both humans and AIs.

0 commit comments

Comments
 (0)