使用说明
🧠 MCP服务器:使用Python的本地AI工具
该项目使用Python建立了一个轻量级的模型上下文协议(MCP)服务器,使像Claude这样的人工智能助手能够与CSV和Parquet等本地数据文件进行交互。通过与Claude for Desktop集成,您可以执行汇总数据集或通过自然语言查询检索特定信息等任务
🚀 特性
本地MCP服务器(mix_server):促进克劳德和您当地工具之间的沟通。
CSV和拼花游戏阅读器:用于加载和处理数据分析中常用的表格数据格式的工具。
模块化结构:干净的代码库,设计用于使用附加工具轻松扩展。
无缝集成Claude:直接与Claude for Desktop连接,允许与您的数据进行自然语言交互。
🛠️ 安装
1.克隆仓库
git clone https://github.com/yourusername/mcp-server.git
cd mcp-server
``
### 2. Set Up the Environment Using `uv
[uv](https://github.com/astral-sh/uv) is a fast Python package and project manager written in Rut It serves as a drop-in replacement for tools like `pip`, `pip-tools`, and `virtualenv`, offering significant speed improvements and a unified interfae.
#### Install `uv
You can install `uv` using one of the following methos:
- **Using `curl` (macOS and Linux):**
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
``
- **Using `pip`:**
```bash
pip install uv
``
- **Using `pipx`:**
```bash
pipx install uv
``
For more installation options and details, refer to the [official uv documentation](https://docs.astral.sh/uv).
#### Create a Virtual Environment and Install Dependencie
```bash
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install mcp[cli] pandas pyarrow
``
This will create a virtual environment and install the necessary dependencies using `u`.
## 📁 Project Structue
```bash
mcp-server/
├── tools/
│ ├── csv_reader.py
│ └── parquet_reader.py
├── mix_server.py
├── README.md
└── requirements.txt
``
- `tools/`: Contains individual tool scripts for data processng.
- `mix_server.py`: Initializes and runs the MCP server, registering available tols.
## ⚙️ Configuration for Claude Desktp
To integrate with Claude for Desktop, add the following configuration to your Claude settigs:
```json
{
"mcpServers": {
"mix_server": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["/absolute/path/to/mix_server.py"]
}
}
}
``
Ensure that the paths to your Python interpreter and `mix_server.py` are corrct.
## 🧪 Usge
Once set up, you can interact with your data through Claude using natural language prompts. For exaple:
- "Summarize the contents of `data.cv`."
- "How many rows and columns are in `dataset.parqut`?
Claude will utilize the registered tools to process your request and provide the desired informaion.
## 📚 Refereces
This project is based on the tutorial: [Building a Basic MCP Server with Python](https://medium.com/data-engineering-with-dremio/building-a-basic-mcp-server-with-python-4c34c4101ed).
## 📝 Liense
This project is licensed under the [MIT License](LIENSE).
