Skip to main content
Glama
akream

Python MCP Cat Facts

by akream

Python MCP Cat 事实

一个 FastAPI 服务器,它使用服务器发送事件 (SSE) 传输实现模型上下文协议 (MCP) 来提供猫事实。

特征

  • 获取一条随机的猫咪事实

  • 订阅每 10 秒推送一次的猫咪知识

  • SSE(服务器发送事件)用于实时通信

  • 具有自动 OpenAPI 文档的 FastAPI 框架

Related MCP server: Skemati.ca MCP SSE Server

要求

  • Python 3.12+

  • 依赖项:

    • fastapi

    • mcp[cli]

    • uvicorn

    • CMake

安装

克隆存储库

git clone <repository-url>
cd python-mcp

创建虚拟环境

python -m venv venv
source venv/bin/activate  # On Windows, use: venv\Scripts\activate

安装依赖项

pip install -e .

以 SSE 模式启动服务器

使用 uv run 命令启动服务器:

uv run start

服务器运行后,可在以下位置使用:

VS Code 集成

要将此 MCP 服务器与 VS Code 一起使用,您需要将以下配置添加到mcp.json文件:

{
    "servers": {
        "mcp-sse": {
            "type": "sse",
            "url": "http://0.0.0.0:8000/sse"
        }
    }
}

此配置告诉 VS Code 如何使用 SSE 传输连接到您的 MCP 服务器。

使用 Cat Facts API

了解一只猫的概况:

连接到 SSE 端点并请求单个猫咪信息。响应始终以“Hi!”开头。

API 端点

  • GET / : 主页

  • GET /about :关于应用程序的信息

  • GET /status :当前服务器状态

  • GET /sse :MCP 通信的 SSE 端点

  • GET /docs :API 文档(Swagger UI)

  • GET /redoc :备用 API 文档(ReDoc)

执照

麻省理工学院

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Server-Sent Events implementation using FastAPI framework that integrates Model Context Protocol (MCP), allowing AI models to access external tools and data sources like weather information.
    51
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server implementation built with FastAPI that enables AI agent interactions. Provides a structured foundation for building AI-powered applications with proper data validation and modern Python tooling.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A FastAPI MCP server that uses Server-Sent Events as a transport layer, providing echo functionality through tools, resources, and prompts.
    12
    MIT