Pingera MCP Server
A Model Context Protocol (MCP) server for the Pingera monitoring service, providing seamless integration between AI models and monitoring data.
Features
- Modular Architecture: Separate Pingera API client library with clean abstractions
- Flexible Operation Modes: Run in read-only or read-write mode
- MCP Resources: Access monitoring data as structured resources (
pingera://pages,pingera://status) - MCP Tools: Execute monitoring operations through tools (list_pages, get_page_details, test_connection)
- Robust Error Handling: Comprehensive error handling with custom exception hierarchy
- Real-time Data: Direct integration with Pingera API v1 for live monitoring data
- Type Safety: Pydantic models for data validation and serialization
- Configurable: Environment-based configuration management
Quick Start
Prerequisites
- Python 3.10+
- UV package manager
- Pingera API key
Installation and Setup
# Install dependencies
uv sync
# Set up your API key (required)
# Add PINGERA_API_KEY to your environment or Replit secrets
# Run the server
python main.py
The server will start in read-only mode by default and connect to the Pingera API.
Configuration
Configure the server using environment variables:
# Required
PINGERA_API_KEY=your_api_key_here
# Optional
PINGERA_MODE=read_only # read_only or read_write
PINGERA_BASE_URL=https://api.pingera.ru/v1
PINGERA_TIMEOUT=30
PINGERA_MAX_RETRIES=3
PINGERA_DEBUG=false
PINGERA_SERVER_NAME=Pingera MCP Server
MCP Resources
The server exposes the following resources:
pingera://pages- List of all monitored status pagespingera://pages/{page_id}- Details for a specific status pagepingera://status- Server and API connection status
MCP Tools
Available tools for AI agents:
list_pages- Get paginated list of monitored pages- Parameters:
page,per_page,status
- Parameters:
get_page_details- Get detailed information about a specific page- Parameters:
page_id
- Parameters:
test_pingera_connection- Test API connectivity- Write operations - Available only in read-write mode (future implementation)
Operation Modes
Read-Only Mode (Default)
- Access monitoring data
- View status pages and their configurations
- Test API connectivity
- No modification capabilities
Read-Write Mode
- All read-only features
- Create, update, and delete monitoring pages (future implementation)
- Manage incidents and notifications (future implementation)
Set PINGERA_MODE=read_write to enable write operations.
Architecture
Pingera API Client Library
Located in pingera/, this modular library provides:
- PingeraClient: Main API client with authentication and error handling
- Models: Pydantic data models for type-safe API responses
- Exceptions: Custom exception hierarchy for error handling
MCP Server Implementation
- FastMCP Framework: Modern MCP server implementation
- Resource Management: Structured access to monitoring data
- Tool Registration: Executable operations for AI agents
- Configuration: Environment-based settings management
Testing
Running the Test Suite
Run all tests:
uv run pytest
Run tests with verbose output:
uv run pytest -v
Run specific test files:
uv run pytest tests/test_models.py
uv run pytest tests/test_config.py
uv run pytest tests/test_mcp_server.py
Run tests with coverage:
uv run pytest --cov=pingera --cov=config --cov=mcp_server
Test Structure
The test suite includes:
- Unit Tests: Testing individual components (models, config, client)
- Integration Tests: Testing MCP server functionality
- Mock Tests: Testing with simulated API responses
Manual Testing
Test the client library directly:
python -c "from pingera import PingeraClient; import os; client = PingeraClient(os.getenv('PINGERA_API_KEY')); print(f'Pages: {len(client.get_pages().pages)}')"
Test MCP server functionality:
python test_mcp_server.py
Error Handling
The system includes comprehensive error handling:
PingeraError: Base exception for all client errorsPingeraAPIError: API response errors with status codesPingeraAuthError: Authentication failuresPingeraConnectionError: Network connectivity issuesPingeraTimeoutError: Request timeout handling
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pingera_mcp_server-0.1.0.tar.gz.
File metadata
- Download URL: pingera_mcp_server-0.1.0.tar.gz
- Upload date:
- Size: 404.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b29dba746eadbee9da8ff1e23b3640f391c1594625c6bafc4576d8065a8f2d7
|
|
| MD5 |
d972d804eec689638b1f93ce306d8998
|
|
| BLAKE2b-256 |
19de06e2a660868d468c5093a41df936ba6ad9d234e0270ab4185703eab3141b
|
File details
Details for the file pingera_mcp_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pingera_mcp_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3eb9251d7b32aea85c03fa79c04753efdee1f38c30433443b12b27ead04e3bde
|
|
| MD5 |
83bd20a3f3a03e8bd3f85a62ad190ca8
|
|
| BLAKE2b-256 |
a9eb935543ceaae21c36f9b763cf4177494fde4fd4e30095e57ea2b1df9eeef8
|