Skip to main content
Glama

Model Context Protocol (MCP)

herramientas en un bucle agéntico para trabajo operativo: recuperar políticas desde una base de conocimiento local (RAG), buscar pagos simulados y abrir tickets — la misma forma que los copilotos de producción que se sitúan frente a APIs de core bancario / operaciones, sin ningún código propietario.

Este repositorio es software de demostración original de Md Tanvir Alam. Usa únicamente conceptos genéricos de pagos, KYC y mensajería interbancaria.

Related MCP server: cortex

Arquitectura

flowchart LR
  subgraph Client
    Recruiter["CLI / curl / MCP client"]
  end

  subgraph HTTP["Optional FastAPI"]
    Chat["POST /chat"]
    Health["GET /health"]
  end

  subgraph Agent["Agent loop"]
    LLM["LLM or FakeLLM stub"]
    ReAct["ReAct planner"]
  end

  subgraph MCP["MCP server"]
    T1["retrieve_docs"]
    T2["search_payments"]
    T3["create_ticket"]
  end

  subgraph Data
    KB["Markdown KB + hash embeddings"]
    SQLite["SQLite mock ledger / tickets"]
  end

  Recruiter --> Chat
  Recruiter --> MCP
  Chat --> ReAct
  ReAct --> LLM
  ReAct --> T1 & T2 & T3
  MCP --> T1 & T2 & T3
  T1 --> KB
  T2 --> SQLite
  T3 --> SQLite

El servidor MCP y el agente HTTP comparten un único registro de herramientas. Ese es el patrón de producción: exponer las mismas capacidades tipificadas sobre stdio/SSE para agentes IDE y sobre HTTP para una UI de producto.

Inicio rápido

Python 3.11+ (3.12/3.13 es válido). No se requiere clave API.

python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt

# tests — FakeLLM, hash embeddings, in-memory SQLite
pytest -q

# HTTP demo
cp .env.example .env
PYTHONPATH=src python -m uvicorn agentic_mcp_gateway.http_app:app --port 8080

Pruébelo en una sesión:

curl -s localhost:8080/health
curl -s localhost:8080/chat -H 'content-type: application/json' \
  -d '{"message":"Find payment PMT-1002 and open a ticket if it is stuck"}'

MCP stdio (para clientes tipo Claude Desktop / Cursor):

PYTHONPATH=src python -m agentic_mcp_gateway.mcp_server

Docker:

docker compose up --build
# then the same curl against localhost:8080

Cómo se mapean las herramientas MCP a producción

Herramienta de demostración

Lo que envolvería una plataforma real

Salvaguardas que añadiría

retrieve_docs

RAG de políticas / productos sobre Confluence, runbooks, notas ISO 20022

ACL por inquilino, cita obligatoria, TTL de documentos obsoletos

search_payments

API de lectura sobre un bus de pagos o almacén de investigación

Enmascaramiento a nivel de campo, registro de auditoría, límites de coste de consulta

create_ticket

Ruta de escritura de gestión de casos / Jira / ServiceNow

Claves de idempotencia, maker-checker, depuración de PII

El agente es un pequeño bucle ReAct: pensar → elegir una herramienta → observar → repetir, y luego responder. Con LLM_PROVIDER=fake el planificador es determinista, así que CI nunca necesita OpenAI. Configure LLM_PROVIDER=llm y OPENAI_API_KEY para intercambiarlo por un modelo de chat real; los contratos de las herramientas permanecen idénticos.

Los embeddings por defecto son n-gramas de caracteres con hash (coseno numpy). Ese es un fallback de demostración documentado — cambie HashingEmbedder por un sentence-transformer o una API de embeddings comercial sin alterar la interfaz del recuperador.

Estructura del proyecto

src/agentic_mcp_gateway/   package
  tools/                   retrieve / payments / tickets
  agent.py                 ReAct + FakeLLM
  mcp_server.py            MCP stdio server
  http_app.py              FastAPI /chat
docs/kb/                   sample ops knowledge
tests/                     tool registry, RAG, mocked agent turn

Autor

Md Tanvir Alam — github.com/tanvir-ux

Bajo licencia MIT. No está afiliado a ningún banco ni proveedor de core-banking.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    A production-minded RAG service for MCP that answers questions over your documents with hybrid retrieval, PII redaction, and source citations, packaged for Docker/Kubernetes.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    An MCP-native agentic platform orchestrating planner/executor/critic agents over hybrid RAG with three-tier memory, budget enforcement, safety guardrails, and full observability. It exposes all capabilities as MCP tools, enabling natural-language control of document ingestion, retrieval-augmented generation, and multi-step AI workflows.
    MIT
  • F
    license
    A
    quality
    B
    maintenance
    MCP server that exposes life-insurance back-office tools (policy document search, application status, product/underwriting rules) to LLM agents. Enables agents to retrieve policy documents, check application status, and evaluate underwriting rules via hybrid search and rule lookup.
    3
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables local RAG orchestration with MCP, providing context retrieval, in-memory text ingestion, explicit tool invocation, and transport-neutral tool discovery.
    -