home / skills / vaayne / agent-kit / mcp-grep-code

mcp-grep-code skill

/skills/mcp-grep-code

This skill helps you discover real-world code usage patterns from public repositories by searching literal code snippets across millions of projects.

npx playbooks add skill vaayne/agent-kit --skill mcp-grep-code

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.1 KB
---
name: mcp-grep-code
description: Search real-world code examples from over a million public GitHub repositories. Use when finding code patterns, implementation examples, or how libraries are used in practice. Triggers on "find code examples", "how is [library] used", "search GitHub code", "grep.app search", "code pattern".
---

# Grep.app Code Search

MCP service at `https://mcp.grep.app` (http) with 1 tool.

## Requirements

- `mh` CLI must be installed. If not available, install with:
  ```bash
  curl -fsSL https://raw.githubusercontent.com/vaayne/mcphub/main/scripts/install.sh | sh
  ```

## Usage

List tools: `mh -u https://mcp.grep.app -t http list`
Get tool details: `mh -u https://mcp.grep.app -t http inspect searchGitHub`
Invoke tool: `mh -u https://mcp.grep.app -t http invoke searchGitHub '{"query": "pattern"}'`

## Notes

- Run `inspect` before invoking unfamiliar tools to get full parameter schema
- Timeout: 30s default, use `--timeout <seconds>` to adjust
- **Important**: This searches for literal code patterns (like grep), NOT keywords
- Use actual code that would appear in files, not descriptions

## Tools

| Tool           | Description                                                                                                                 |
| -------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `searchGitHub` | Find real-world code examples from public GitHub repositories. Searches for literal code patterns across millions of repos. |

## Search Tips

**Good queries** (literal code patterns):

- `useState(`
- `import React from`
- `async function`
- `(?s)try {.*await`

**Bad queries** (keywords - won't work well):

- `react state management`
- `how to use hooks`

## Examples

```bash
# Find useState usage patterns
mh -u https://mcp.grep.app -t http invoke searchGitHub '{"query": "useState("}'

# Find async/await patterns
mh -u https://mcp.grep.app -t http invoke searchGitHub '{"query": "async function fetch"}'

# Find import patterns
mh -u https://mcp.grep.app -t http invoke searchGitHub '{"query": "from \"openai\""}'
```

Overview

This skill searches real-world code examples across over a million public GitHub repositories using a fast, literal-pattern code search backend. It is optimized for finding exact code snippets, usage patterns, and library calls as they appear in source files. Use it to quickly surface concrete implementations rather than topical documentation or conceptual guides.

How this skill works

The skill sends literal code-pattern queries to a remote MCP grep.app service and returns matching file snippets and repository references. Queries must be valid code fragments or regular expressions that match file contents; keyword-style searches are not effective. The tool exposes a single action, searchGitHub, which accepts a query string and returns matched code results.

When to use it

  • Find concrete examples of library usage or API calls in real projects
  • Locate idiomatic implementations of a function or pattern
  • Audit how a function or symbol is used across many repositories
  • Discover common error-handling idioms or async patterns
  • Search for specific import, type, or function signatures in real code

Best practices

  • Craft queries as literal code fragments or regular expressions, not plain keywords
  • Inspect tool details before invoking to learn parameter schema and limits
  • Keep queries short and syntactically valid so matches correspond to real files
  • Use regex mode for multi-line or flexible patterns (e.g., try/await blocks)
  • Adjust timeout for larger or slower searches; default timeout is 30s

Example use cases

  • Find how useState is initialized across React projects with query: useState(
  • Search for async/await fetch patterns using: async function fetch
  • Locate library import usage with: from "openai"
  • Grep for try/await structures using a dotall regex like (?s)try {.*await
  • Audit how a specific helper function name is referenced across repos

FAQ

Can I search by keywords like 'state management' or 'how to use hooks'?

No. The service matches literal code patterns in files. Use actual code fragments or regexes that would appear in source files.

How do I run a query from the command line?

Use the mh CLI with the service URL. Example: mh -u https://mcp.grep.app -t http invoke searchGitHub '{"query": "useState("}'.