mfds-mcp
Enables searching and retrieving current Korean Food and Drug Administration (MFDS) legal notices and guidelines with version grouping, currency status, and source trustworthiness.
README
MFDS-MCP — 식약처 법령·지침서 정제 검색 MCP
식약처(MFDS)의 법령정보(게시판 m_203)와 공무원 지침서/민원인 안내서(게시판 m_1059)를
크롤링·캐시하고, RA(인허가) 업무에서 "현행/최신 추정본을 근거와 함께" 검색·반환하는 MCP 서버.
Context7가 최신 라이브러리 문서를 정확히 뽑아주듯, 식약처 자료에서 폐지·구버전을 걸러 현행 추정본을 제공한다. 단, 현행임을 단정하지 않고 상태·근거·신뢰도를 함께 반환한다 (잘못된 "현행" 단정은 검색 실패보다 위험하다).
핵심 동작
- 두 게시판 크롤링 (공개 API 없음 → HTML 크롤 + 첨부 파싱)
m_1059지침서:view.do?seq=N상세 + HWP/HWPX/PDF 첨부가 실제 내용 → 핵심 큐레이션 영역m_203법령: 각 항목이 외부 law.go.kr 로 연결되는 개정공포 피드
- 첨부 전문 텍스트 추출 → SQLite FTS5(trigram) 한국어 전문검색
- 버전 그룹핑 + 상태 판정:
current / superseded / future / repealed / unknown+ 근거 + 신뢰도
⚠️ 법령(m_203) 기능의 한계 (중요)
m_203은 개정공포 피드이지 현행 법령 본문 DB가 아니다. 따라서 본 서버의 법령 검색은
**"개정공포 검색"**이며, 각 결과의 법령 현행 여부는 항상 law_currency = "unknown"으로 반환하고
law.go.kr 원문 링크로 확인하도록 안내한다. "옛 시행령 필터링(현행 본문 제공)"의 완성은
Phase 2: law.go.kr 현행법령 공개 API 연동(무료 OC키)에서 이뤄진다.
설치
uv sync # 또는: pip install -r requirements.txt
레거시 .hwp 전문추출 품질을 높이려면 (선택, 없어도 olefile+zlib 네이티브 경로로 동작):
uv sync --extra hwp
실행 / 등록
로컬(Claude Desktop, stdio):
uv run mcp_server.py
Claude Desktop/Code 설정은 mcp.json.example 참고. DB 경로는 MFDS_DB_PATH(선택, 기본 mfds_cache.db).
원격(Claude.ai 웹 + Desktop, 클라우드): → DEPLOY.md 참고.
Prefect Horizon(구 FastMCP Cloud, 콘솔 horizon.prefect.io)에 GitHub 레포를 연결하면
https://<이름>.fastmcp.app/mcp URL이 생기고, Claude 설정 → 커넥터에 등록하면 웹/데스크톱
어디서나 쓸 수 있다. 엔트리포인트는 mcp_server.py:mcp. 임시 파일시스템 대응으로 시드 DB(mfds_seed.db) + 서버 내 백그라운드
자동 크롤을 사용한다.
로컬 HTTP 테스트:
MFDS_TRANSPORT=http MFDS_HTTP_PORT=8000 uv run mcp_server.py # http://localhost:8000/mcp
데이터 적재 (운영 작업, 검색과 분리)
검색 도구는 읽기 전용이다. 데이터 적재/갱신은 별도 운영 명령으로 실행한다:
uv run admin.py refresh m_1059 --max-pages 5
uv run admin.py refresh m_203 --max-pages 5
uv run admin.py reindex # FTS 재색인
uv run admin.py status # 진단(문서수/파싱실패율/마지막 크롤)
(MCP 도구 mfds_refresh 로도 가능하나 느리고 쓰기 작업이므로 권장하지 않음.)
MCP 도구
| 도구 | 용도 |
|---|---|
mfds_search_guidelines |
지침서(m_1059) 전문검색, 현행본 우선 + 상태/근거 |
mfds_search_law_notices |
법령(m_203) 개정공포 검색 + law.go.kr 링크 |
mfds_get_document |
단일 문서 조회 (meta/full/페이지 청크) |
mfds_latest_version |
주제→현행 후보 + 근거·신뢰도 + 이력 |
mfds_version_history |
그룹 전체 판본·상태 감사(audit) |
mfds_list_recent |
최근 제·개정 모니터링 |
mfds_extract_section |
키워드 주변 발췌 + 출처(첨부·페이지) |
mfds_status |
진단(크롤 시각·문서수·파싱실패율) |
mfds_refresh |
(쓰기) 크롤·갱신 — 운영용 |
출처 / 이용
데이터 출처: 식품의약품안전처(www.mfds.go.kr). 크롤링은 보수적 호출 빈도로 수행하며, 공공누리 등 출처 이용조건을 준수한다. 본 도구는 참조 보조용이며, 규제 판단의 최종 확인은 반드시 원문(첨부 원본 / law.go.kr)으로 해야 한다.
구조
mfds_client.py HTTP 크롤 (목록/상세/첨부 다운로드, charset·UA·백오프·DOM검증)
parsers.py HWP/HWPX/PDF → 텍스트 (+페이지경계, 품질점수)
versioning.py 그룹핑·상태판정·근거/신뢰도
db.py SQLite upsert/FTS/조회 + override 반영
services.py 중수준: 크롤+캐시, 검색, 최신버전 해석
mcp_server.py FastMCP(v2/v3) 도구 등록 + 백그라운드 자동크롤 (엔트리포인트 mcp_server.py:mcp)
admin.py 운영 CLI (refresh/reindex/status/override)
selftest.py 결정적 단위테스트 + 라이브 스모크
schema.sql SQLite 스키마 (FTS5 trigram)
mfds_seed.db 시드 데이터 (배포 직후 즉시 검색용; 런타임 캐시는 mfds_cache.db)
DEPLOY.md 클라우드/원격 배포 가이드
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.