wingsfly
MCP Serverwingsflypublic

mcp_service_demo

展示如何使用模型上下文协议(MCP)服务,支持SSE和callback交互。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Jupyter Notebook
Language
-
License

About This Server

展示如何使用模型上下文协议(MCP)服务,支持SSE和callback交互。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

MCP Service Demo

这个项目演示了如何使用模型上下文协议(Model Context Protocol, MCP)服务,支持SSE和stdio两种交互方式。

功能特点

  • 支持SSE和stdio类型的MCP服务交互
  • 同时兼容Ollama和OpenAI格式的大模型调用
  • 提供可配置的服务列表,兼容Claude Desktop格式
  • 工具调用路由,自动选择对应服务进行调用
  • 统计各环节耗时

项目结构

  • server.py: MCP服务器示例,提供网站内容获取功能
  • client.py: MCP客户端,支持多种模型和服务调用
  • mcp_config.json: MCP服务配置文件

使用方法

1. 启动服务器

python server.py

2. 配置服务

编辑mcp_config.json文件,添加所需的MCP服务:

{
  "mcpServers": {
    "example_sse_service": {
      "type": "sse",
      "url": "http://localhost:8000/sse",
      "description": "An example SSE service for testing purposes."
    }
  }
}

3. 运行客户端

python client.py --query "使用工具回答这个问题" --model-type ollama --model-name qwen2.5:7b --model-url http://localhost:11434

参数说明

--model-type: 使用的模型类型(openai或ollama)
--model-name: 使用的模型名称
--model-url: 模型的URL
--config-file: MCP服务列表的配置文件路径
--service-name: 指定加载的MCP服务名称(可选)
--query: 要询问的问题

依赖项

  • python-mcp-sdk
  • ollama-python
  • openai
  • httpx
  • uvicorn
  • starlette

许可证

MIT

Quick Start

1

Clone the repository

git clone https://github.com/wingsfly/mcp_service_demo
2

Install dependencies

cd mcp_service_demo
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerwingsfly
Repomcp_service_demo
LanguageJupyter Notebook
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation