MCP

实现执行Terminal命令的server

  1. 配置uv

  2. 配置MCP Python Sdk(百度地图api网址)

  3. 在cursor.directory找python expert的prompt

  4. vibe code

    1
    I want you to implement me a simple MCP Server from @MCP . Use the python sdk @MCP Python SDK and the server should expose one tool which is called terminal tool which will allow user to run terminal commands, make it simple.

    模型效果不好,高级模型需要升级会员,先复制粘贴课程的

  5. 运行

    1
    uv run .\server.py

  6. 配置mcp.json

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    {
    "mcpServers": {
    "weather": {
    "command": "node",
    "args": [
    "E:/software/work/Cursor/mcpspace/quickstart-resources/weather-server-typescript/build/index.js"
    ]
    },
    "shell": {
    "command": "uv",
    "args": [
    "--directory", "E:/software/work/Cursor/mcpspace/shellserver", "run", "server.py"
    ]
    }
    }
    }
  7. 测试:显示E盘所有文件夹

使server暴露Resources


MCP
https://leopol1d.github.io/2025/04/21/MCP/
作者
Leopold
发布于
2025年4月21日
许可协议