mcpField
M
mcp-tool-server-milvus

mcp-tool-server-milvus

ローカル
github.com/yhwangデータベース071 週間前に更新

mcp-tool-server-milvus について

mcp-tool-server-milvusは、MCPクライアントをMilvusベクトルデータベースに接続し、テキストの挿入と検索を行います。デフォルトのデータベースとコレクションを作成し、環境変数で名前を設定できます。

主な機能

  1. 01単一テキストの挿入
  2. 02複数テキストの一括挿入
  3. 03保存済みテキストの検索
  4. 04データベース名とコレクション名の設定

活用シーン

  1. 01テキストをMilvusコレクションに保存
  2. 02クエリでテキストレコードを検索
  3. 03MCPツール用のデフォルトコレクションを設定

MCP 対応

Streamable HTTP経由で、insert、insert-multiple、searchの3つのツールをMCPクライアントに公開します。

設定

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

mcp.json · 共通設定
{
"mcpServers": {
"tool-server-milvus": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"compose"
]
}
}
}
起動コマンドdocker run -i --rm compose

ローカルサーバーにはマシン上の実行環境(Node.js 18 以上など)が必要です。設定ファイルの場所はクライアントごとに異なります。

パッケージ
ocicompose

ツール

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

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

詳細

mcp-tool-server-milvus

Milvus ベクトルデータベースへのデータの挿入と検索を行うツールを提供する MCP サーバーです。

デフォルトでは、サーバーがデータベースとコレクションを作成します。挿入ツールと検索ツールは、デフォルトのデータベースとコレクションを操作します。以下の環境変数を使用して、データベースとコレクションを設定できます。

  • MILVUS_DB:Milvus データベースの名前です。デフォルトは mcp_db です。存在しない場合はデータベースが作成されます。
  • MILVUS_COLLECTION:Milvus コレクションの名前です。デフォルトは full_text_search です。 存在しない場合はコレクションが作成されます。

MCP サーバーを実行する

docker compose を使用してサーバーを起動します。

docker compose up -d

これにより、バックエンドとして Milvus を使用する MCP サーバーが起動します。サーバーは http://localhost:3000 で利用できます。

MCP-Cli を使用して MCP サーバーとやり取りする

mcp-cli コマンドラインツールを使用して、MCP サーバーとやり取りすることもできます。使用するには、次のコマンドを実行します。

npx @wong2/mcp-cli --url http://localhost:3000/mcp

これにより、ストリーム可能な HTTP 経由で MCP サーバーに接続します。利用可能なツールの一覧が表示され、JSON 引数を指定してツールを呼び出せます。例:

$ npx @wong2/mcp-cli --url http://localhost:3000/mcp
✔ Connected, server capabilities: tools
? Pick a primitive ›
❯   tool(insert-multiple) - insert the texts into the collection
    tool(insert) - insert the text into the collection
    tool(search) - search the text in the collection

カーソルを使って一覧を移動し、目的のプリミティブを選択できます。次に、選択したプリミティブの引数を入力するよう求められます。

  • tool(insert-multiple) の場合、引数として文字列の JSON 配列を入力できます。ただし、MCP-Cli はまだこれをサポートしていません。このツール API を操作するには、@modelcontextprotocol/sdk パッケージの simpleStreamableHttp の例を使用できます。
  • tool(insert) の場合、引数として文字列を入力すると、単一のテキスト文字列をコレクションに挿入できます。
  • tool(search) の場合、引数として文字列を入力すると、コレクション内のテキストを検索し、一致する結果を返します。

simpleStreamableHttp の例を使用する

MCP typescript-sdk リポジトリのシンプルなストリーム可能 HTTP クライアントを使用して、MCP サーバーとやり取りできます: https://github.com/modelcontextprotocol/typescript-sdk.git

使用方法は次のとおりです:

git clone https://github.com/modelcontextprotocol/typescript-sdk.git
cd typescript-sdk
npm install
npx tsx src/examples/client/simpleStreamableHttp.ts

デフォルトでは、クライアントは http://localhost:3000 に接続し、次の出力が表示されます:

MCP Interactive Client
=====================
Connecting to http://localhost:3000/mcp...
Transport created with session ID: 44dff10f-89bc-4965-b280-e1df3eb56a51
Connected to MCP server

Available commands:
  connect [url]              - Connect to MCP server (default: http://localhost:3000/mcp)
  disconnect                 - Disconnect from server
  terminate-session          - Terminate the current session
  reconnect                  - Reconnect to the server
  list-tools                 - List available tools
  call-tool <name> [args]    - Call a tool with optional JSON arguments
  greet [name]               - Call the greet tool
  multi-greet [name]         - Call the multi-greet tool with notifications
  start-notifications [interval] [count] - Start periodic notifications
  list-prompts               - List available prompts
  get-prompt [name] [args]   - Get a prompt with optional JSON arguments
  list-resources             - List available resources
  help                       - Show this help
  quit                       - Exit the program

>

次に、対話型プロンプトモードになります。別の MCP サーバーに接続するには、connect [url] と入力して Enter キーを押します。

list-tools コマンドを使用すると、利用可能なすべてのツールを一覧表示できます。利用可能なツールは 3 つです:

> list-tools
Available tools:
  - insert-multiple: insert the texts into the collection
  - insert: insert the text into the collection
  - search: search the text in the collection

call-tool <name> コマンドを使用すると、オプションで JSON 引数を指定してツールを呼び出せます。たとえば、insert-multiple ツールを呼び出して複数のテキストをコレクションに挿入する方法は次のとおりです:

> call-tool insert-multiple {"texts": ["call-tool <name> [args]: Call a tool with optional JSON arguments", "list-prompts: List available prompts"]}
Calling tool 'insert-multiple' with args: {
  texts: [
    'call-tool <name> [args]: Call a tool with optional JSON arguments',
    'list-prompts: List available prompts'
  ]
}
Tool result:
  2

数値 2 は、挿入操作によって 2 件のレコードがコレクションに挿入されたことを示します。

コメント

MCP は初めてですか?

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

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