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

6개의 파일 시스템 도구를 노출하는 JSON-RPC 2.0 MCP 서버

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

시스템의 Mermaid 다이어그램 6개


Related MCP server: Filesystem MCP Server

설정

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에서 Mermaid 다이어그램 6개를 확인하세요:

  1. 시스템 아키텍처 개요

  2. LangGraph 상태 머신

  3. JSON-RPC 2.0 메시지 흐름 (전체 시퀀스 다이어그램)

  4. watch_directory 폴링 흐름

  5. batch_process 병렬 실행

  6. 오류 처리 흐름


마일스톤 1에 대한 의존성

이 프로젝트는 LLM-Powered-File-System-Assistant (마일스톤 1)의 리팩터링입니다. 원래의 4개 도구(read_file, list_files, write_file, search_in_file)는 MCP 서버로 이식됩니다. llm_file_assistant.py의 직접적인 import fs_tools는 MCP 프로토콜 계층으로 대체됩니다.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables file system operations (read, write, list, search, watch, batch process) via MCP over JSON-RPC 2.0, used by a resume matching agent.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides file system tools for resume matching agents, enabling reading, writing, searching, listing, watching, and batch processing of files via the Model Context Protocol.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    Provides MCP tools for filesystem operations on resume directories, including watch, batch extraction, and saving match results.
    1
    -