FastAPI MCP Server

FastAPI MCP Server

Enables interaction with Supabase databases and n8n workflows through a JSON-RPC 2.0 MCP server. Provides database operations, vector search capabilities, and webhook-based workflow automation with secure API token authentication.

Category
Visit Server

README

MCP Server (FastAPI + Supabase + n8n)

Estructura

  • main.py: App FastAPI y healthcheck /healthz.
  • app/mcp/server.py: Endpoint /mcp JSON-RPC 2.0 (tools/list, tools/call).
  • app/integrations/supabase.py: Operaciones DB/Storage/Vector.
  • app/integrations/n8n.py: Invocación de webhooks n8n.
  • app/security/auth.py: API tokens por cabecera x-api-key.
  • app/config.py: Carga de variables de entorno.
  • migrations/001_init.sql: Esquema Supabase (session_state, tool_audit, vector_store, RPC match_vectors).
  • tools.schema.json: Definiciones de herramientas MCP.

Variables de entorno

Copiar .env.example a .env en local o configurar en Railway.

  • SUPABASE_URL: URL del proyecto Supabase.
  • SUPABASE_SERVICE_ROLE_KEY: clave service role (solo backend).
  • SUPABASE_ANON_KEY: opcional.
  • N8N_WEBHOOK_BASE: base de webhooks públicos de n8n, ej: https://n8n.tu-dominio.com/webhook.
  • MCP_API_TOKENS: CSV de tokens válidos, ej: token1,token2.
  • ALLOW_ORIGINS: lista CORS, ej: https://mi-host-agente.com.

Desarrollo local (Windows PowerShell)

python -m venv .venv
. .venv/Scripts/Activate.ps1
pip install -r requirements.txt
$env:MCP_API_TOKENS="dev-token"
$env:SUPABASE_URL="https://xxxxx.supabase.co"
$env:SUPABASE_SERVICE_ROLE_KEY="eyJ..."
$env:N8N_WEBHOOK_BASE="https://n8n.tu-dominio.com/webhook"
uvicorn main:app --host 0.0.0.0 --port 8000 --reload

Probar:

  • GET http://localhost:8000/healthz
  • POST http://localhost:8000/mcp con header x-api-key: dev-token y body:
{"jsonrpc":"2.0","id":"1","method":"tools/list"}

Despliegue en Railway

  • Añadir servicio Dockerfile.
  • Variables de entorno: SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, N8N_WEBHOOK_BASE, MCP_API_TOKENS, ALLOW_ORIGINS.
  • Comando inicio: uvicorn main:app --host 0.0.0.0 --port $PORT --proxy-headers.
  • Healthcheck: /healthz.
  • Escalado horizontal: habilitar auto-scale; la app es stateless.

Migraciones Supabase

Ejecutar migrations/001_init.sql en el SQL Editor de Supabase.

Seguridad

  • Mantener Service Role solo en backend.
  • Rotar MCP_API_TOKENS periódicamente.
  • Opcional: firmar requests con HMAC y timestamp para antireplay.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured