MCP Demo Server

MCP Demo Server

A demonstration server based on Model Context Protocol (MCP) that showcases how to build custom tools for AI assistants, providing mathematical calculation and multilingual greeting capabilities.

Category
Visit Server

README

MCP Demo Server

一个基于 Model Context Protocol (MCP) 的演示服务器,展示如何构建可与 AI 助手集成的自定义工具集。

🚀 项目简介

Model Context Protocol (MCP) 是一个标准化协议,用于 AI 助手与外部工具和数据源的安全连接。本项目实现了一个功能完整的 MCP 服务器,提供数学计算和多语言问候功能,可无缝集成到支持 MCP 的 AI 客户端中(如 Claude Desktop、Cursor 等)。

✨ 功能特性

🔧 内置工具

  • 🧮 add - 两数相加计算器
  • 👋 greet - 多语言智能问候生成器(支持英语、中文、西班牙语、法语)
  • 📊 calculate - 高级数学运算工具(加减乘除,含错误处理)

🏗️ 技术特点

  • ✅ 基于最新 MCP SDK 构建
  • ✅ TypeScript 类型安全
  • ✅ JSON Schema 参数验证
  • ✅ 完整错误处理机制
  • ✅ stdio 通信协议
  • ✅ 生产就绪的代码结构

📦 安装配置

环境要求

  • Node.js 18+
  • npm 或 yarn
  • TypeScript 支持

快速开始

# 克隆项目
git clone <repository-url>
cd mcp-demo-server/demo

# 安装依赖
npm install

# 启动服务器
npm start

项目结构

demo/ ├── demo.ts # MCP 服务器主文件 ├── package.json # 项目配置 ├── test-advanced.js # 高级功能测试脚本 └── README.md # 项目文档

🔧 使用方法

在 Cursor 中配置

  1. 打开 Cursor 配置文件:~/.config/cursor/claude_desktop_config.json

  2. 添加 MCP 服务器配置:

{
  "mcpServers": {
    "demo-server": {
      "command": "npx",
      "args": ["tsx", "/path/to/your/demo/demo.ts"],
      "cwd": "/path/to/your/demo"
    }
  }
}
  1. 重启 Cursor

在 Claude Desktop 中配置

{
  "mcpServers": {
    "demo-server": {
      "command": "npm",
      "args": ["start"],
      "cwd": "/path/to/your/demo"
    }
  }
}

示例使用:

💡 如何触发 MCP 工具调用

明确要求使用工具

使用 MCP 工具计算 100 + 200
调用你的数学工具计算这个
用外部计算器算一下

复杂一些的任务

计算 π × 2.5 的平方根
用多种语言问候客户
批量计算这些数字

明确的工具名称

用 add 工具计算
使用 calculate 功能
调用 greet 工具

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
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
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
E2B

E2B

Using MCP to run code via e2b.

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
Qdrant Server

Qdrant Server

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

Official
Featured