Content
# Simple MCP Server
> This is a sample project that demonstrates how to build an MCP Server in a minimalist way.
- Weather Inquiry: Use the [Weather Inquiry API](https://lbs.amap.com/api/webservice/guide/api/weatherinfo) provided by the AMap Open Platform to implement the MCP Server, which can obtain current and future weather.
## Effect Demonstration

As shown in the figure:
- The user asks "Do I need to wear a cotton jacket in Xi'an today?"
- The AI automatically determines whether to call the weather MCP Server
- The AI provides the longitude and latitude information of Xi'an to the MCP Server according to the MCP Server's parameter requirements
- The MCP Server internally calls the weather query API provided by AMap and returns the result to the AI
- The AI summarizes and organizes the weather results and outputs them to the user
## Environment Preparation
### MCP Server Construction and Execution
- 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 and Large Model
> Any AI conversation client program that supports the MCP protocol can be used, such as Cline, Continue, Claude Desktop, etc. This example uses Cherry Studio.
[Cherry Studio](https://cherry-ai.com/)
Cherry Studio is an AI conversation client that supports multiple large model providers, such as Silicon-based Flow, Alibaba Cloud Baizhan, OpenAI, and dozens of other domestic and foreign providers, each providing many large model services with different capabilities, some free and some paid, with different functions and abilities.
Of course, Cherry Studio also supports locally running large models, such as Ollama, LLM Studio, etc.
This article uses the `Qwen2.5-7B-Instruct` model provided by Silicon-based Flow. Please register a Silicon-based Flow account, apply for an API key, and configure the API key in Cherry Studio.
**Note**: Please select a large model with the `Function Call` function (the model with the 🔧 symbol in Cherry Studio), such as `Qwen2.5-7B-Instruct`.

### AMap Open Platform API Key
Apply for a Web API key (key) from the AMap Open Platform [console](https://console.amap.com/dev/key/app).
## Building
## Building and Running
The server uses STDIO transport mode and is typically started automatically by the client. To build the server jar:
```bash
./mvnw clean install -DskipTests
```
After building, the `target/mcp-weather-stdio-server-0.0.1-SNAPSHOT.jar` file will be generated in the project path.
## Installation and Use
Open `Settings/MCP Server` in Cherry Studio and add an MCP server as shown in the figure:

- Name: Write freely
- Type: STDIO
- Command: node
- Parameters: The path to the execution file built earlier, i.e., `/Users/yourname/simple-mcp-server/build/index.js`
- Environment Variables:
- `GAODE_API_KEY`: The 32-bit Web API key applied from the AMap Open Platform `GAODE_API_KEY=your_api_key`
- `DINGTALK_ACCESS_TOKEN`: The 64-bit key behind the webhook address of the DingTalk group robot `DINGTALK_ACCESS_TOKEN=your_access_token`
## Usage
Create a new conversation in Cherry Studio, and enable the MCP server and the MCP Server installed earlier at the bottom of the dialog box.
Note: When a large model with the `Function Call` function is selected, there will be MCP-related options below.
