Simple MCP Server

Simple MCP Server

xiaobo187

Research & Data
Visit Server

README

Simple MCP Server

这是一个示例项目,用极简方式演示如何构建MCP Server。

  • 天气查询:使用高德开放平台提供的天气查询API实现MCP Server,可获取实况和未来天气.

效果演示

Cherry Studio使用

如上图:

  • 用户问"西安今天用穿棉袄吗"
  • AI自动判断是否要调用天气MCP Server
  • AI按照MCP Server的参数要求,将西安的经纬度信息提供给MCP Server
  • MCP Server内部调用了高德提供的天气查询API,并将结果返回给AI
  • AI将天气结果进行汇总整理,输出给用户

环境准备

MCP Server 构建和执行

  • Java 17 or later
  • Maven 3.6 or later
  • Understanding of Spring Boot and Spring AI concepts
  • (Optional) Claude Desktop for AI assistant integration

MCP Client和大模型

支持MCP协议的任何AI对话客户端程序都可以,如:Cline、Continue、Claude Desktop等, 本例使用Cherry Studio。

Cherry Studio

Cherry Studio是一个AI对话客户端,其支持很多个大模型提供商,如:硅基流动、阿里云百炼、OpenAI等几十个国内外提供商,各提供商分别提供很多大模型服务,各个大模型的能力也有差异,有免费和收费的,也有不同作用和能力的。 当然,Cherry Studio也支持本地运行的大模型,如:Ollama、LLM Studio等。

本文使用硅基流动提供的Qwen2.5-7B-Instruct模型,请先注册硅基流动账户,申请API密钥,并在Cherry Studio中配置API密钥。

注意:请选择带有Function Call功能的大模型(Cherry Studio中带🔧符合的大模型),如:Qwen2.5-7B-Instruct

配置大模型和密钥

高德开放平台API密钥

从高德开放平台申请Web API密钥(key)

构建

Building and Running

The server uses STDIO transport mode and is typically started automatically by the client. To build the server jar:

./mvnw clean install -DskipTests

构建完成后,在项目路径下会产生target/mcp-weather-stdio-server-0.0.1-SNAPSHOT.jar文件。

安装使用

在 Cherry Studio中打开设置/MCP服务器,添加MCP服务器,如下图:

添加MCP服务器

  • 名称: 随意写
  • 类型:STDIO
  • 命令:node
  • 参数:刚才构建的执行文件路径,即/Users/yourname/simple-mcp-server/build/index.js
  • 环境变量:
    • GAODE_API_KEY :高德开放平台申请的Web API 32位密钥 GAODE_API_KEY=your_api_key
    • DINGTALK_ACCESS_TOKEN: 创建钉钉群机器人的Webhook 地址后面的64位密钥 DINGTALK_ACCESS_TOKEN=your_access_token

使用

在Cherry Studio中新建对话,对话框下方开启MCP服务器和刚才安装的MCP Server。

注意:当选择了带有Function Call功能的大模型时,下方才有MCP相关选项。

使用MCP对话

Recommended Servers

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.

Featured
TypeScript
MCP PubMed Search

MCP PubMed Search

Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.

Featured
Python
dbt Semantic Layer MCP Server

dbt Semantic Layer MCP Server

A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.

Featured
TypeScript
mixpanel

mixpanel

Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Featured
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python
Nefino MCP Server

Nefino MCP Server

Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.

Official
Python
Vectorize

Vectorize

Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.

Official
JavaScript
Mathematica Documentation MCP server

Mathematica Documentation MCP server

A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.

Local
Python
kb-mcp-server

kb-mcp-server

An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded

Local
Python
Research MCP Server

Research MCP Server

The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.

Local
Python