Open
Conversation
Adds a new grep command that searches tools, resources, and prompts by name and description across all active MCP sessions. Supports regex matching (-E), case-sensitive mode (-s), and type filters (--tools, --resources, --prompts). Available as both a top-level command (all sessions) and session command (single session). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add recovery hints for crashed and expired sessions in session list Show actionable hints under crashed and expired sessions in `mcpc` output, similar to the existing hint for unauthorized sessions. https://claude.ai/code/session_01D6ovkixxWohRHXaJP7Hh3g * Remove extra text from crashed session hint https://claude.ai/code/session_01D6ovkixxWohRHXaJP7Hh3g --------- Co-authored-by: Claude <noreply@anthropic.com>
* Make grep --resources and --prompts opt-in flags By default, grep now searches only tools. Users must explicitly pass --resources and/or --prompts to include those types in search results. When --tools is combined with other flags, it behaves as an explicit opt-in just like the others. https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Fix grep to always search tools; add e2e tests Tools are now always searched by default (additive model): - No flags → tools only - --resources → tools + resources - --prompts → tools + prompts - --no-tools --resources → resources only Also adds comprehensive e2e tests for grep covering default behavior, opt-in flags, regex, case sensitivity, and JSON output. https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Change grep type flags to explicit selection model No flags → tools only (default). Specifying --resources or --prompts searches exactly those types, skipping tools. Use --tools alongside other flags to include tools explicitly. Updated e2e tests to match. https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Fix grep double-@ prefix on session names in grepAllSessions Session names in sessions.json already include the @ prefix (e.g. "@test"), but grepAllSessions was prepending another @, producing "@@test" which failed to resolve. Now correctly checks for existing prefix. Also changed --tools/--resources/--prompts to explicit selection model: specifying any flag searches exactly those types, default is tools only. https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Improve grep to search session names and full tool schemas, show unavailable sessions The grep matcher now builds searchable text as "@session/item-name <JSON schema>" so patterns can match session names, tool parameters, and other schema metadata. Unavailable sessions (crashed, disconnected, etc.) are now displayed with their status instead of being silently skipped. https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Remove time-ago from skipped session lines in grep output https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Add -m/--max-results option to grep command Limits the number of results shown. The total match count is still reported so users know how many were omitted. Works for both single-session and multi-session grep, with the limit applied globally across sessions. https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Add global grep e2e tests and README documentation - Add test/e2e/suites/basic/grep-global.test.sh covering mcpc grep <pattern> across all active sessions (multi-session search, type flags, regex, case sensitivity, JSON output, --max-results, no-sessions edge case) - Add grep section to README with usage examples - Add grep to command listings in README help block - Remove per-session "(N matches)" suffix from global grep human output https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Consolidate grep changelog entries into single Added entry https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J * Fix grep-global e2e test flakiness by using isolated home directory The test's "no sessions" assertions at the end could fail when other parallel tests had active sessions with matching tools in the shared home directory. https://claude.ai/code/session_016JBmUAMywHLhbJWq94JV3J --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements a new
grepcommand that searches tools, resources, and prompts across all active sessions or within a single session.Features
mcpc grep <pattern>searches all active sessions@session grep <pattern>searches within a specific session--tools,--resources,--promptsflags to limit search scope-E/--regexflag for regular expression patterns-s/--case-sensitiveflag for case-sensitive matchingChanges
src/cli/commands/grep.tswith search logic and formattinggrepcommand in both global and session contextsoutput.tsfor reusegrepcommand