MCP Operations Infrastructure
Provides PostgreSQL-backed audit logging for tool executions, enabling queryable audit history with filtering by user, tool, and time.
Provides access to an operations SQLite database, enabling schema inspection and validated SELECT queries against customers, products, orders, and metrics data.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Operations Infrastructure
A production-ready Model Context Protocol (MCP) server demonstrating secure, schema-driven LLM interactions with external APIs and databases.
Features
Security & Authentication
Token-based authentication with API keys
Role-based access control (Admin, Analyst, Readonly)
Constrained tool usage - each role has specific permissions
Schema-Driven Interactions
Pydantic validation for all inputs and outputs
SQL injection prevention via query validation
Structured error handling with consistent error codes
Audit Trail
PostgreSQL-backed audit logging for all tool executions
Queryable audit history with filtering by user, tool, time
Sensitive data redaction in logs
Available Tools
Tool | Description | Roles |
| Execute SELECT queries on operations database | All |
| Get schema information | All |
| Search the web via Tavily API | Admin, Analyst |
| Get weather forecasts | All |
| Look up coordinates for cities | All |
| Query audit history | Admin, Analyst |
Related MCP server: mcp-tool-bridge
Quick Start
Prerequisites
Docker & Docker Compose
Python 3.11+ (for local development)
Tavily API key (optional, for web search)
1. Clone and Configure
git clone https://github.com/sanidhya-karnik/mcp-ops-infrastructure
cd mcp-ops-infrastructure
# Copy environment template
cp .env.example .env
# Edit .env with your configuration
# At minimum, add your TAVILY_API_KEY for web search2. Generate API Keys
# Generate secure API keys
python -c "import secrets; print('Admin key:', secrets.token_urlsafe(32))"
python -c "import secrets; print('Analyst key:', secrets.token_urlsafe(32))"
# Add to .env:
# API_KEYS=<admin-key>:admin,<analyst-key>:analyst3. Run with Docker
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f mcp-server
# Stop services
docker-compose down4. Local Development
# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install dependencies
pip install -r requirements.txt
# Start PostgreSQL (for audit logging)
docker-compose up -d postgres
# Run server
python -m src.server5. Verify Installation
python tests/test_local.pyThis tests database initialization, SQL queries, geocoding, and weather API integration.
Architecture

Sample Database Schema
The operations database includes sample data for demonstration:
customers
id, name, email, company, industry, created_at, lifetime_value, is_activeproducts
id, name, category, price, stock_quantity, is_availableorders
id, customer_id, order_date, total_amount, status, shipping_city, shipping_countrymetrics
id, date, metric_name, value, dimensionUsage Examples
Query Database
# Via MCP client
await client.call_tool("sql_query", {
"query": "SELECT company, SUM(lifetime_value) as total FROM customers GROUP BY company ORDER BY total DESC LIMIT 5"
})Web Search
await client.call_tool("web_search", {
"query": "latest AI developments",
"max_results": 5
})Weather Lookup
# First geocode the location
location = await client.call_tool("geocode_location", {"location": "Boston"})
# Then get weather
weather = await client.call_tool("weather", {
"latitude": location["results"][0]["latitude"],
"longitude": location["results"][0]["longitude"],
"days": 3
})Configuration Reference
Variable | Description | Default |
| Enable authentication |
|
| Comma-separated key:role pairs | - |
| Tavily search API key | - |
| PostgreSQL connection settings | See .env.example |
| Enable audit logging |
|
Testing
# Run tests
pytest tests/ -v
# With coverage
pytest tests/ --cov=src --cov-report=htmlClaude Desktop Integration
macOS
Config location: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"ops-server": {
"command": "docker",
"args": ["compose", "-f", "/path/to/mcp-ops-infrastructure/docker-compose.yml", "run", "--rm", "mcp-server"],
"env": {
"TAVILY_API_KEY": "your-key"
}
}
}
}Windows
Config location: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"ops-server": {
"command": "docker",
"args": ["compose", "-f", "C:\\path\\to\\mcp-ops-infrastructure\\docker-compose.yml", "run", "--rm", "mcp-server"],
"env": {
"TAVILY_API_KEY": "your-key"
}
}
}
}Note: On Windows, use double backslashes (
\\) in file paths within JSON, or forward slashes (/) which Docker also accepts.
Project Structure
mcp-ops-infrastructure/
├── docker-compose.yml # Multi-container setup
├── Dockerfile # Server container
├── requirements.txt # Python dependencies
├── .env.example # Configuration template
├── src/
│ ├── server.py # Main MCP server
│ ├── config.py # Settings management
│ ├── auth/
│ │ └── authenticator.py # Auth & RBAC
│ ├── audit/
│ │ └── logger.py # Audit trail
│ ├── database/
│ │ └── connection.py # SQLite operations DB
│ ├── schemas/
│ │ └── models.py # Pydantic schemas
│ └── tools/
│ ├── sql_tool.py # SQL query tool
│ ├── search_tool.py # Tavily search
│ └── weather_tool.py # Weather + geocoding
└── tests/
└── test_tools.pyTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Runtime permission, approval, and audit layer for AI agent tool execution.
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables secure, AI-driven PostgreSQL database administration, observability, and querying with support for extensions like PostGIS and pgvector, connection pooling, and advanced tool filtering.121 npm12MIT
- AlicenseNot gradedqualityBmaintenanceEnables declaring a catalog of tools for LLMs, filtering them by role, validating arguments, guarding sensitive calls with server-side confirmations, and recording an audit log.7 npmMIT
- AlicenseAqualityCmaintenanceEnables AI agents to investigate a legacy ERP's PostgreSQL database through read-only queries, apply writes and multi-statement atomic transactions behind static and in-transaction guardrails, and snapshot tables before destructive changes. Row limits, sequence-integrity checks, and optional JSON audit logging keep every call bounded, reversible, and traceable.4MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to query Postgres, BigQuery and DuckDB read-only through policy-checked SQL, with AST-based guards that refuse writes and dangerous functions, column masking on the way out, and an audit log of every query. Also exposes schema browsing and query-planning tools so agents can see allowed tables, columns and costs before running anything.MIT