Model Context Protocol (MCP) Server
LangChain / Python を使用した MCP クライアント
このシンプルなモデル コンテキスト プロトコル (MCP)クライアントは、LangChain ReAct Agent による MCP サーバー ツールの使用方法を示します。
これは、 langchain_mcp_toolsのユーティリティ関数convert_mcp_to_langchain_tools()を活用します。
この関数は、指定された複数の MCP サーバーの並列初期化を処理し、使用可能なツールを LangChain 互換ツールのリスト ( List[BaseTool] ) に変換します。
現在、Anthropic、OpenAI、Groq の LLM がサポートされています。
このMCPクライアントのTypescriptバージョンはここから入手できます。
前提条件
Related MCP server: OpenAI and Claude MCP
設定
依存関係をインストールします:
make installAPI キーの設定:
cp .env.template .env必要に応じて
.envを更新します。.gitignoreは、資格情報の誤ったコミットを防ぐために.env無視するように設定されています。
必要に応じて、LLM および MCP サーバーの設定
llm_mcp_config.json5を構成します。MCP サーバーの構成ファイル形式は、 Claude for Desktopと同じ構造に従いますが、1 つの違いがあります。キー名
mcpServersは、JSON 構成ファイルで一般的に使用される snake_case 規則に従うためにmcp_serversに変更されています。ファイル形式はJSON5で、コメントと末尾のコンマが許可されます。
形式はさらに拡張され、
${...}表記が対応する環境変数の値に置き換えられます。すべての資格情報と個人情報を
.envファイルに保存し、必要に応じて${...}表記で参照します。
使用法
アプリを実行します:
make start初回実行時には多少時間がかかります。
詳細モードで実行:
make start-vコマンドラインオプションを参照してください:
make start-hプロンプトで Enter キーを押すだけで、MCP サーバー ツールの呼び出しを実行するサンプル クエリを使用できます。
クエリの例はllm_mcp_config.json5で設定できます。
Available Tools
2 toolsget-alertsC
Get weather alerts for a US state
Inputs: state (required).
get-forecastB
Get weather forecast for a location in the US
Inputs: latitude (required), longitude (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The tools get-alerts and get-forecast have clearly distinct purposes: one provides weather alerts, the other gives forecasts. No overlap.
Both tool names follow the consistent pattern 'get-<resource>', using lowercase and hyphens, which is predictable.
With only 2 tools, the server feels too sparse for a weather domain. Typically, more operations like current conditions or radar would be expected.
The tool set only covers alerts and forecasts, missing common weather operations like current conditions, location search, or severe weather warnings, resulting in significant gaps.
Maintenance
Related MCP Connectors
AI routing, memory, guardrails, and governance. Routes across Claude, GPT, Gemini.
OpenAI-compatible BYOK LLM gateway: per-task routing, shadow evaluation, promotion gates.
Chat, image, video, and audio models from many vendors behind one remote MCP server and one key.
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceThis server provides an API to query Large Language Models using context from local files, supporting various models and file types for context-aware responses.1ISC
- AlicenseNot gradedqualityDmaintenanceA simple server that acts as a Master Control Program (MCP) for unified interaction with OpenAI and Anthropic (Claude) AI models through a single API endpoint.MIT
- AlicenseNot gradedqualityDmaintenanceA unified API server that enables interaction with multiple AI model providers like Anthropic and OpenAI through a consistent interface, supporting chat completions, tool calling, and context handling.ISC
- FlicenseAqualityDmaintenanceUnified MCP server for querying multiple LLM providers (Gemini, OpenAI, Anthropic, etc.) with advanced routing, cost optimization, and fallback resilience.2-