MCP cover image
See in Github
2025-04-14

0

Github Watches

0

Github Forks

0

Github Stars

🧠 Model Context Protocol (MCP) – Clientes y Servidores

MCP_connection ./thumbnail/profile.jpg

Enlace al Discord de CLAI: https://discord.gg/d49rGXxn

Este repositorio contiene ejemplos prácticos y mínimos para entender cómo funciona el Model Context Protocol (MCP), un estándar abierto para conectar modelos de lenguaje (LLMs) con datos y herramientas externas de forma modular y escalable.


📂 Estructura del repositorio

🟦 mcp_client_stdio/cliente-openai.py y mcp_client_stdio/cliente-anthropic.py

Implementaciones de clientes MCP que se comunican con modelos de lenguaje a través del protocolo MCP:

  • cliente-openai: Cliente que se conecta a servidores MCP usando la API de OpenAI.
  • cliente-anthropic: Cliente que utiliza Claude de Anthropic como host para el MCP.

Cada cliente mantiene una conexión 1:1 con un servidor MCP, gestionando la comunicación con los recursos y herramientas.

🟨 /servidor-api y /servidor-local

Ejemplos de servidores MCP que exponen funcionalidades al modelo:

  • servidor-api: Simula conexión a un servicio externo vía API (ej. información del clima).
  • servidor-local: Expone archivos o datos locales como recursos accesibles desde el modelo.

Cada servidor MCP puede ofrecer:

  • 🔧 Tools: Funciones ejecutables por el LLM (function calling).
  • 📄 Resources: Datos de solo lectura, como si fueran endpoints GET.
  • 💬 Prompts: Plantillas predefinidas para guiar al modelo.

🚀 Cómo probarlo

Paso 1: Configurar el Proyecto del Cliente

uv init mcp-client
cd mcp-client
uv venv
source .venv/bin/activate  # En Windows: .venv\\Scripts\\activate
uv add mcp anthropic python-dotenv

Paso 2: Configura Tu Clave API

Crea un archivo .env con tu clave API de Anthropic:

ANTHROPIC_API_KEY=<tu clave aquí>

Paso 3: Implementar el Cliente

El archivo cliente_anthropic.py contendrá la lógica del cliente MCP (ver ejemplo completo en el repositorio).

Incluye:

Inicialización de la sesión y conexión con el servidor MCP

Envío de mensajes a Claude

Llamadas a herramientas dinámicas según la respuesta del modelo

Paso 4: Ejecuta el Cliente

(asegurate de estar en la carpeta mcp_client_stdio)

uv run cliente_anthropic.py ../mcp_server_stdio/weather.py

相关推荐

  • WangRongsheng
  • 🧑‍🚀 全世界最好的LLM资料总结(Agent框架、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.

  • av
  • Effortlessly run LLM backends, APIs, frontends, and services with one command.

  • 1Panel-dev
  • 🔥 1Panel provides an intuitive web interface and MCP Server to manage websites, files, containers, databases, and LLMs on a Linux server.

  • langgenius
  • Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.

  • alibaba
  • an easy-to-use dynamic service discovery, configuration and service management platform for building AI cloud native applications.

  • rulego
  • ⛓️RuleGo is a lightweight, high-performance, embedded, next-generation component orchestration rule engine framework for Go.

  • hkr04
  • Lightweight C++ MCP (Model Context Protocol) SDK

  • nbonamy
  • Witsy: desktop AI assistant / universal MCP client

  • sigoden
  • Easily create LLM tools and agents using plain Bash/JavaScript/Python functions.

  • evilsocket
  • The Simple Agent Development Kit.

    Reviews

    3.3 (3)
    Avatar
    user_8IJoCfRD
    2025-04-24

    MCP_connection by CLAI-Academy is a fantastic tool for seamless integration and connectivity. The interface is intuitive, and the welcome information is quite helpful for beginners. I've been using it consistently, and it has vastly improved my workflow while ensuring robust performance. Highly recommend this for anyone looking to enhance their digital connection experiences!

    Avatar
    user_0U1Zr8vl
    2025-04-24

    As a dedicated user of MCP_connection by CLAI-Academy, I must say this product is exceptional. The seamless connectivity and user-friendly interface have significantly improved my productivity. The comprehensive support and detailed welcome information make the experience even more enjoyable. Highly recommended!

    Avatar
    user_dut9o6OZ
    2025-04-24

    I have been using MCP_connection by CLAI-Academy for a few months now, and it has truly transformed my workflow. The welcome message is very inviting, making it easy to get started quickly. I appreciate the seamless connectivity and user-friendly interface. Highly recommend it for anyone looking for a reliable connection tool!