README.mdβ’14.2 kB
# <img src="assets/favicon.png" alt="Service Health MCP Server" width="32" height="32"> Service Health MCP Server
> **π The first universal service health monitoring tool for Claude Desktop and MCP-compatible AI assistants**
[](https://www.typescriptlang.org/)
[](https://github.com/modelcontextprotocol)
[](https://opensource.org/licenses/MIT)
[](#-security)
[](#-transparency--learning)
**A professional-grade MCP server that enables AI assistants to monitor web services, APIs, and HTTP endpoints with enterprise-level security.** Perfect for DevOps, monitoring, and ensuring your services are running smoothly.
---
## π **Transparency & Learning**
**π€ Built with AI Assistance:** This project was created by [Natasha](https://github.com/natashanajdovski) in collaboration with Claude Sonnet 4 as a learning exercise. No prior MCP server development experience was required!
**π Learning Goals Achieved:**
- β
**MCP Protocol Implementation** - From zero to working server
- β
**TypeScript Best Practices** - Professional code structure
- β
**Security-First Development** - Enterprise-grade SSRF protection
- β
**Open Source Standards** - Community-ready documentation
- β
**Real-World Problem Solving** - Filling a genuine gap in the MCP ecosystem
**π‘ For Fellow Learners:** If you're new to MCP development or curious about AI-assisted programming, this project demonstrates what's possible when learning with AI guidance. See our [development process](#-development) and [contributing guidelines](CONTRIBUTING.md) for insights!
---
## β¨ **Why This Exists**
**The Goal:** While learning MCP development, I wanted to build something that would be genuinely useful for monitoring services through AI conversations. This MCP server provides a convenient way for Claude (and other AI assistants) to check service health naturally through chat.
**What Makes It Useful:**
- π **Conversational monitoring** - Check services through natural language
- π‘οΈ **Security-first design** with comprehensive SSRF protection
- β‘ **Fast and reliable** with detailed diagnostics
- π― **Easy to use** - works out of the box with Claude Desktop
- π **Professional output** with actionable information
---
## π **Quick Start**
### **Step 1: Install**
```bash
git clone https://github.com/natashanajdovski/service-health-mcp.git
cd service-health-mcp
npm install
npm run build
```
### **Step 2: Configure Claude Desktop**
**Find your config file:**
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
**Add this configuration:**
```json
{
"mcpServers": {
"service-health": {
"command": "node",
"args": ["C:\\path\\to\\service-health-mcp\\dist\\server.js"],
"cwd": "C:\\path\\to\\service-health-mcp"
}
}
}
```
### **Step 3: Restart & Test**
1. **Completely close and reopen Claude Desktop**
2. **Test with:** `"Check if google.com is healthy"`
3. **See professional health reports instantly! π**
---
## π― **Usage Examples**
### **Basic Health Monitoring**
```
π "Check if google.com is healthy"
π "Is api.github.com responding properly?"
π "Test if my-website.com is up"
```
### **Advanced Configurations**
```
π "Check if api.example.com/health is healthy with a 15 second timeout"
π "Test httpbin.org/post using POST method"
π "Check if my-api.com returns 201 status code"
```
### **DevOps & Monitoring**
```
π "Check if our production API is responding normally"
π "Test all our microservices for health"
π "Monitor our CDN endpoints"
```
---
## π **Sample Output**
```
β
**Health Check Result**
**URL:** https://api.github.com
**Status:** HEALTHY
**Response Time:** 127ms
**HTTP Status:** 200 (OK)
**Message:** Endpoint is healthy (200) - 127ms response time
**Checked At:** 2024-07-24T21:30:00.000Z
**Interpretation:**
π The endpoint is working perfectly! No issues detected.
```
**For unhealthy services:**
```
β **Health Check Result**
**URL:** https://down-service.com
**Status:** UNHEALTHY
**Response Time:** 5000ms
**Message:** Network error: Connection timeout
**Checked At:** 2024-07-24T21:30:00.000Z
**Interpretation:**
π¨ The endpoint has issues and may be down or misconfigured. Investigation needed.
```
---
## π οΈ **Features**
<table>
<tr>
<td width="50%">
### **π Health Monitoring**
- β
HTTP/HTTPS endpoint testing
- β
Response time measurement
- β
Status code validation
- β
Custom headers support
- β
Multiple HTTP methods
- β
Configurable timeouts (1-30s)
</td>
<td width="50%">
### **π‘οΈ Enterprise Security**
- β
SSRF attack prevention
- β
Internal network blocking
- β
Input validation & sanitization
- β
Protocol restrictions (HTTP/HTTPS only)
- β
Port filtering & safe defaults
- β
Zero credential exposure
</td>
</tr>
<tr>
<td width="50%">
### **β‘ Performance**
- β
Sub-second response times
- β
Efficient connection handling
- β
Minimal resource usage
- β
Non-blocking async operations
- β
Optimized error handling
- β
Smart retry logic
</td>
<td width="50%">
### **π§ Developer Experience**
- β
Full TypeScript support
- β
Professional error messages
- β
Comprehensive logging
- β
Easy MCP integration
- β
Hot reload development
- β
Extensive documentation
</td>
</tr>
</table>
---
## π‘οΈ **Security**
**This MCP server implements enterprise-grade security to prevent attacks:**
### **π¨ SSRF (Server-Side Request Forgery) Protection**
```
β BLOCKED: localhost, 127.0.0.1
β BLOCKED: 192.168.x.x, 10.x.x.x, 172.16-31.x.x
β BLOCKED: 169.254.169.254 (cloud metadata)
β BLOCKED: Non-HTTP protocols (ftp, file, etc.)
β
ALLOWED: Public HTTP/HTTPS endpoints only
```
### **π Input Validation**
- **URL Format:** RFC-compliant validation
- **Parameter Types:** Strict type checking with Zod
- **Timeout Bounds:** 1-30 second limits
- **Method Restrictions:** GET, POST, PUT, DELETE only
- **Port Filtering:** Standard web ports (80, 443, 8080, 8443)
### **π‘οΈ Safe Defaults**
- **10-second timeout** (prevents hanging)
- **GET method** (least intrusive)
- **No credential storage** (stateless operation)
- **Minimal error details** (no information leakage)
---
## π§ **Development**
### **Prerequisites**
- **Node.js 18+**
- **TypeScript 5+**
- **npm or yarn**
### **Development Commands**
```bash
npm run dev # π Hot reload development
npm run build # ποΈ Production build
npm run start # π Run built version
npm run clean # π§Ή Clean build files
```
### **Testing with MCP Inspector**
```bash
npx @modelcontextprotocol/inspector src/server.ts
```
### **Project Structure**
```
service-health-mcp/
βββ src/
β βββ server.ts # π― Main MCP server
β βββ health/
β β βββ http-checker.ts # π Core health logic
β βββ security/
β β βββ url-validator.ts # π‘οΈ SSRF protection
β βββ tools/
β βββ check-http.ts # π οΈ MCP tool interface
βββ dist/ # π¦ Compiled JavaScript
βββ docs/ # π Documentation
βββ package.json # π Project config
```
---
## π **API Reference**
### **`check_http_endpoint`**
**Description:** Check if an HTTP/HTTPS endpoint is healthy and responsive.
#### **Parameters**
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `url` | `string` | β
Yes | - | The URL to check (e.g., https://google.com) |
| `method` | `"GET" \| "POST" \| "PUT" \| "DELETE"` | β No | `"GET"` | HTTP method to use |
| `timeout` | `number` | β No | `10000` | Request timeout in milliseconds (1000-30000) |
| `expectedStatus` | `number` | β No | `200` | Expected HTTP status code (100-599) |
| `headers` | `Record<string, string>` | β No | `{}` | Optional HTTP headers |
#### **Example Request**
```json
{
"url": "https://api.example.com/health",
"method": "GET",
"timeout": 15000,
"expectedStatus": 200,
"headers": {
"User-Agent": "Health-Checker/1.0",
"Accept": "application/json"
}
}
```
#### **Response Format**
```typescript
{
status: "healthy" | "unhealthy" | "warning";
responseTime: number; // milliseconds
statusCode?: number; // HTTP status code
message: string; // Human-readable description
details: {
url: string;
timestamp: string; // ISO 8601 format
error?: string; // Error details if applicable
}
}
```
---
## π **Troubleshooting**
### **β Tool Not Appearing in Claude Desktop**
**Problem:** Claude doesn't recognize the health check tool.
**Solutions:**
1. **Verify config syntax:** Use a JSON validator
2. **Check file paths:** Use absolute paths in config
3. **Restart completely:** Close Claude Desktop entirely, then reopen
4. **Test build:** Run `npm run build` and check for errors
5. **Check permissions:** Ensure Node.js can read the files
### **π Network Connection Issues**
**Problem:** Getting network errors or timeouts.
```
β Network error: Client network socket disconnected
```
**Solutions:**
- **Service may be down:** Try checking in browser first
- **HTTPS issues:** Try HTTP version of the URL
- **Firewall:** Check if your network blocks the service
- **DNS:** Verify the domain resolves correctly
### **π Security Restriction Messages**
**Problem:** URLs being blocked for security reasons.
```
β Access to internal networks and localhost is not allowed
```
**This is intentional!** The security system is working correctly:
- **For local testing:** Use browser or `curl` directly
- **For monitoring:** Use external, publicly accessible URLs only
- **For internal services:** Deploy monitoring within your network
### **β‘ Performance Issues**
**Problem:** Slow response times or timeouts.
**Solutions:**
- **Increase timeout:** Use 15-30 second timeouts for slow services
- **Check network:** Test connectivity to the target service
- **Reduce load:** Avoid checking too many endpoints simultaneously
---
## π€ **Contributing**
**We welcome contributors of all skill levels!** This project was built by a learner with AI assistance, and we're excited to grow the community.
### **π Ways to Contribute**
- **π Bug Reports:** Found an issue? Please report it!
- **β¨ Feature Requests:** Ideas for new capabilities?
- **π Documentation:** Help improve our guides
- **π§ Code:** Submit pull requests for enhancements
- **π Learning:** Share your experience using this project
### **π Getting Started**
1. **Fork** the repository
2. **Clone** your fork: `git clone https://github.com/yourusername/service-health-mcp.git`
3. **Create branch:** `git checkout -b feature/amazing-feature`
4. **Make changes** and test thoroughly
5. **Commit:** `git commit -m "Add amazing feature"`
6. **Push:** `git push origin feature/amazing-feature`
7. **Open Pull Request** with detailed description
### **π Contribution Guidelines**
- **Code Style:** Follow existing TypeScript patterns
- **Security:** Maintain SSRF protection standards
- **Tests:** Add tests for new features
- **Documentation:** Update docs for any changes
- **Commit Messages:** Use clear, descriptive commits
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
---
## πΊοΈ **Roadmap**
### **π― Phase 1: Core Stability** *(Current)*
- β
HTTP/HTTPS health checking
- β
Enterprise security (SSRF protection)
- β
Claude Desktop integration
- β
Professional documentation
### **π― Phase 2: Database Support** *(Next)*
- π PostgreSQL health checking
- π MySQL/MariaDB support
- π Redis connectivity testing
- π MongoDB health monitoring
### **π― Phase 3: Advanced Features**
- π Multi-service dashboards
- π Health history tracking
- π Webhook notifications
- β° Scheduled monitoring
### **π― Phase 4: Enterprise**
- βοΈ Cloud integration (AWS, Azure, GCP)
- π³ Docker containerization
- π Authentication support
- π Prometheus metrics export
**π‘ Community Input Welcome!** Open an issue to suggest features or vote on priorities.
---
## π **License**
**MIT License** - see [LICENSE](LICENSE) file for details.
**TL;DR:** You can use, modify, and distribute this project freely. Just include the license notice.
---
## π **Acknowledgments**
- **π€ Anthropic** for Claude AI assistance and the MCP protocol
- **ποΈ MCP Community** for pioneering this ecosystem
- **π Open Source Contributors** who make projects like this possible
- **π Learning Community** for encouraging AI-assisted development
---
## π **Support & Community**
### **π Documentation**
- **[Quick Start Guide](#-quick-start)** - Complete installation instructions
- **[Development Setup](#-development)** - For developers new to MCP
- **[API Reference](#-api-reference)** - Complete technical documentation
- **[Security Details](#-security)** - Security considerations and best practices
### **π¬ Get Help**
- **π [Issues](https://github.com/natashanajdovski/service-health-mcp/issues)** - Bug reports and feature requests
- **π [Discussions](https://github.com/natashanajdovski/service-health-mcp/discussions)** - Community Q&A and ideas
### **π Connect**
- **π©βπ» [GitHub Profile](https://github.com/natashanajdovski)** - Follow for updates
---
<div align="center">
**π Built with β€οΈ, TypeScript, and Claude AI | Making service monitoring accessible to everyone**
β **Star this repo if it helped you!** β
</div>