mcpField
U
Unstructured API MCP Server for Research Paper Data Processing

Unstructured API MCP Server for Research Paper Data Processing

ローカル
github.com/HeetVekariyaデータ・分析283 週間前に更新

Unstructured API MCP Server for Research Paper Data Processing について

Unstructured APIで研究論文を処理し、情報を抽出するMCPサーバーです。文献レビューやLLMのファインチューニング用データを扱う研究者向けで、Google DriveのPDF読み込みとMongoDBへの接続に対応します。

主な機能

  1. 01研究論文からの情報抽出
  2. 02Unstructured APIによる処理
  3. 03Google DriveのPDF読み込み
  4. 04MongoDBへの接続
  5. 05ローカルHTTP・SSEテスト

活用シーン

  1. 01研究論文からの情報抽出
  2. 02LLMのファインチューニング用データ準備
  3. 03MCPクライアントでのローカルサーバーテスト

MCP 対応

研究論文の処理機能をMCPクライアントに提供します。READMEにはローカルのstdio設定と、最小構成のクライアント向けHTTP + SSE接続が記載されています。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

研究論文データ処理用 Unstructured API MCP サーバー

Unstructured API を活用することで、このサーバーは研究論文から有用な情報を抽出する強力なツール群に簡単にアクセスできるようにします。抽出した情報は、研究者の文献レビューにかかる時間を短縮するため、言語モデル(LLM)のファインチューニングに利用できます。

ブログはこちら:

目次:

  1. セットアップ
  2. 要件
  3. プロジェクトのフロー
  4. 利用可能なツール
  5. 手順に沿って進める
  6. Claude Desktop との統合
  7. デバッグツール
  8. サーバーを使って最小限のクライアントをローカルで実行する

セットアップ

依存関係をインストールします:

  • uv add "mcp[cli]"
  • uv pip install --upgrade unstructured-client python-dotenv

または、uv sync を使用します。

要件

UNS_MCP プロジェクトの作業を始める前に、以下の準備ができていることを確認してください:

  1. UNSTRUCTURED_API_KEY

    • ドキュメント処理用の API にアクセスするため、Unstructured platform から API キーを取得します。
  2. GOOGLEDRIVE_SERVICE_ACCOUNT_KEY

    • Google Drive から PDF を読み取れるよう、Google Cloud プロジェクトを設定してサービスアカウントを作成します。設定手順はこちらをご確認ください。
    • サービスアカウントの JSON 認証情報を保存し、GOOGLEDRIVE_SERVICE_ACCOUNT_KEY の設定に使用します。
  3. MONGO_DB_CONNECTION_STRING

    • MongoDB データベース(クラウド)を設定し、データベースへの接続文字列を取得します。設定手順はこちらをご確認ください。
  4. .env.template

    • .env.template ファイルには、必要な環境変数がすべて含まれています。このファイルを .env にコピーし、上記のキーに必要な値を設定します。

    .env ファイルの例:

    UNSTRUCTURED_API_KEY="<key-here>"
    MONGO_DB_CONNECTION_STRING="<CONNECTION_STRING>"
    GOOGLEDRIVE_SERVICE_ACCOUNT_KEY="<converted string>"
    
    

Project Flow

  1. User Query to MCP Client

  2. Claude Interacts with UNS_MCP Server

    • Claude forwards the user's query to the custom MCP server named UNS_MCP.
  3. MCP Tool Executes Unstructured API

    • UNS_MCP interacts with the Unstructured API to process the research paper PDF, extract relevant information, and convert it into structured JSON data.
  4. Structured Data (JSON) Output is stored in the destination source

    • The result from the Unstructured API is transformed into JSON format, which can then be further utilized to fine-tune LLMs, helping researchers quickly find the relevant information without manually reading the entire paper.

README の画像

README の画像

Available Tools

ToolDescription
list_sourcesLists available sources from the Unstructured API.
get_source_infoGet detailed information about a specific source connector.
create_gdrive_sourceCreate a google drive source connector.
update_gdrive_sourceUpdate an existing google source connector by params.
delete_gdrive_sourceDelete a source connector by source id.
list_destinationsLists available destinations from the Unstructured API.
get_destination_infoGet detailed info about a specific destination connector. Currently, we have s3/weaviate/astra/neo4j/mongo DB (more to come!)
create_mongodb_destinationCreate a mongodb destination connector by params.
update_mongodb_destinationUpdate an existing mongodb destination connector by destination id.
delete_mongodb_destinationDelete a mongodb destination connector by destination id.
list_workflowsLists workflows from the Unstructured API.
get_workflow_infoGet detailed information about a specific workflow.
create_workflowCreate a new workflow with source, destination id, etc.
run_workflowRun a specific workflow with workflow id
update_workflowUpdate an existing workflow by params.
delete_workflowDelete a specific workflow by id.
list_jobsLists jobs for a specific workflow from the Unstructured API.
get_job_infoGet detailed information about a specific job by job id.
cancel_jobDelete a specific job by id.

Follow Along

1. Set Up Required Connectors
Google Drive Source Connector:
  • Create a Google Drive Source Connector to connect your service account with Google Drive and retrieve PDFs.
  • Test the connection to ensure accessibility.
MongoDB Destination Connector:
  • Set up the MongoDB Destination Connector to store processed data.
  • Test the connection to ensure accessibility.

2. Develop the Workflow
  1. Define Connectors: Set up the Google Drive source and MongoDB destination connectors.

  2. Partitioning: Use Auto partitioning for optimal document splitting.

  3. Chunking: Apply by-page chunking for manageable text segments.

  4. Enrichment: Use NER to extract entities and table enrichment for any tables.

  5. Embedding: Convert text into embeddings for querying or analysis.

Note: Tweak the Flow: Adjust any step (partitioning, chunking, enrichment, embedding) as needed.


3. Set Up Claude Desktop
  1. Install Claude Desktop and integrate it with the UNS_MCP server by following steps given below.
  2. Restart Claude to link with the MCP server and ensure workflow functionality.

4. Query and Run the Workflow
  • Use Claude to interact with the system and execute queries to list, create, edit, delete and run the workflow. You can perform many such tasks, go through Available Tools given above.
5. Results

README の画像 README の画像 README の画像

Claude Desktop Integration

To install in Claude Desktop:

  1. Go to claude_desktop_config.json by running the below command.
# For macOS or Linux:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json

# For Windows:
code $env:AppData\Claude\claude_desktop_config.json
  1. そのファイルに以下を追加します:
{
    "mcpServers":
    {
        "UNS_MCP":
        {
            "command": "ABSOLUTE/PATH/TO/.local/bin/uv",
            "args":
            [
                "--directory",
                "ABSOLUTE/PATH/TO/YOUR-UNS-MCP-REPO/uns_mcp",
                "run",
                "server.py"
            ],
            "env":
            [
            "UNSTRUCTURED_API_KEY":"<your key>"
            ],
            "disabled": false
        }
    }
}
  1. Claude Desktop を再起動します。

  2. Claude Desktop で発生する問題の例。

    • 宛先コネクターの一覧を問い合わせると、No destinations found と表示されます。.env または設定 JSON の API キーを確認してください。https://platform.unstructured.io/app/account/api-keys にある個人用キーを指定する必要があります。

デバッグツール

Anthropic は、MCP サーバーのデバッグ/テスト用に MCP Inspector ツールを提供しています。以下のコマンドを実行して、デバッグ用 UI を起動します。左側のペインで環境変数(ローカル環境を参照するもの)を追加できます。個人用 API キーも環境変数として指定してください。tools に移動すると、MCP サーバーに追加した機能をテストできます。

mcp dev uns_mcp/server.py

UnstructuredClient へのリクエスト呼び出しパラメーターをログに記録するには、環境変数 DEBUG_API_REQUESTS=false を設定します。 ログは unstructured-client-{date}.log という形式のファイルに保存されます。このファイルを確認して、UnstructuredClient 関数へのリクエスト呼び出しパラメーターをデバッグできます。

HTTP + SSE 経由でローカルの MCP サーバーにアクセスする、ローカル実行の最小クライアント

主な違いは、開発中にサーバー側でブレークポイントを設定しやすくなることです。クライアントとサーバーが分離されています。

# in one terminal, run the server:
uv run python uns_mcp/server.py --host 127.0.0.1 --port 8080

or
make sse-server

# in another terminal, run the client:
uv run python minimal_client/client.py "http://127.0.0.1:8080/sse"
or
make sse-client

ヒント:まずクライアントで ctrl+c を押して終了し、その後サーバーを終了してください。そうしないと、サーバーがハングしたように見えます。

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。