Token导航 LogoToken导航TokenDH.com
MCP Ressl logo
AI代理stdio官方级别未说明来源级核验

MCP Ressl

MCP Server

@modelcontextprotocol/inspector

MCP关键词搜索服务器是一款用于在文件中搜索关键词并返回匹配行及其行号和匹配次数的工具,支持区分大小写搜索和错误处理。

工具数

1

提示词数

0

GitHub Stars

0

资源数

0
开发工具JavaScriptClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

vishnumouli

提供方

vishnumouli

最后核验

2026/5/17 20:19

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx @modelcontextprotocol/inspector node /path/to/mcp-ressl/build/index.js

详细介绍

MCP关键字搜索服务器

MCP(模型上下文协议)服务器,在文件中搜索关键字,并返回具有行号和匹配计数的匹配行。

特性

  • 搜索关键字 查找文件中出现的所有关键字的工具
  • 返回行号、整行内容和匹配计数
  • 支持区分大小写和不区分大小写的搜索
  • 每行计算多个匹配项
  • 清除丢失文件或无效输入的错误处理

安装

npm install
npm run build

快速开始

选项1:使用MCP检查员进行测试(推荐)

npx @modelcontextprotocol/inspector node /path/to/mcp-ressl/build/index.js

这将在以下位置打开web UI http://localhost:6277 在那里,您可以交互式地测试该工具。

选项2:与Claude Desktop一起使用

添加到您的Claude Desktop配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "keyword-search": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-ressl/build/index.js"]
    }
  }
}

重新启动Claude Desktop,该工具将可用。

工具:搜索关键字

参数:

  • filePath (string,必填):要搜索的文件的绝对路径
  • keyword (string,必填):要搜索的关键字
  • caseSensitive (boolean,可选):搜索是否区分大小写(默认值:false)

输入示例:

{
  "filePath": "/absolute/path/to/mcp-ressl/test-file.txt",
  "keyword": "TODO",
  "caseSensitive": false
}

输出示例:

Search Results for "TODO" in /absolute/path/to/mcp-ressl/test-file.txt
Total matches: 3
Lines with matches: 3

Line 4 (1 match):
  TODO: Add more test cases

Line 5 (1 match):
  TODO: Implement additional features

Line 7 (1 match):
  But this line has TODO again!

测试

使用MCP检查器UI

  1. 启动检查器: npx @modelcontextprotocol/inspector node build/index.js
  2. 打开 http://localhost:6277 在浏览器中
  3. 导航到“工具”选项卡
  4. 选择 search_keyword
  5. 填写参数并单击“运行工具”

测试用例示例

测试1:基本搜索(不区分大小写)

输入:

{
  "filePath": "/absolute/path/to/test-file.txt",
  "keyword": "keyword",
  "caseSensitive": false
}

预期产量:

Search Results for "keyword" in /absolute/path/to/test-file.txt
Total matches: 6
Lines with matches: 4

Line 1 (1 match):
  This is a test file for keyword search.

Line 2 (1 match):
  The keyword appears here multiple times.

Line 3 (2 matches):
  We can search for any keyword in this file.

Line 9 (3 matches):
  KEYWORD, keyword, KeYwOrD should all match.

测试2:区分大小写的搜索

输入:

{
  "filePath": "/absolute/path/to/test-file.txt",
  "keyword": "KEYWORD",
  "caseSensitive": true
}

预期: 只找到“关键字”(不是“关键字”或“KEYWORD”)

测试3:无匹配项

输入:

{
  "filePath": "/absolute/path/to/test-file.txt",
  "keyword": "nonexistent",
  "caseSensitive": false
}

预期产量:

Search Results for "nonexistent" in /absolute/path/to/test-file.txt
Total matches: 0
Lines with matches: 0

No matches found.

测试4:错误处理

输入:

{
  "filePath": "/path/to/nonexistent/file.txt",
  "keyword": "test",
  "caseSensitive": false
}

预期产量:

Error: Failed to search file: ENOENT: no such file or directory, open '/path/to/nonexistent/file.txt'

测试5:在代码文件中搜索

输入:

{
  "filePath": "/absolute/path/to/mcp-ressl/src/index.ts",
  "keyword": "const",
  "caseSensitive": true
}

预期: 查找全部 const TypeScript文件中的声明

快速命令行测试

# Test directly with grep to verify results
cat test-file.txt | grep -n "TODO"

运作原理

  1. 输入: 您提供要搜索的文件路径和关键字
  2. 处理: 该工具读取文件,将其拆分为行,并搜索每一行
  3. 匹配: 统计每行中关键字出现的次数
  4. 输出: 返回所有具有行号和计数的匹配行

故障排除

检查员无法启动

# Try installing globally first
npm install -g @modelcontextprotocol/inspector
mcp-inspector node /path/to/mcp-ressl/build/index.js

端口已在使用中

默认情况下,检查器使用端口6277。如果正在使用,请关闭其他应用程序,否则检查器将自动使用其他端口。

找不到文件错误

始终使用 绝对路径 为了 filePath 参数。相对路径可能无法正常工作。

未反映的变化

修改源代码后,重新生成:

npm run build

发展

# Watch mode for development (auto-rebuild on changes)
npm run dev

# Build for production
npm run build

# Run the server directly
node build/index.js

项目结构

mcp-ressl/
├── src/
│   └── index.ts          # Main server implementation
├── build/                # Compiled JavaScript output
├── test-file.txt        # Sample file for testing
├── TEST-EXAMPLES.json   # Test case examples
├── package.json         # Dependencies and scripts
└── README.md           # This file

许可证

麻省理工学院

目录标签

目录标签

开发工具JavaScriptClaude关键词搜索本地部署文件处理文本分析MCP协议

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@modelcontextprotocol/inspector

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP