Python MCP服务器构建

使用Python构建MCP服务器,通过Claude Desktop进行数据查询和分析。

  • by ThomasJanssen-tech
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 thomasjanssen-tech/mcp_server

使用说明

Build an MCP Server with Python

Watch the full tutorial on my YouTube Channel

Prerequisites

  • Python 3.13

Installation

1. Install UV

在Windows上:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

在MacOS/Linix上:

curl -LsSf https://astral.sh/uv/install.sh | sh

更多信息:https://docs.astral.sh/uv/getting-started/installation/

2. Download Claude Desktop

在此处下载克劳德桌面:https://claude.ai/download

3. Clone the repository:

git clone https://github.com/ThomasJanssen-tech/MCP_Server
cd MCP_Server

4. Add Bright Data API Key

  • Get your $15 Bright Data credits: https://brdta.com/tomstechacademy
  • Rename the .env.example file to .env
  • Add your Bright Data API key

Configure Claude Desktop

在项目目录中,现在运行以下命令以自动配置Claude Desktop,其中main.py是您的MCP服务器脚本的名称。

uv run mcp install main.py

Executing the scripts

  • 用VS Code打开终端

  • 执行以下命令:

uv run download_data.py
uv run ingest_data.py

Start asking questions to Claude Desktop

You can now ask questions to Claude Desktop about companies listed on Crunchbase!

Further reading

  • https://github.com/modelcontextprotocol/python-sdk