my-mcp-filesystem-server
v1.0.0
Published
A Model Context Protocol server for filesystem operations - Learning Project
Maintainers
Readme
My MCP Filesystem Server
这是一个学习项目 - 自己从零创建的 Model Context Protocol (MCP) 文件系统服务器。
安装
npm install构建
npm run build运行
npm start或直接运行编译后的文件:
node dist/index.js提供的工具
read_file - 读取文件内容
- 参数:
path(string)
- 参数:
write_file - 写入文件内容
- 参数:
path(string),content(string)
- 参数:
list_directory - 列出目录内容
- 参数:
path(string)
- 参数:
delete_file - 删除文件
- 参数:
path(string)
- 参数:
在 Python 中使用
修改你的 Python 代码来使用本地服务器:
from hello_agents.protocols import MCPClient
client = MCPClient(["node", "/root/my-mcp-filesystem-server/dist/index.js"])
async with client:
tools = await client.list_tools()
print(f"可用工具: {[t['name'] for t in tools]}")学习要点
- TypeScript 项目配置
- NPM 包管理
- MCP SDK 使用
- 异步编程
- 工具注册和调用
