Skip to main content
Glama

Excel MCP Server

代替テキスト

uv init mcp-server-demo

cd mcp-server-demo

uv に "mcp[cli]" を追加 uv pip install mcp-python pandas matplotlib openpyxl fastapi uvicorn pillo uv run mcp dev server.py

uv 実行 mcp インストール server.py

Excel MCP サーバー

このプロジェクトは、Excelデータを操作するためのツールとリソースを提供するModel Context Protocol(MCP)サーバーを実装します。このサーバーは、シンプルなAPIを通じてExcelデータの読み取り、更新、フィルタリング、視覚化の機能を提供します。

特徴

  • Excel 操作: Excel ファイルの読み取りと書き込み
  • データフィルタリング: さまざまな基準に基づいてデータをフィルタリングおよび検索します
  • データ分析: 統計サマリーとピボットテーブルを生成する
  • データの視覚化: さまざまなチャートと視覚化を作成する
  • 更新操作: セルの更新、行の追加、行の削除
  • 異常検出:数値データ内の外れ値を見つける
  • チャートの推奨事項: 適切な視覚化を自動的に提案します

インストール

  1. 必要な依存関係をインストールします。
pip install mcp-python pandas matplotlib openpyxl fastapi uvicorn pillow
  1. このリポジトリをクローンするか、ファイルをダウンロードしてください:
    • server.py - MCP サーバーの実装
    • client.py - 機能を紹介するデモクライアント

使用法

サーバーの起動

サーバーを実行します。

python server.py

デフォルトでは、サーバーはhttp://localhost:8000で起動します。

クライアントデモの使用

クライアント デモ スクリプトでは、MCP サーバーで実行できるさまざまな操作を紹介します。

python client.py

これにより、次のようになります。

  1. サンプル Excel ファイルを作成する (存在しない場合)
  2. 基本的なExcel操作を実演する
  3. データフィルタリング機能を表示
  4. 視覚化を生成する
  5. データ更新を実行する
  6. データの異常を検出する

APIを直接使用する

MCP サーバーの API を直接使用できます。

ツールAPI

/tools/{tool_name}への POST リクエストを使用してツールを呼び出します。

import requests # Example: Read Excel file response = requests.post( "http://localhost:8000/tools/read_excel", json={"filename": "example.xlsx", "sheet_name": "Sheet1"} ) data = response.json()
リソースAPI

/resources/{resource_path}への GET または POST リクエストを使用してリソースにアクセスします。

# Example: Get sheet list response = requests.get("http://localhost:8000/resources/excel://example.xlsx/sheets") sheets = response.json()

利用可能なツール

Excel操作

  • read_excel - Excelファイルからデータを読み取る
  • write_excel - Excelファイルにデータを書き込む
  • get_excel_sheets - Excel ファイル内のシートのリストを取得します

データフィルタリング

  • filter_data - 条件に基づいて Excel データをフィルタリングする
  • search_data - Excelデータ内の用語を検索する

データ分析

  • summarize_data - Excelデータの統計概要を取得します
  • create_pivot_table - Excelデータからピボットテーブルを作成する

データの可視化

  • visualize_chart - さまざまな種類のチャートを作成します(棒グラフ、折れ線グラフ、散布図、円グラフ、履歴グラフ)
  • recommend_charts - データ構造に基づいてチャートの推奨事項を取得します

更新操作

  • update_cell - Excel ファイル内の特定のセルを更新する
  • add_row - Excelファイルに新しい行を追加する
  • delete_rows - フィルターに基づいて Excel ファイルから行を削除します

追加機能

  • detect_anomalies - Zスコアを使用して数値データの異常を見つける
  • export_to_csv - Excel データを CSV 形式でエクスポートします

利用可能なリソース

  • excel://{filename}/sheets - Excelファイル内のシートのリストを取得します
  • excel://{filename}/sheet/{sheet_name} - 特定のシートからデータを取得する
  • excel://{filename}/sheet/{sheet_name}/summary - シートデータの概要を取得します
  • excel://{filename}/sheet/{sheet_name}/filter - シート内のデータをフィルタリングする

例: カスタムクライアントの作成

MCP サーバーと対話するための独自のクライアントを作成できます。

import requests def call_tool(tool_name, params): """Call an MCP tool""" url = f"http://localhost:8000/tools/{tool_name}" response = requests.post(url, json=params) return response.json() # Example: Get chart visualization chart_result = call_tool("visualize_chart", { "filename": "sales_data.xlsx", "sheet_name": "Sheet1", "chart_type": "bar", "x_column": "Month", "y_columns": ["Revenue"], "title": "Monthly Revenue" }) # Save chart image if chart_result.get("success", False) and "image" in chart_result: import base64 img_data = base64.b64decode(chart_result["image"]) with open("revenue_chart.png", "wb") as f: f.write(img_data)

AIモデルとの統合

この MCP サーバーは、Claude などの AI モデルと簡単に統合でき、Excel データへの自然言語インターフェースを提供できます。

  1. AIはユーザーのリクエストに基づいて適切なMCPツールを呼び出すことができます。
  2. ツールによって返されたデータを処理する
  3. 洞察と視覚化をユーザーに提示する

これにより、自然言語の要求を理解して Excel データを分析および操作できるインタラクティブな「Excel アシスタント」が作成されます。

-
security - not tested
F
license - not found
-
quality - not tested

シンプルな API を通じて Excel データの読み取り、更新、フィルタリング、視覚化を行うツールを提供するモデル コンテキスト プロトコル サーバー。

  1. 特徴
    1. インストール
      1. 使用法
        1. サーバーの起動
        2. クライアントデモの使用
        3. APIを直接使用する
      2. 利用可能なツール
        1. Excel操作
        2. データフィルタリング
        3. データ分析
        4. データの可視化
        5. 更新操作
        6. 追加機能
      3. 利用可能なリソース
        1. 例: カスタムクライアントの作成
          1. AIモデルとの統合

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol (MCP) server that provides tools for reading Excel (xlsx) files, enabling extraction of data from entire workbooks or specific sheets with results returned in structured JSON format.
              Last updated -
              3
              5
              Apache 2.0
              • Linux
              • Apple
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.
              Last updated -
              6
              1,629
              510
              MIT License
              • Linux
              • Apple
            • A
              security
              A
              license
              A
              quality
              Enables seamless reading, writing, and analyzing of Excel files through Model Context Protocol, with features for worksheet management, structure analysis, and automated caching.
              Last updated -
              8
              102
              41
              MIT License
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that enables interaction with Microsoft 365 services (Excel, Calendar, Mail, OneDrive, Teams, etc.) through the Graph API, allowing AI assistants to manage Microsoft 365 resources via natural language.
              Last updated -
              2,971
              258
              MIT License

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/TapanKumarBarik/PYTHON-MCP'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server