Filesystem MCP Server
基于 MCP 的招聘匹配系统
将 Milestone-1 的文件系统工具转换为真正的 MCP(Model Context Protocol)服务器,并将 LangGraph 匹配代理重构为客户端来使用它(以及第二个 MCP 服务器),而不是直接调用本地 Python 函数。
项目结构
mcp_recruitment_project/
├── mcp_servers/
│ ├── filesystem_mcp_server.py # Part A — main deliverable
│ └── rag_mcp_server.py # Part B.2 bonus — 2nd MCP server
├── matching_agent.py # Part B — refactored LangGraph agent
├── state.py # LangGraph agent state schema
├── data/
│ ├── resumes/ # cand_001.txt ... cand_005.txt
│ └── job_descriptions/ # sample_jd.txt
├── reports/ # generate_report() output lands here
├── docs/
│ └── workflow_diagram.md # state machine / sequence diagrams
├── tests/
│ └── test_scenarios.py # 7 automated test scenarios
└── requirements.txtRelated MCP server: File Server MCP
第 A 部分 — filesystem_mcp_server.py
基于 Anthropic 官方
mcpPython SDK 构建 — 一个通过 stdio 运行的真正的 JSON-RPC 2.0 服务器,而非手写协议。将 Milestone-1 的操作暴露为 MCP 工具:
list_resumes、read_resume、read_job_description、save_report。将简历/职位描述暴露为 MCP 资源(
resources/list、resources/read),使用resume://<file>和jd://<file>URI,使任何 MCP 客户端无需知道工具名称即可浏览资源池。新增的 MCP 专属能力:
watch_directory(seconds, target)— 轮询文件夹最长 120 秒,报告任何新出现的文件,用于检测新上传的简历。batch_process(candidate_ids, operation)— 在一次往返中跨最多 50 个文件执行read/word_count/validate,而不是每个文件一次调用,并保持弹性(每个文件的错误收集在errors{}映射中,而不是使整个批次失败)。
错误处理使用不同的 JSON-RPC 错误码(
ERR_NOT_FOUND、ERR_INVALID_PARAMS、ERR_FORBIDDEN、ERR_BATCH_TOO_LARGE,以及 SDK 自身的-32603内部错误回退)— 参见docs/workflow_diagram.md§5。ServerConfig数据类集中管理目录、允许的扩展名、批次限制和监视时序;每个路径都可以通过FS_MCP_RESUME_DIR/FS_MCP_JD_DIR/FS_MCP_REPORT_DIR环境变量覆盖,并且每次文件访问都通过_safe_join()进行沙箱隔离,防止路径遍历。
直接对处理器进行冒烟测试(无需客户端):
python mcp_servers/filesystem_mcp_server.py --selftest第 B 部分 — matching_agent.py
所有直接的
os.listdir/open()调用都已移除。启动时,代理创建一个指向两个 MCP 服务器的MultiServerMCPClient,并在运行时发现它们的工具 — 没有硬导入任何工具。每个 LangGraph 节点调用 MCP 工具而非本地函数:
节点
使用的 MCP 工具
parse_jdfilesystem.list_resumesextract_requirements(LLM,若无 API 密钥则使用启发式回退)
search_resumesrag.search_resumesrank_candidatesfilesystem.batch_process(1 次调用,而非 N 次)generate_reportfilesystem.save_report多 MCP 加分项:
search_resumes和所有与文件系统相关的内容来自两个独立的 stdio 服务器进程/会话,证明代理不依赖于单个 MCP 服务器。如果未设置
ANTHROPIC_API_KEY,extract_requirements会回退到基于正则表达式的 JD 解析器,使整个流水线在无网络访问的情况下仍能端到端运行(对评分/CI 很有用)。
运行:
export ANTHROPIC_API_KEY=sk-... # optional; heuristic fallback works without it
python matching_agent.py --jd sample_jd.txt图表
参见 docs/workflow_diagram.md:
系统架构(代理 + 2 个 MCP 服务器)
代理状态机
batch_process的 JSON-RPC 2.0 时序图错误路径时序图
错误码参考表
测试
tests/test_scenarios.py — 7 个场景,可直接运行或通过 pytest 运行:
python tests/test_scenarios.py
# or
python -m pytest tests/test_scenarios.py -vtest_discovery— JSON-RPC 握手 +tools/list+resources/listtest_resource_read— 对resume://cand_001.txt执行resources/readtest_error_handling_not_found— 读取不存在的简历返回正确的isError=trueJSON-RPC 结果test_error_handling_invalid_batch— 拒绝空的candidate_idstest_batch_process_efficiency— 所有简历在 1 次调用中处理完成test_watch_directory_detects_new_file— 监视期间创建的文件会被检测并报告test_multi_mcp_via_agent— 完整的 LangGraph 运行,从两个 MCP 服务器拉取工具,生成已保存的报告
目前所有 7 个测试在此环境中均通过。
设置
pip install -r requirements.txt演示视频
我无法在此环境中录制或渲染实际的视频文件。上面的 tests/test_scenarios.py 运行和 matching_agent.py 运行正是需要录制的确切序列 — 使用例如 OBS、QuickTime 或 Loom 屏幕录制 python tests/test_scenarios.py,然后录制 python matching_agent.py --jd sample_jd.txt,用于 5–6 分钟的提交视频。建议的解说要点:(1)展示 filesystem_mcp_server.py --selftest,(2)展示原始的 stdio JSON-RPC 往返过程,(3)讲解 docs/workflow_diagram.md,(4)运行 matching_agent.py 并解说推理日志中的每个 MCP 调用,(5)打开生成的 reports/match_report.md。
This server cannot be installed
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 Connectors
Hosted Google Ads MCP with OAuth, bounded reads, and prepare/confirm writes.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Discover, hire, and verify real-world physical capability through MCP.
Public MCP server for discovering open jobs. Search, filter, and get application links.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables file system operations (read, write, list, search, watch, batch process) via MCP over JSON-RPC 2.0, used by a resume matching agent.
- FlicenseNot gradedqualityDmaintenanceEnables accessing and managing files from configured folders with filtering and size limits, allowing listing, reading, and searching files via MCP tools and resources.
- FlicenseNot gradedqualityBmaintenanceProvides sandboxed file system tools (read, write, search, list, watch) over the Model Context Protocol, enabling resume matching and analysis workflows via an agent.
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with a sandboxed filesystem via MCP tools for reading, writing, searching, and monitoring files, including batch processing and resource discovery for resume management.
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/Sanket08kumbhare/MCP_Recruitment_Project'
If you have feedback or need assistance with the MCP directory API, please join our Discord server