8000 GitHub - heureux831/mcp-demo: A simplest MCP system implemented in Python, including a client and several servers.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

heureux831/mcp-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The simplest mcp project

本项目实现了最小的mcp项目,方便理解整个MCP系统的运行,

项目使用了deepseek的api_key,请在.env文件中添加你的api_key

如果使用其他LLM服务,请在env文件中添加相应的API_KEY,请选择支持MCP服务的LLM服务

文件结构

├── .env
├── .gitignore
├── client/client.py
├── client/server.json
├── server/tasklist.py
├── pyproject.toml
|── tasks.csv   
|── README.md

创建虚拟环境

uv venv

# Activate virtual environment

# On Windows:
.venv\Scripts\activate

# On Unix or MacOS:
source .venv/bin/activate

安装依赖

## 使用openai格式来访问
uv add mcp openai python-dotenv

创建.env文件

touch .env

Add API key to .env file

echo "OPENAI_API_KEY=your_api_key" >> .env
echo "OPENAI_BASE_URL="https://api.deepseek.com/v1"" >> .env
echo "OPENAI_MODEL="deepseek-chat" >> .env

编辑server.json文件来指定mcp-server

{
    "servers": [
      {
        "command": "uv",
        "args": ["run","../server/tasklist.py"],
        "env": null
      },
      {
        "command": "uv",
        "args": ["run","../server/weather.py"],
        "env": null
      },
      {
        "command": "npx",
        "args": ["-y","../server/stock.js"],
        "env": null
      }
    ]
  }

运行mcp-demo

cd client
uv run client.py server.json

然后输入用户query即可

About

A simplest MCP system implemented in Python, including a client and several servers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0