Medical MCP Server

Medical MCP Server

Enables medical information retrieval and drug interaction checking via MCP, integrating a local knowledge base with Grok AI for fallback queries.

Category
访问服务器

README

Medical MCP Server

A Model Context Protocol (MCP) server that provides medical information tools powered by Grok AI. Works with Claude Desktop, Claude Code, and any other MCP-compatible client.

License: MIT Node.js MCP SDK Grok AI


Disclaimer: This server is for EDUCATIONAL PURPOSES ONLY. It is not a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare professional for medical concerns.


Table of Contents


Features

  • Medication Information — Uses, dosage, side effects, and warnings
  • Drug Interaction Checker — Identify potential interactions between two medications
  • Medical Term Definitions — Plain-language explanations of medical terminology
  • General Medical Q&A — Powered by Grok AI for open-ended questions
  • Interactive CLI — Terminal-based client with conversation memory and colored output
  • Claude Desktop Integration — Plug in as an MCP server for seamless AI-assisted queries
  • Hybrid Knowledge Base — Fast local lookups + Grok AI fallback for unknown queries
  • Safety First — Every response includes a medical disclaimer

Architecture

┌──────────────────────────────────────────────────────┐
│                   User / MCP Client                  │
│            (Claude Desktop · CLI · etc.)             │
└───────────────────────┬──────────────────────────────┘
                        │  stdio
                        ▼
┌──────────────────────────────────────────────────────┐
│               MCP Server  (index.js)                 │
│                                                      │
│  ┌─────────────────────┐   ┌──────────────────────┐  │
│  │  Local Knowledge DB │   │     Grok AI API      │  │
│  │  (medications,      │──▶│  (fallback for       │  │
│  │   interactions,     │   │   unknown queries)   │  │
│  │   terminology)      │   └──────────────────────┘  │
│  └─────────────────────┘                             │
│                                                      │
│  Tools: get_medication_info · check_drug_interaction │
│         define_medical_term  · ask_medical_question  │
└──────────────────────────────────────────────────────┘

Prerequisites

Requirement Version
Node.js v18 or higher
Grok API Key Free tier available

Installation

# 1. Clone the repository
git clone https://github.com/your-username/medical-mcp-server.git
cd medical-mcp-server

# 2. Install dependencies
npm install

Configuration

1. Create your .env file

cp .env.example .env

2. Add your Grok API key

Open .env and fill in:

GROK_API_KEY=your_grok_api_key_here
GROK_API_BASE_URL=https://api.x.ai/v1   # optional, this is the default

Getting a Grok API key:

  1. Visit https://console.x.ai/
  2. Sign in with your X (Twitter) account
  3. Go to API Keys → Create new key
  4. Copy it immediately (it won't be shown again)

Usage

CLI (Interactive Mode)

Run the interactive terminal client — no MCP client needed:

npm run cli

Example session:

You: What is aspirin used for?
Assistant: Aspirin (Acetylsalicylic acid) is used for pain relief, fever reduction,
           and as a blood thinner...  [Medical Disclaimer: ...]

You: Check interactions between aspirin and ibuprofen
Assistant: ⚠️ Interaction found: Concurrent use may increase the risk of gastrointestinal
           bleeding...

You: /help      ← type /help to see available commands
You: /exit      ← exits the client

Claude Desktop Integration

Add the server to your Claude Desktop config file:

Windows → %APPDATA%\Claude\claude_desktop_config.json

macOS/Linux → ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "medical": {
      "command": "node",
      "args": ["/absolute/path/to/medical-mcp-server/index.js"]
    }
  }
}

Replace /absolute/path/to/medical-mcp-server/index.js with the actual path on your machine.

After saving:

  1. Restart Claude Desktop
  2. Look for the plug icon (🔌) to confirm the server is connected
  3. Start asking medical questions in your Claude conversations

Available Tools

Tool Description
get_medication_info Detailed medication info — uses, dosage, side effects, warnings
check_drug_interaction Checks for interactions between two medications
define_medical_term Plain-English definitions of medical terminology
ask_medical_question General medical Q&A via Grok AI

Example prompts (in Claude Desktop or CLI)

Can you get information about metformin?
Check if there are any interactions between aspirin and warfarin.
What does tachycardia mean?
What are the common symptoms of dehydration?

Available Resources

URI Description
medical://medications/list Lists all medications in the built-in knowledge base
medical://disclaimer Full medical disclaimer text

Built-in Knowledge Base

The server ships with pre-loaded data so common queries are answered instantly without an API call:

Medications: Aspirin · Ibuprofen · Metformin

Drug Interactions: Aspirin–Ibuprofen · Aspirin–Warfarin · Metformin–Alcohol

Medical Terms: Hypertension · Diabetes · Tachycardia · Hypotension

All other queries fall back to Grok AI automatically.


Project Structure

medical-mcp-server/
├── index.js          # MCP server — tools, resources, Grok integration
├── cli.js            # Interactive CLI client
├── package.json      # Dependencies and npm scripts
├── .env.example      # Environment variable template
├── .gitignore        # Ignores node_modules, .env, logs
├── QUICKSTART.md     # 5-minute setup guide
└── README.md         # This file

Extending the Server

All extension points are in index.js:

Add a new medication to the knowledge base:

MEDICAL_DATA.medications["drug-name"] = {
  name: "Drug Name",
  generic_name: "...",
  uses: [...],
  dosage: "...",
  side_effects: [...],
  warnings: [...],
};

Add a new tool:

  1. Add the tool definition inside the ListToolsRequestSchema handler
  2. Add the handler logic inside the CallToolRequestSchema handler

Add a new resource:

  1. Register the URI in ListResourcesRequestSchema
  2. Handle the URI in ReadResourceRequestSchema

Troubleshooting

Problem Solution
GROK_API_KEY is not set Check that .env exists and contains a valid key with no extra spaces or quotes
Server not showing in Claude Desktop Verify the path in config is absolute and correct, then restart Claude Desktop
API rate limit errors Grok API limits depend on your plan — consider caching frequent queries
CLI won't start Ensure Node.js v18+ is installed (node --version)


Acknowledgments

  • Model Context Protocol SDK — MCP protocol implementation
  • Grok AI by X.AI — AI backend for medical queries
  • Medical data is for educational purposes only and does not replace professional medical advice

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选