Skip to main content
Glama

Universal MCP 🧩

CI Python License: MIT Protocol: MCP Release

Ecosistema modular de herramientas de IA, datos, automatización y análisis sobre el Model Context Protocol.

Universal MCP es un servidor MCP en Python cuyo núcleo (MCP Core) es plenamente modular: los módulos se descubren e instalan automáticamente, así que puedes añadir herramientas nuevas sin reescribir el servidor. Soporta ambos transportes — stdio (para Claude Desktop / CLI) y streamable-http / sse (para acceso remoto).


✨ Características

  • 🔌 Dos transportes: stdio, streamable-http y sse seleccionables por configuración.

  • 🧩 Núcleo modular con auto-descubrimiento: builtin + plugins externos (MCP_PLUGIN_DIRS) sin tocar el servidor.

  • 🛡️ Seguridad por diseño: sandbox de archivos, SQLite solo-lectura, evaluación matemática por AST-whitelist, bloqueo anti-SSRF, ejecución de shell desactivada por defecto, secretos enmascarados.

  • 📦 31 tools listas para usar en 6 módulos.

  • ⚙️ Configuración 100% por variables de entorno (MCP_* / .env).

  • 🧪 Suite de pruebas completa (pytest + pytest-asyncio).

  • 📚 Documentación de arquitectura y guía de extensión.

Related MCP server: RelayForge MCP

🚀 Instalación

Requiere Python ≥ 3.10.

cd universal-mcp

# Opción A — uv (rápido)
uv venv .venv
uv pip install -e ".[dev]" --python .venv/bin/python

# Opción B — pip clásico
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"

🖥️ Uso

Transporte stdio (Claude Desktop, CLI, IDEs)

.venv/bin/python -m universal_mcp
# o, tras instalar:
universal-mcp

Configuración de ejemplo para Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "universal": {
      "command": "/ruta/a/universal-mcp/.venv/bin/python",
      "args": ["-m", "universal_mcp"],
      "env": {
        "MCP_LOG_LEVEL": "INFO",
        "MCP_WORKSPACE_DIR": "/ruta/a/universal-mcp/workspace"
      }
    }
  }
}

Transporte streamable-http (remoto / múltiples clientes)

MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 universal-mcp
# Endpoint: http://127.0.0.1:8000/mcp

Transporte SSE (legado)

MCP_TRANSPORT=sse universal-mcp

🧰 Módulos incluidos (31 tools)

Módulo

Tools

Descripción

system

system_info, system_now, system_disk_usage, system_env_vars, system_run_command

Info del host, hora por zona horaria, disco, variables de entorno (secretos enmascarados), shell opt-in.

files

files_list_files, files_read_file, files_write_file, files_delete_file, files_search_files

Archivos dentro del sandbox del workspace: listar, leer, escribir, borrar y búsqueda tipo grep (literal o regex).

data

data_read_csv, data_read_json, data_flatten_json, data_sqlite_query, data_to_json

CSV/JSON del sandbox, aplanado de JSON y SQLite solo-lectura.

analysis

analysis_stats, analysis_math_eval, analysis_linear_regression, analysis_correlation, analysis_frequency

Estadística descriptiva, calculadora segura (AST), regresión lineal, correlación de Pearson y frecuencias.

ai

ai_text_stats, ai_summarize, ai_sentiment, ai_keywords, ai_extract, ai_slugify

NLP local (sin APIs): métricas de texto, resumen extractivo, sentimiento ES/EN, keywords, extracción de entidades y slugs.

automation

automation_http_request, automation_send_webhook, automation_uuid4, automation_timestamp, automation_wait

HTTP con protección anti-SSRF, webhooks y utilidades.

⚙️ Configuración (variables de entorno)

Variable

Por defecto

Descripción

MCP_SERVER_NAME

universal-mcp

Nombre visible por el cliente.

MCP_TRANSPORT

stdio

stdio | streamable-http | sse.

MCP_HOST / MCP_PORT

127.0.0.1 / 8000

Bind de los transportes HTTP.

MCP_LOG_LEVEL

INFO

Nivel de log (siempre a stderr).

MCP_DISABLED_MODULES

(vacío)

Módulos a omitir, p. ej. system,ai.

MCP_PLUGIN_DIRS

(vacío)

Directorios de plugins externos (desactivados salvo configuración explícita).

MCP_ALLOWED_TOOLS

(vacío = todas)

Allowlist de tools (globs), p. ej. data_*,system_*.

MCP_BLOCKED_TOOLS

(vacío)

Denylist de tools (globs); siempre gana sobre el allowlist.

MCP_WORKSPACE_DIR

./workspace

Sandbox para files_* y data_*.

MCP_ENABLE_SHELL

false

Habilita system_run_command. ⚠️

MCP_HTTP_BLOCK_PRIVATE

true

Bloquea IPs privadas/loopback (anti-SSRF).

MCP_HTTP_TIMEOUT

15

Timeout HTTP en segundos.

MCP_MAX_OUTPUT_CHARS

20000

Truncado de cuerpos HTTP.

Consulta .env.example para una plantilla completa.

➕ Añadir un módulo nuevo (sin reescribir el servidor)

Opción 1 — módulo builtin: crea src/universal_mcp/modules/<nombre>/module.py:

from universal_mcp.core.base import BaseModule
from universal_mcp.core.context import ModuleContext
from universal_mcp.core.utils import to_json


class WeatherModule(BaseModule):
    name = "weather"  # prefijo de las tools: weather_*

    def register(self, ctx: ModuleContext) -> None:
        @ctx.tool(name="current", description="Weather for a city (demo).")
        def current(city: str) -> str:
            return to_json({"city": city, "temp_c": 21})

Reinicia el servidor: el registry lo detecta y registra automáticamente como weather_current.

Opción 2 — plugin externo (cero cambios de código): guarda el mismo archivo en cualquier carpeta y arranca con:

MCP_PLUGIN_DIRS=/ruta/a/mis/plugins universal-mcp

Guía completa: docs/ADDING_MODULES.md · Ejemplo ejecutable: examples/plugins/hello_plugin.py.

🔒 Modelo de seguridad

  • Sandbox de archivos: resolve_in_workspace() valida cada ruta (incluye symlinks) contra MCP_WORKSPACE_DIR.

  • SQLite de solo lectura: PRAGMA query_only + whitelist SELECT/WITH/PRAGMA/EXPLAIN.

  • Math por AST-whitelist: sin eval; operaciones y funciones permitidas explícitamente.

  • Anti-SSRF por hop: resolución DNS + bloqueo de IPs privadas/loopback/reservadas en automation_*. Las redirecciones no se siguen ciegamente: cada hop (Location absoluta o relativa) se re-valida, evitando el bypass clásico 302 → 169.254.169.254.

  • Permisos por herramienta: MCP_BLOCKED_TOOLS / MCP_ALLOWED_TOOLS (globs sobre el nombre final). Una tool bloqueada no se registra (se reporta en RegistrationReport.blocked_tools) y las registradas llevan guard en runtime (SecurityViolationError).

  • Sin registro parcial: si un módulo falla a mitad de registro, sus tools/resources a medias se revierten (rollback) y los nombres quedan libres; el resto de módulos no se ve afectado.

  • Ciclo de vida: setup() al cargar y teardown() al apagar (en orden inverso, tolerante a fallos), conectado a SIGINT/SIGTERM/atexit.

  • Shell opt-in: system_run_command responde con error salvo MCP_ENABLE_SHELL=true.

  • Secretos enmascarados: system_env_vars oculta valores de claves sensibles.

  • Plugins externos desactivados por defecto: solo se cargan con MCP_PLUGIN_DIRS explícito; se ejecutan in-process (sin sandbox) — úsalos solo con código de confianza.

  • Logging a stderr: stdout queda reservado al protocolo (crítico en stdio).

🧪 Pruebas

.venv/bin/pytest -v          # suite completa (~75 tests)
.venv/bin/ruff check .       # lint (opcional)

Cobertura: núcleo (config, registry, contexto, sandbox), integración del servidor (tools/list real vía FastMCP), y cada módulo (lógica pura + ejecución vía protocolo).

🗺️ Roadmap

  • Hot-reload de módulos (registry.reload()).

  • Resources y prompts builtin por módulo.

  • Aislamiento por subprocess para plugins no confiables.

  • Métricas (Prometheus) y traza de ejecución por tool.

  • Autenticación para transporte HTTP (bearer/OAuth).

  • Pinning de IP por conexión (mitigación completa de DNS rebinding).

📖 Documentación

📄 Licencia

MIT — consulta LICENSE.

Available Tools

31 tools
ai_extractA

Extract entities by regex: kind ∈ {emails, urls, phones, numbers}.

Inputs: text (required), kind. Returns: result

ai_keywordsB

Top keywords by frequency (stopwords ES/EN removed).

Inputs: text (required), top. Returns: result

ai_sentimentA

Lexicon-based sentiment for Spanish/English text. Returns score in [-1,1] and label.

Inputs: text (required). Returns: result

ai_slugifyA

Convert text to a URL-friendly slug (ASCII, hyphen-separated).

Inputs: text (required). Returns: result

ai_summarizeA

Extractive summary: picks the most relevant sentences (word-frequency scoring, ES/EN stopwords) keeping original order. Max 10 sentences.

Inputs: text (required), max_sentences. Returns: result

ai_text_statsB

Text metrics: chars, words, unique words, sentences, paragraphs, reading time.

Inputs: text (required). Returns: result

analysis_correlationC

Pearson correlation coefficient (r, r², direction, strength).

Inputs: x (required), y (required). Returns: result

analysis_frequencyB

Count occurrences of each item and return the most common ones.

Inputs: items (required), top. Returns: result

analysis_linear_regressionB

Fit y = slope·x + intercept by least squares. Returns slope, intercept, r, r_squared and the equation string.

Inputs: x (required), y (required). Returns: result

analysis_math_evalA

Safely evaluate an arithmetic expression: + - * / // % **, parentheses, sqrt/sin/cos/tan/log/exp/abs/floor/ceil/round/min/max and pi/e/tau. No code execution.

Inputs: expression (required). Returns: result

analysis_statsB

Descriptive statistics for a list of numbers: n, sum, mean, median, min/max, stdev, variance and percentiles (p25/p50/p75/p90).

Inputs: numbers (required). Returns: result

automation_http_requestA

Perform an HTTP request (GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS). Private/internal hosts are blocked by default (anti-SSRF), including redirect targets: every hop is re-validated. Body is truncated.

Inputs: url (required), body, method, headers, +2 more. Returns: result

automation_send_webhookA

POST a JSON payload to a webhook URL (adds X-Webhook-Secret header if provided). Redirect targets are re-validated (anti-SSRF).

Inputs: url (required), payload (required), secret. Returns: result

automation_timestampA

Current time: unix epoch and ISO-8601 UTC.

Inputs: no named parameters. Returns: result

automation_uuid4A

Generate a random UUID v4 string.

Inputs: no named parameters. Returns: result

automation_waitA

Sleep for N seconds (0.01–60). Useful for polling and retries.

Inputs: seconds. Returns: result

data_flatten_jsonC

Flatten nested JSON objects/arrays into a single-level dict with dotted keys. Pass data as a JSON value.

Inputs: data (required), separator. Returns: result

data_read_csvB

Read a CSV file from the sandbox. Returns columns, sample rows and totals.

Inputs: path (required), limit, delimiter. Returns: result

data_read_jsonB

Read and parse a JSON file from the sandbox (max 10 MB).

Inputs: path (required). Returns: result

data_sqlite_queryB

Run a READ-ONLY SQL query (SELECT/WITH) against a SQLite file in the sandbox. Writes and DDL are blocked.

Inputs: sql (required), path (required), limit. Returns: result

data_to_jsonB

Serialize any JSON-serializable data into a pretty JSON string.

Inputs: data (required), indent. Returns: result

files_delete_fileB

Delete a file (never a directory) from the sandbox.

Inputs: path (required). Returns: result

files_list_filesB

List files/folders in the sandboxed workspace (relative paths only).

Inputs: path. Returns: result

files_read_fileB

Read a UTF-8 text file from the sandbox (max_bytes caps the output).

Inputs: path (required), max_bytes. Returns: result

files_search_filesC

Grep-like text search across sandbox files. Supports literal or regex queries. Returns matching file paths with line numbers.

Inputs: query (required), path, regex, max_results, +1 more. Returns: result

files_write_fileB

Write/append UTF-8 text to a file in the sandbox. Creates parent folders.

Inputs: path (required), content (required), append. Returns: result

system_disk_usageC

Disk usage statistics (total/used/free bytes and percent) for a path.

Inputs: path. Returns: result

system_env_varsA

List environment variables (optionally by prefix). Secret-looking values are masked.

Inputs: prefix. Returns: result

system_infoA

Get host system information: OS, python, CPUs, hostname, cwd.

Inputs: no named parameters. Returns: result

system_nowA

Current date/time in a given IANA timezone (e.g. 'America/Bogota', 'UTC').

Inputs: tz. Returns: result

system_run_commandB

Execute a shell command on the host. DISABLED unless the server was started with MCP_ENABLE_SHELL=true. Use with extreme caution.

Inputs: command (required), timeout. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 31 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, but a few overlaps exist: automation_timestamp and system_now both return current time; ai_keywords and analysis_frequency both surface frequent terms; automation_http_request and automation_send_webhook overlap for POST/webhook use. These are distinguishable from descriptions, but an agent could still misselect in edge cases.

    Naming Consistency4/5

    The set uses a consistent snake_case, category-prefixed convention across all tools. Minor inconsistency exists in that some names use a verb after the prefix (files_read_file, data_flatten_json) while others use a noun (analysis_correlation, system_info, ai_sentiment), but the pattern remains readable and predictable.

    Tool Count2/5

    At 31 tools, the surface is heavy for a single server and exceeds the typical 3–15 well-scoped range. The broad 'Universal MCP' purpose explains the breadth, but the count still increases selection burden and cognitive load for an agent.

    Completeness4/5

    The server covers a wide range of utility domains: files, data, system, analysis, automation, and AI text processing. There are minor gaps such as no file copy/move operation and no CSV/JSON write path, but most workflows can be composed from existing tools.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to securely discover, execute, and observe tools with role-based access control and audit logging. Serves tools over MCP stdio and HTTP for integration with Claude Desktop, Cursor, and other clients.
      1
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Gives MCP-compatible AI clients a controlled bridge to local files, processes, search, and document utilities, including reading/writing and moving files, text block editing, directory listing, content search, starting and managing terminal processes, and PDF/Excel/DOCX/image handling. It serves these tools over MCP Streamable HTTP at a configurable endpoint, with optional Bearer-token authentication and read-only or restricted-directory modes for safer remote exposure.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to search, update, and manage files, run and control terminal commands and processes, execute code in memory, and work with Excel, PDF, and DOCX documents on local desktops.
      721,771 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables LLM clients to perform sandboxed file operations, manage persistent notes, fetch live weather and Wikipedia summaries, calculate arithmetic safely, and retrieve current UTC time via a standalone tool server over stdio or HTTP.
      MIT