Demo MCP Server

Demo MCP Server

A demonstration MCP server built with FastMCP that provides basic mathematical operations (addition and multiplication) and personalized greeting generation tools with multiple style options.

Category
Visit Server

README

MCP Server Demo

这是一个MCP(Model Context Protocol)服务器示例,提供多种工具和资源供AI模型调用。

项目简介

本项目是一个基于FastMCP框架构建的MCP服务器,提供了基础的数学计算工具、个性化问候资源和用户问候提示等功能。

功能特性

  • 加法工具:执行两个整数的加法运算
  • 乘法工具:执行两个整数的乘法运算
  • 个性化问候资源:根据姓名生成个性化问候语
  • 用户问候提示:根据指定风格生成问候提示

依赖要求

  • Python >= 3.12
  • mcp[cli] >= 1.12.2

安装步骤

  1. 确保已安装Python 3.12或更高版本
  2. 安装依赖:
    pip install mcp[cli]>=1.12.2
    

启动服务

运行以下命令启动MCP服务器:

uv run server fastmcp_quickstart stdio

或者直接运行Python文件:

python mcp_server.py

魔搭社区部署说明

部署准备

  1. 确保项目根目录包含以下文件:
    • [mcp_server.py](file:///E%3A/code/mcp_server/mcp_server.py) - 主服务文件
    • [pyproject.toml](file:///E%3A/code/mcp_server/pyproject.toml) - 项目配置文件
    • [README.md](file:///E%3A/code/mcp_server/README.md) - 项目说明文件

部署步骤

  1. 将项目代码上传至魔搭社区环境
  2. 在魔搭环境中安装依赖:
    pip install -r requirements.txt
    # 或者直接安装pyproject.toml中的依赖
    pip install .
    
  3. 启动服务:
    uv run server fastmcp_quickstart stdio
    

服务配置

  • 服务名称:Demo
  • 通信方式:stdio
  • 支持的工具:
    • add: 两数相加
    • multi: 两数相乘
    • get_greeting: 获取个性化问候
    • greet_user: 生成用户问候提示

使用示例

  • 加法工具:输入两个整数,返回它们的和
  • 乘法工具:输入两个整数,返回它们的积
  • 问候资源:输入姓名,返回个性化问候语(格式:greeting://{name})
  • 问候提示:输入姓名和风格(友好/正式/随意),返回相应风格的问候

注意事项

  • 确保在魔搭社区环境中正确配置了Python运行环境
  • 检查依赖包是否正确安装
  • 服务启动后会监听stdio进行MCP协议通信

许可证

请在此处添加许可证信息(如适用)

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured