Cover image
Try Now
2025-04-14

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

🧠 Model Context Protocol (MCP) – Clientes y Servidores

Profile

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

相关推荐

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • sigoden
  • 使用普通的bash/javascript/python函数轻松创建LLM工具和代理。

  • hkr04
  • 轻巧的C ++ MCP(模型上下文协议)SDK

  • RockChinQ
  • 😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack

  • dmayboroda
  • 带有可配置容器的本地对话抹布

  • paulwing
  • 使用MCP服务创建的测试存储库

  • evilsocket
  • 简单的代理开发套件。

    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!