- Explore MCP Servers
- good_mcp_demo
Good Mcp Demo
What is Good Mcp Demo
good_mcp_demo is a minimalistic demo of an MCP (Model Context Protocol) server, consisting of only 9 lines of code. It is designed for beginners who want to learn about MCP.
Use cases
Use cases include learning how to implement an MCP server, creating a time service tool, and experimenting with server-client interactions using the MCP framework.
How to use
To use good_mcp_demo, download the code or copy the provided 9 lines. Set up a conda environment, install the necessary dependencies, and run the code to start the server.
Key features
Key features include a simple implementation with only 9 lines of code, a tool for fetching the current system time, and the ability to run the server using SSE (Server-Sent Events) mode.
Where to use
good_mcp_demo can be used in educational settings for teaching MCP concepts, in development environments for testing and learning, and as a foundation for building more complex MCP servers.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Good Mcp Demo
good_mcp_demo is a minimalistic demo of an MCP (Model Context Protocol) server, consisting of only 9 lines of code. It is designed for beginners who want to learn about MCP.
Use cases
Use cases include learning how to implement an MCP server, creating a time service tool, and experimenting with server-client interactions using the MCP framework.
How to use
To use good_mcp_demo, download the code or copy the provided 9 lines. Set up a conda environment, install the necessary dependencies, and run the code to start the server.
Key features
Key features include a simple implementation with only 9 lines of code, a tool for fetching the current system time, and the ability to run the server using SSE (Server-Sent Events) mode.
Where to use
good_mcp_demo can be used in educational settings for teaching MCP concepts, in development environments for testing and learning, and as a foundation for building more complex MCP servers.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
这是一个只有 9行 代码的并且可运行的,mcp(model context protocol)server的demo。适合想要上手学习mcp的新手。
第一步 下载代码
下载完整代码或者直接复制下面9行代码。
import datetime
from mcp.server.fastmcp import FastMCP
mcp = FastMCP(name="time-service")
@mcp.tool(name="get_current_time", description="获取当前系统时间")
def get_current_time(format_str: str = "%Y-%m-%d %H:%M:%S") -> str:
now = datetime.datetime.now()
return now.strftime(format_str)
if __name__ == "__main__":
mcp.run(transport='sse') # 使用SSE模式运行服务
第二步 配置conda环境
conda.exe create -n mcp python=3.12 conda activate mcp
第三步 安装依赖包
pip install "mcp[cli]" pip install psutil
第四步 运行代码
python mcp_get_current_time.py
第五步 在聊天机器人中配置mcp server并使用
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










