🧠 MCP Server: Local AI Tooling with Python について
ローカルの CSV と Parquet ファイルを読み取る Python 製 MCP サーバーです。Claude などの AI アシスタントによる自然言語での表データ検索を想定し、ツールを追加しやすい構成です。
主な機能
- 01CSV ファイルの読み取り
- 02Parquet ファイルの読み取り
- 03モジュール式のツール構成
活用シーン
- 01Claude でローカルデータセットを要約
- 02表形式ファイルから特定情報を取得
MCP 対応
MCP クライアントがローカルの CSV と Parquet データにアクセスできるツールを登録します。README では Claude for Desktop との連携が説明されています。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
🧠 MCP サーバー:Python によるローカル AI ツール
このプロジェクトでは、Python を使用して軽量な Model Context Protocol(MCP)サーバーをセットアップし、Claude のような AI アシスタントが CSV や Parquet などのローカルデータファイルを操作できるようにします。Claude for Desktop と連携することで、データセットの要約や、自然言語でのクエリによる特定の情報の取得などのタスクを実行できます。
🚀 機能
ローカル MCP サーバー(mix_server):Claude とローカルツール間の通信を可能にします。
CSV および Parquet リーダー:データ分析で一般的に使用される表形式のデータを読み込み、処理するツールです。
モジュール構造:追加のツールで簡単に拡張できるよう設計された、整理されたコードベースです。
シームレスな 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).
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。