qwen_agent/skills/developing/pmda-drug-info
2026-06-12 11:03:30 +08:00
..
.claude-plugin add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
agents add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
hooks add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
db.py add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
drug_category.md add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
mcp_common.py 增加子agent支持 2026-05-11 18:55:25 +08:00
os_client.py add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
pmda_server.py add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
pmda_tools.json add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
queries.py add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
README.md add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
requirements.txt add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00
taxonomy.py add mainAgentHiddenTools 2026-06-12 11:03:30 +08:00

pmda-drug-info — Claude Code MCP plugin

PMDA 添付文書ベース医薬指導 Q&A の MCP pluginhu-sandbox/pmda v2e 98/100 baseline

アーキテクチャ

Claude Code (agent) → MCP stdio → pmda_server.py
                                   ├─ PG queries (drug_master / interaction / restriction / dosing)
                                   └─ OS search (pmda_sections, sudachi C-mode)

10 tools: search_drugs, list_categories, list_drugs_in_category, get_drug_master, get_drug_interactions, get_drug_restrictions, get_drug_dosing, search_section_text, list_drug_chapters, read_drug_chapter.

4 sub-agentsagents/*.md: single_drug, interaction, patient_specific, adverse_event.

Plugin は独立配布

mygpt.* への依存なし。PG/OS への接続情報を環境変数で渡すだけで動く。 queries.py / db.py / os_client.py / taxonomy.py / drug_category.md は hu-sandbox/pmda からコピーした自己完結セット。

環境変数

PMDA_PG_HOST           Postgres ホスト (例: tunnel / pg.example.com)
PMDA_PG_PORT           Postgres ポート (default 5432)
PMDA_PG_DB             Postgres DB (例: gptbase)
PMDA_PG_USER           Postgres ユーザ
PMDA_PG_PASSWORD       Postgres パスワード

PMDA_OPENSEARCH_URL    OpenSearch URL (例: http://admin:admin@tunnel:9200)
PMDA_OS_INDEX          OS index 名default: pmda_sections

インストール

pip install -r requirements.txt

Claude Code:

# Plugin ディレクトリを Claude Code に登録PROJECT 単位で)
/plugin install path/to/pmda-drug-info

.claude-plugin/plugin.jsonmcpServers.pmda_drug_infopython ./pmda_server.py を stdio MCP サーバとして起動する。

データ準備

Plugin は読み取り専用。データ投入は gbase-onprem の folder-connector

  • PmdaXmlPipelinemygpt/plugins/pmda/pipeline.py)が一括管理する。
  • PG: aerich migration migrations/models/263_*_add_pmda_tables.py で 4 表作成
  • OS: pmda_sections index は mygpt/plugins/pmda/os_index.py の DDL を pipeline 初期化時に適用
  • データ投入: folder-connector で PMDA XML を登録すると 9 ステップ pipeline が OS bulk index + PG fact 抽出を実行

詳細は docs/pmda-sync-flow.md を参照。

動作確認

# stdio MCP リクエストを手動で投げる
echo '{"jsonrpc":"2.0","id":1,"method":"initialize"}' | python pmda_server.py
echo '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | python pmda_server.py
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_drugs","arguments":{"query":"ロサルタン"}}}' | python pmda_server.py