Back to Home
civicteam icon

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

Run Command
cd packages/audit-hook && pnpm start

Environment 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

Stats

Interest Score34
Security Score4
Cost ClassLow
Stars4
Forks1
Last Update2026-01-19

Tags

AuditLoggingMiddlewaretRPCTypeScriptPostgreSQLMCPHooks