
Health-Article-MCP
3 years
Works with Finder
0
Github Watches
0
Github Forks
0
Github Stars
AI Health Article Summarizer & Explainer
A FastAPI-based multi-agent system for processing and analyzing medical articles. The system fetches articles from URLs, generates summaries, explains medical terminology, and assesses study quality.
Features
- Article Fetching: Extracts content from medical articles and research papers
- Smart Summarization: Generates concise, accurate summaries of medical content
- Terminology Explanation: Identifies and explains medical terms in layperson-friendly language
- Quality Assessment: Evaluates study quality based on methodology, sample size, statistical rigor, and more
- Multi-Agent Architecture: Coordinated processing through specialized agents
- Error Handling & Retry Logic: Robust error handling with exponential backoff retry mechanism
- Rate Limiting: Prevents API abuse with configurable rate limits
- Response Caching: Improves performance by caching responses
- URL Validation: Ensures only valid medical/academic URLs are processed
Requirements
- Python 3.9+
- Redis server (for rate limiting and caching)
- OpenAI API key
Installation
- Clone the repository:
git clone https://github.com/lyudmylan/health-article-mcp.git
cd health-article-mcp
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Install and start Redis server:
# On macOS using Homebrew
brew install redis
brew services start redis
# On Ubuntu/Debian
sudo apt-get install redis-server
sudo systemctl start redis-server
- Set up environment variables:
export OPENAI_API_KEY='your-api-key-here'
export REDIS_URL='redis://localhost' # Optional: default is localhost
export RATE_LIMIT_MAX_REQUESTS='60' # Optional: requests per window
export RATE_LIMIT_WINDOW='60' # Optional: window in seconds
export CACHE_TTL='3600' # Optional: cache TTL in seconds
Redis Configuration
The application uses Redis for rate limiting and caching. Make sure you have Redis installed and running locally, or set the REDIS_URL
environment variable to point to your Redis instance.
Local Redis Setup
-
Install Redis:
- macOS:
brew install redis
- Linux:
sudo apt-get install redis-server
- Windows: Download from Redis Windows
- macOS:
-
Start Redis:
- macOS/Linux:
redis-server
- Windows: Start the Redis service
- macOS/Linux:
Environment Variables
-
REDIS_URL
: Redis connection URL (default: "redis://localhost:6379") -
RATE_LIMIT_MAX_REQUESTS
: Maximum requests per minute (default: 60) -
RATE_LIMIT_WINDOW
: Time window in seconds (default: 60) -
CACHE_TTL
: Cache time-to-live in seconds (default: 3600)
Usage
- Start the server:
python main.py
- Send a POST request to process an article:
curl -X POST http://localhost:8000/workflow/process \
-H "Content-Type: application/json" \
-d '{
"message_id": "123e4567-e89b-12d3-a456-426614174000",
"conversation_id": "123e4567-e89b-12d3-a456-426614174001",
"sender_agent": "UserAgent",
"recipient_agent": "ArticleFetcherAgent",
"payload_type": "url",
"payload": {
"url": "https://example.com/medical-article"
}
}'
API Response
The API returns a JSON response with:
- Article summary
- Explained medical terminology
- Quality assessment metrics including:
- Study design evaluation
- Sample quality analysis
- Statistical rigor assessment
- Bias evaluation
- Evidence level classification
- Overall quality score
- Key limitations and recommendations
Example response:
{
"success": true,
"message": "Article processed successfully",
"data": {
"message_id": "123e4567-e89b-12d3-a456-426614174002",
"summary": "Comprehensive summary of the article...",
"terminology": {
"Term 1": "Definition in simple language",
"Term 2": "Another explanation..."
},
"quality_assessment": {
"study_design": {
"rating": "4",
"explanation": "Well-designed cohort study"
},
"overall_score": {
"rating": "4.2",
"explanation": "High-quality study with minor limitations"
},
"key_limitations": [
"Limited follow-up period",
"Potential selection bias"
],
"recommendations": [
"Consider longer follow-up study",
"Expand demographic diversity"
]
}
}
}
Error Handling
The API includes comprehensive error handling:
- Input validation errors (400)
- Rate limiting errors (429)
- Network errors (503)
- Server errors (500)
Each error response includes a descriptive message and appropriate HTTP status code.
Rate Limiting
The API implements rate limiting to prevent abuse:
- Default: 60 requests per minute per IP
- Configurable via environment variables
- Uses Redis for distributed rate limiting
- Returns 429 status code when limit exceeded
Caching
Response caching improves performance:
- Default TTL: 1 hour
- Configurable via environment variables
- Uses Redis for distributed caching
- Automatic cache invalidation
- Cache keys based on request parameters
URL Validation
The API validates URLs before processing:
- Ensures HTTPS/HTTP protocol
- Validates against whitelist of medical/academic domains
- Checks for malicious patterns
- Returns detailed validation errors
Testing
Run the test suite:
TESTING=1 PYTHONPATH=. pytest tests/ -v
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Development Notes
Redis Connection Handling
The application uses aclose()
for Redis connection cleanup (supported in redis-py >= 5.0.0). For backward compatibility,
the close()
method is still available but will be removed in future versions.
License
This project is licensed under the MIT License - see the LICENSE file for details.
相关推荐
😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack
Reviews

user_jR2lP8UH
As a dedicated user of the health-article-mcp by lyudmylan, I find it incredibly valuable for staying informed about health topics. The articles are well-researched and presented in a clear, accessible manner. It's a reliable resource for anyone looking to improve their understanding of health and wellness. Highly recommended!

user_hJrkYuEn
I recently started using health-article-mcp by lyudmylan and it has significantly enhanced my knowledge about health topics. The articles are well-written, informative, and easy to understand. The user interface is intuitive, making it simple to navigate through various articles. Overall, it's a fantastic resource for anyone looking to stay informed about health and wellness.

user_4yPsXDwQ
I've been using health-article-mcp by lyudmylan, and it's been a game-changer for my health information needs. The articles are well-researched and provide reliable insights. Highly recommend for anyone serious about their health.

user_OggJqIgE
I've been using health-article-mcp by lyudmylan and it has significantly enhanced my understanding of health topics. The content is well-curated and it delivers valuable information in an easily digestible format. Highly recommended for anyone looking to improve their health knowledge!

user_hD8F0KSb
I've been using the health-article-mcp and I'm thoroughly impressed. Created by lyudmylan, this tool is remarkably informative and user-friendly. It offers invaluable health insights and the welcome information is inviting. Highly recommend for anyone keen on health topics!

user_Rx1VOD8m
I've been using the health-article-mcp application and I'm thoroughly impressed. Created by lyudmylan, it provides well-researched and insightful health articles that are easy to read and understand. The user-friendly interface and comprehensive content have made it my go-to resource for health information. I highly recommend checking it out!

user_uTeAHUsN
I've been using the Health-Article-MCP by lyudmylan, and it's fantastic! It's a superb resource for in-depth and well-researched health articles. The seamless interface and easy navigation make it a pleasure to use. Highly recommended for anyone looking to stay informed about health topics!

user_XQpyIQi2
As a dedicated user of health-article-mcp by lyudmylan, I find it incredibly insightful and resourceful. This product consistently provides well-researched and up-to-date health information. The user-friendly interface makes navigation a breeze, enhancing my reading experience. I highly recommend it to anyone looking to stay informed about health topics.

user_ZUw1jHMg
As an avid user of the health-article-mcp by lyudmylan, I find this product to be incredibly informative and well-written. The articles are comprehensive and provide valuable insights into various health topics. The user interface is seamless, making it easy to navigate and find relevant information. Highly recommend for anyone looking to stay informed about health and wellness!

user_LSbPnWpX
I've been using health-article-mcp by lyudmylan for a while now, and it's simply fantastic! The articles are well-researched and provide valuable health insights. The easy-to-navigate interface and the welcome information make it a pleasure to use. It's a must-have for anyone interested in health topics. Highly recommended!

user_odbs3h3u
I've been using the health-article-mcp application created by lyudmylan and I'm incredibly impressed. The articles are insightful and well-researched, covering a wide range of health topics. The user interface is intuitive and the start URL makes navigation easy. This application has become my go-to source for reliable health information. Highly recommended!