mcp-hooks
by civicteam
Overview
A lightweight tRPC server that logs all tool call requests from an AI assistant through a flexible audit logging system, acting as middleware for the Model Context Protocol (MCP).
Installation
cd packages/audit-hook && pnpm startEnvironment Variables
- PORT
- LOG_FILE
- POSTGRES_URL
- ENABLE_CONSOLE_LOGGER
- API_KEY
- API_KEY_HEADER
- RATE_LIMIT_PER_MINUTE
- RATE_LIMIT_PER_HOUR
- TARGET_SERVER_URL
- HOOKS
Security Notes
The primary security concern lies in the `passthrough-mcp-server` (which this hook would integrate with). It constructs `StreamableHTTPClientTransport` client connections using `TARGET_SERVER_URL` and `HOOKS` environment variables directly, without validation or allow-listing. This creates a significant Server-Side Request Forgery (SSRF) vulnerability, potentially allowing an attacker to force the server to make requests to internal network resources. Additionally, the `api-key-hook` uses a default test API key ('test-api-key-12345') which is hardcoded and must be overridden in production to prevent unauthorized access. The `setup-db.ts` script for PostgreSQL logging uses default `postgres/postgres` credentials, which is highly insecure for production environments. Sensitive audit logs (if file-based) must be properly secured to prevent data leakage.
Similar Servers
mcp-context-forge
Converts web content (HTML, PDF, DOCX, etc.) and local files from a URL into high-quality Markdown format. It supports multiple conversion engines, content optimization, batch processing, and image handling.
tmcp
A server implementation for the Model Context Protocol (MCP) to enable LLMs to access external context and tools.
MCP-PostgreSQL-Ops
The MCP server provides professional operations, monitoring, and management capabilities for PostgreSQL databases using natural language queries.
enhanced-postgres-mcp-server
This server acts as a Model Context Protocol interface for PostgreSQL, enabling LLMs to query data, modify records, and manage database schema objects with read and write capabilities.