morph-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Morph Codebase Search

Morph代码库搜索

Fast, AI-powered codebase search using WarpGrep. 20x faster than traditional grep.
基于WarpGrep的AI驱动型快速代码库搜索工具,速度比传统grep快20倍。

When to Use

使用场景

  • Search codebase for patterns, function names, variables
  • Find code across large codebases quickly
  • Edit files programmatically
  • 在代码库中搜索模式、函数名、变量
  • 快速在大型代码库中查找代码
  • 以编程方式编辑文件

Usage

使用方法

Search for code patterns

搜索代码模式

bash
uv run python -m runtime.harness scripts/mcp/morph_search.py \
    --search "authentication" --path "."
bash
uv run python -m runtime.harness scripts/mcp/morph_search.py \
    --search "authentication" --path "."

Search with regex

使用正则表达式搜索

bash
uv run python -m runtime.harness scripts/mcp/morph_search.py \
    --search "def.*login" --path "./src"
bash
uv run python -m runtime.harness scripts/mcp/morph_search.py \
    --search "def.*login" --path "./src"

Edit a file

编辑文件

bash
uv run python -m runtime.harness scripts/mcp/morph_search.py \
    --edit "/path/to/file.py" --content "new content"
bash
uv run python -m runtime.harness scripts/mcp/morph_search.py \
    --edit "/path/to/file.py" --content "new content"

Parameters

参数说明

ParameterDescription
--search
Search query/pattern
--path
Directory to search (default:
.
)
--edit
File path to edit
--content
New content for file (use with
--edit
)
参数描述
--search
搜索查询/模式
--path
要搜索的目录(默认值:
.
--edit
要编辑的文件路径
--content
文件的新内容(需与
--edit
配合使用)

Examples

示例

bash
undefined
bash
undefined

Find all async functions

查找所有异步函数

uv run python -m runtime.harness scripts/mcp/morph_search.py
--search "async def" --path "./src"
uv run python -m runtime.harness scripts/mcp/morph_search.py
--search "async def" --path "./src"

Search for imports

搜索导入语句

uv run python -m runtime.harness scripts/mcp/morph_search.py
--search "from fastapi import" --path "."
undefined
uv run python -m runtime.harness scripts/mcp/morph_search.py
--search "from fastapi import" --path "."
undefined

vs ast-grep

与ast-grep对比

ToolBest For
morph/warpgrepFast text/regex search (20x faster)
ast-grepStructural code search (understands syntax)
工具适用场景
morph/warpgrep快速文本/正则搜索(速度快20倍)
ast-grep结构化代码搜索(理解语法)

MCP Server Required

需MCP Server支持

Requires
morph
server in mcp_config.json with
MORPH_API_KEY
.
需要在mcp_config.json中配置
morph
服务器,并提供
MORPH_API_KEY