Cover image
Try Now
2025-04-14

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

MCP Learn - Model Context Protocol Examples

This repository contains examples of using the Model Context Protocol (MCP).

Overview

MCP allows Large Language Models (LLMs) to call external tools via a standardized protocol. This repository includes:

MCP clients

Agents that use MCP

MCP servers

Setup

Prerequisites

  1. Python 3.10 or higher
  2. uv for Python package management

Installation

# Clone this repository
git clone https://github.com/huangyingting/mcp-learn.git
cd mcp-learn

# Install dependencies
uv sync

Environment Setup

Create a .env file in servers, clients, and agents directories by copying the .env.example file to .env:

cp .env.example .env

Update the .env file with your Azure OpenAI API key and other configurations as needed.

Running the Examples

Starting a Server

All MCP servers are located in the servers/ directory. For example, to start the weather or stock server (both support two transport methods):

  1. stdio (default): For direct communication with the client
  2. sse: For running as a web server

To start a server with SSE transport:

uv run servers/any_mcp_server.py -t sse

When using the SSE transport, the server starts on http://localhost:8000/sse by default.

There is a composite server that aggregates all MCP servers. To start the composite server:

uv run servers/composite_server.py -t sse

Connecting the Client

Client are located in the clients/ directory. The client can connect to either a Python script server (stdio) or an SSE server:

To connect to a stdio server:

uv run clients/client.py servers/any_mcp_server.py

To connect to an SSE server:

uv run clients/client.py http://localhost:8000/sse

Once connected, you can interact with the client by typing in queries. For example:

  • Weather server: "What's the weather forecast for latitude 40.7, longitude -74.0?" or "Are there any weather alerts in CA?"
  • Stock server: "What's the current price of AAPL?" or "Give me information about Google's stock"

Type quit or exit to end your session.

For the chainlit client, you can run it with the following command:

uv run chainlit run clients/chainlit_client.py --port 9000

Then, open your web browser and navigate to http://localhost:9000 to interact with the client.

Use the Agent

The agent is located in the agents/ directory. To run the agent, use the following command:

To run semantic kernel agent

uv run agents/sk_agent.py

To run langgraph agent

uv run agents/langgraph_agent.py

To run autogen agent

uv run agents/autogen_agent.py

To run openai agent

uv run agents/openai_agent.py

To run ADK agent

uv run adk web --port 9000

Then, open your web browser and navigate to http://localhost:9000 to interact with the agent through adk web.

To run pydantic agent

uv run agents/pydantic_agent.py

To run agno agent

uv run agents/agno_agent.py

To run smolagents agent

uv run agents/smol_agent.py

To run atomic agent

uv run agents/atomic_agent.py

Available MCP servers

Weather Server

  • get_alerts: Get weather alerts for a US state using a two-letter state code
  • get_forecast: Get a weather forecast for a location by latitude and longitude

Stock Server

  • current_date: Get the current date
  • stock_price: Get the stock price for a given ticker
  • stock_info: Get information about a company by ticker
  • income_statement: Get the quarterly income statement for a company

NL2SQL Server

  • query_sql: Execute a custom SQL query on the SQLite database
  • list_tables: List all tables in the SQLite database
  • describe_table: Get the structure of a specific table
  • execute_nonquery: Execute a non-query SQL statement (INSERT, UPDATE, DELETE, etc.)
  • database_info: Get general information about the connected SQLite database

Time Server

  • get_current_time: Get the current time in a specific timezone

Search Server

  • web_search: Search the web for a given query

News Server

  • news_top_headlines: Get top headlines from NewsAPI.
  • news_search: Search for news articles using NewsAPI.
  • news_sources: Get available news sources from

相关推荐

  • av
  • Führen Sie mühelos LLM -Backends, APIs, Frontends und Dienste mit einem Befehl aus.

  • 1Panel-dev
  • 🔥 1Panel bietet eine intuitive Weboberfläche und einen MCP -Server, um Websites, Dateien, Container, Datenbanken und LLMs auf einem Linux -Server zu verwalten.

  • rulego
  • ⛓️Rugele ist ein leichter, leistungsstarker, leistungsstarker, eingebetteter Komponenten-Orchestrierungsregel-Motor-Rahmen für GO.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.

  • Onelevenvy
  • Flock ist eine Workflow-basierte Low-Code-Plattform, um schnell Chatbots, Lappen und Koordinierung von Multi-Agent-Teams zu erstellen, die von Langgraph, Langchain, Fastapi und NextJs angetrieben werden.

  • Byaidu
  • PDF wissenschaftliche Papierübersetzung mit erhaltenen Formaten - 基于 ai 完整保留排版的 pdf 文档全文双语翻译 , 支持 支持 支持 支持 google/deeptl/ollama/openai 等服务 提供 cli/gui/mcp/docker/zotero

  • n8n-io
  • Fair-Code-Workflow-Automatisierungsplattform mit nativen KI-Funktionen. Kombinieren Sie visuelles Gebäude mit benutzerdefiniertem Code, SelbstHost oder Cloud, 400+ Integrationen.

  • hkr04
  • Leichtes C ++ MCP (Modellkontextprotokoll) SDK

  • sigoden
  • Erstellen Sie einfach LLM -Tools und -Argarten mit einfachen Bash/JavaScript/Python -Funktionen.

  • RockChinQ
  • 😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / diskord / telegram / slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Diffy 、 Claude 、 Gemini 、 xai 、 ppio 、 、 ulama 、 lm Studio 、阿里云百炼、火山方舟、 siliconflow 、 qwen 、 mondshot 、 chatglm 、 sillytraven 、 mcp 等 llm 的机器人 / agent | LLM-basierte Instant Messaging Bots-Plattform, unterstützt Zwietracht, Telegramm, Wechat, Lark, Dingtalk, QQ, Slack

  • modelscope
  • Bauen Sie LLM-Multi-Agent-Anwendungen auf einfachere Weise auf.

    Reviews

    2.7 (6)
    Avatar
    user_Uraa73dC
    2025-04-23

    mcp-learn is an exceptional tool for anyone looking to deepen their knowledge. Created by huangyingting, this product stands out with its user-friendly interface and comprehensive materials. It's designed to make learning accessible and engaging. Highly recommend for learners of all levels!

    Avatar
    user_3VjvOlw2
    2025-04-23

    I recently tried the mcp-learn application by huangyingting, and it exceeded all my expectations! The platform is user-friendly and incredibly informative. I found the courses well-structured, making it easy to follow and learn at my own pace. If you're looking to deepen your knowledge efficiently, mcp-learn is definitely a great choice!

    Avatar
    user_sfGQm4jf
    2025-04-23

    mcp-learn by huangyingting is an exceptional learning tool. As a dedicated user, I truly appreciate its seamless integration and user-friendly interface. The starting URL and welcoming information make the initial setup a breeze. This resource has significantly improved my learning experience, providing valuable insights and efficient methods to master various subjects. Highly recommend it for anyone seeking a reliable and effective learning companion!

    Avatar
    user_GiKU06SL
    2025-04-23

    I have been using mcp-learn by huangyingting and it's truly a fantastic learning tool! The intuitive interface and engaging content make it easy to grasp complex concepts. Highly recommend it to anyone looking to enhance their learning experience.

    Avatar
    user_ZEtMMtFa
    2025-04-23

    As an avid user of mcp-learn, I can confidently say that this platform, created by huangyingting, is a game-changer in its field. It offers a seamless learning experience, rich with resources and user-friendly navigation. The welcoming message sets a positive tone right from the start, making it a pleasant journey for all learners. Highly recommend it!

    Avatar
    user_HS8N9MPQ
    2025-04-23

    I recently started using MCP-Learn by huangyingting, and it has transformed my learning experience! The straightforward URL and welcoming interface make it easy to dive right in and start absorbing new information. The application is well-designed and supports multiple languages, ensuring accessibility for users worldwide. Highly recommend it for anyone looking to enhance their skills and knowledge efficiently.