Skip to main content
Glama
abrarsavan123

Filesystem MCP Server

MCP 集成项目 — 简历匹配代理

里程碑 2:将直接的文件系统工具导入替换为完全符合规范的 Model Context Protocol (MCP) 服务器,由 LangGraph 代理使用。


架构

User
 │
 ▼
matching_agent.py  (LangGraph state machine)
 │
 │  JSON-RPC 2.0 over stdio
 ▼
mcp_client.py  (subprocess manager + RPC transport)
 │
 ▼
filesystem_mcp_server.py  (MCP server, 6 tools)
 │
 ▼
resumes/  (file system)

关键文件

文件

作用

filesystem_mcp_server.py

JSON-RPC 2.0 MCP 服务器,暴露 6 个文件系统工具

mcp_client.py

可复用的 stdio 传输 MCP 客户端,带子进程管理

matching_agent.py

LangGraph 代理 — 通过 MCP 发现并调用工具

tests/test_mcp_server.py

所有 JSON-RPC 方法的单元测试(无子进程)

tests/test_agent.py

带真实子进程 + LangChain 桥接的集成测试

diagrams/workflow_diagram.md

系统的 6 个 Mermaid 图


设置

1. 安装依赖

pip install -r requirements.txt

2. 配置 API 密钥

cp .env.example .env
# Edit .env and set OPENROUTER_API_KEY

openrouter.ai/keys 获取免费密钥。


运行

启动简历匹配代理

python matching_agent.py

示例查询:

  • "列出 resumes 文件夹中的所有简历"

  • "查找具有 Python 技能的候选人并按经验排序"

  • "批量读取所有简历并生成技能对比报告"

  • "监视 resumes 文件夹中的新候选人"

  • "读取 Alice Johnson 的简历并写一段摘要"

独立测试 MCP 服务器

# Send a raw JSON-RPC request
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1"}}}' | python filesystem_mcp_server.py

# Test the MCP client
python mcp_client.py

运行测试

# Unit tests (fast, no subprocess)
python -m pytest tests/test_mcp_server.py -v

# Integration tests (spawns subprocess)
python -m pytest tests/test_agent.py -v -s

# All tests
python -m pytest tests/ -v

MCP 服务器 — 可用工具

工具

描述

read_file(filepath)

读取 PDF、DOCX 或 TXT 文件;返回文本 + 元数据

list_files(directory, extension?)

列出目录中的文件,支持可选过滤

write_file(filepath, content)

将文本写入文件(按需创建目录)

search_in_file(filepath, keyword)

不区分大小写的关键字搜索,带上下文

watch_directory(directory, reset?)

新增 — 快照差异监控,检测新增/修改/删除的文件

batch_process(filepaths, operation, keyword?)

新增 — 通过 ThreadPoolExecutor 并行处理多文件

MCP 服务器 — JSON-RPC 方法

方法

描述

initialize

MCP 握手;返回服务器能力

initialized

客户端确认通知(无响应)

tools/list

资源发现 — 列出全部 6 个工具及其模式

tools/call

使用参数执行指定工具

resources/list

列出文件系统资源(resumes 目录)

resources/read

通过 file:// URI 读取文件资源

ping

存活检查


JSON-RPC 2.0 错误代码

代码

名称

触发时机

-32700

Parse Error

JSON 无效

-32600

Invalid Request

不是有效的 JSON-RPC 2.0 消息

-32601

Method Not Found

未知方法或工具名称

-32602

Invalid Params

参数缺失或类型错误

-32000

Tool Error

工具执行失败


工作流图

参见 diagrams/workflow_diagram.md 中的 6 个 Mermaid 图:

  1. 系统架构总览

  2. LangGraph 状态机

  3. JSON-RPC 2.0 消息流(完整时序图)

  4. watch_directory 轮询流程

  5. batch_process 并行执行

  6. 错误处理流程


对里程碑 1 的依赖

本项目是对 LLM-Powered-File-System-Assistant(里程碑 1)的重构。4 个原始工具(read_filelist_fileswrite_filesearch_in_file)被移植到 MCP 服务器中。llm_file_assistant.py 中直接的 import fs_tools 被 MCP 协议层取代。

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

  • Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.

  • A paid remote MCP for hosted MCP server, built to return verdicts, receipts, usage logs, and audit-r

View all MCP Connectors

Latest Blog Posts

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/abrarsavan123/mcp-integration-project'

If you have feedback or need assistance with the MCP directory API, please join our Discord server