MCP服务器示例

该仓库包含使用fastmcp和fastapi_mcp库构建Model Context Protocol (MCP)服务器的示例项目和实践文件,适用于API封装和工具自动生成。

  • by saadmdsabah
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 saadmdsabah/MCP-Servers-using-Python

使用说明

FastMCP & FastAPI-MCP Examples

This repository is a collection of sample projects and practice files demonstrating how to build Model Context Protocol (MCP) servers using both the fastmcp (pure) and fastapi_mcp (FastAPI integration) libraries.

It includes examples for:

  • Wrapping a pure function (calculator.py)
  • Wrapping an external API (weather.py)
  • Parsing an RSS feed (GoogleFeedParser.py)
  • Auto-generating tools from a full FastAPI API (calculator-api.py)

🚀 Live Deployed Server: Google News Parser

The code from GoogleFeedParser.py (also organized in the MCP Deployment using FastMCP Cloud folder) is deployed as a live, public MCP server.

Quick Usage

1. Using Cursor.ai

Create an mcp.json file in your project's root:

     {
         "mcpServers": {
             "google-news-parse": {
                 "url": "https://google-news-parser.fastmcp.app/mcp"
             }
         }
     }