gremlin-mcp
gremlin_mcp
从YouTube教程 https://www.youtube.com/watch?v=io02ZM0ADqM MCP初学者完整课程中学习 注意:我让Copilot或其他LLM清理了现有的工具代码,并添加了它认为有用的其他工具。有几个工具应谨慎使用,因为它们可以修改文件和目录。我还没有正确测试工具的使用。需要用这个MCP构建一些有用的东西,并设置适当的防护措施。
一个MCP(模型上下文协议)服务器,为代理提供终端和文件管理能力:运行shell/Python命令,搜索和读取文件,以及创建/编辑/删除文件和文件夹。
基于FastMCP构建。
工具
服务器暴露了21个工具,分组如下:
Shell / Python执行
工具 | 用途 |
| 运行shell命令(Windows上为cmd,Unix上为sh) |
| 使用当前解释器执行Python代码片段 |
| 执行Python脚本文件 |
搜索与读取
工具 | 用途 |
| 列出匹配glob模式的绝对路径 |
| 在单个文件中匹配行(带行号) |
| 在目录下递归搜索 |
| 以UTF-8格式读取整个文件 |
| 读取基于1的行范围 |
| 读取环境变量 |
文件与文件夹
工具 | 用途 |
| 写入或追加UTF-8文本 |
| 查找并替换,返回更改的计数 |
| 复制或移动(自动创建父目录) |
| 删除文件或文件夹 |
| 创建文件夹(包括父目录) |
| 目录内省 |
Related MCP server: emcp
要求
Python >= 3.13
fastmcp >= 3.4.7
安装
uv sync # recommended
# or
python -m pip install -e .启动服务器
服务器通过stdio通信,这是FastMCP的默认传输方式。从仓库根目录使用以下任一命令启动:
uv run python -m gremlin_mcp.main
python test.py serve
python start_gremlin_mcp_server.py测试
1. 离线冒烟测试(无需MCP客户端)
python test.py这会导入服务器,调用每个工具(创建并清理临时文件夹),并打印[PASS]/[FAIL]摘要以及总数。
2. 交互式Web检查器
fastmcp dev inspector src/gremlin_mcp/main.py在浏览器中打开MCP Inspector,以便浏览工具、阅读其描述/示例,并交互式调用它们。
注意:
fastmcp dev是一个子命令组,因此必须显式传递inspector子命令(单独使用fastmcp dev src/...将失败)。
3. 快速CLI检查
fastmcp inspect src/gremlin_mcp/main.py # server info + tool summary
fastmcp list src/gremlin_mcp/main.py # just the tool names4. 从MCP客户端连接
将编辑器/客户端的MCP配置指向服务器,通过stdio连接,例如:
{
"mcpServers": {
"gremlin-mcp": {
"command": "uv",
"args": ["run", "python", "-m", "gremlin_mcp.main"]
}
}
}示例工具调用
如同代理发出的调用:
list_dir(path="src")
search_text(pattern="TODO", directory="src")
read_file(file="pyproject.toml")
write_file(file="hello.py", content="print('hi')")
python_code(code="print(6 * 7)") # -> exit=0 / 42
replace_in_file(path="config.py", old="DEBUG = True", new="DEBUG = False")
tree(path=".", depth=2)项目布局
src/gremlin_mcp/
├── __init__.py
├── tools.py # all tool definitions (21 tools)
└── main.py # FastMCP server entry point
test.py # offline smoke test / optional server launcher
start_gremlin_mcp_server.py # minimal "run the server" launcher安全说明
run_command、python_code和python_file执行任意代码。仅将此服务器暴露给您信任的代理/客户端,并考虑在沙箱或受限工作目录中运行它。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceAn MCP server that provides tools for reading, writing, and editing files on the local filesystem.1,608Apache 2.0
- Alicense-qualityDmaintenanceAn MCP server that gives AI agents SSH capabilities to execute commands, transfer files, and inspect remote systems through a preconfigured host list.43MIT
- Alicense-qualityBmaintenanceMCP server for terminal operations and file editing, enabling AI assistants to manage files, run commands, and process large content with auto-chunking.16MIT
Related MCP Connectors
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
An MCP server for deep research or task groups
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jvcaesar/gremlin-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server