MCP LLM
LlamaIndexTS ライブラリを使用して LLM へのアクセスを提供する MCP サーバー。

特徴
この MCP サーバーは次のツールを提供します。
generate_code
: 説明に基づいてコードを生成するgenerate_code_to_file
: コードを生成し、特定の行番号でファイルに直接書き込みます。generate_documentation
: コードのドキュメントを生成するask_question
: LLMに質問する


インストール
Smithery経由でインストール
Smithery経由で Claude Desktop 用の LLM サーバーを自動的にインストールするには:
npx -y @smithery/cli install @sammcj/mcp-llm --client claude
ソースからの手動インストール
- リポジトリをクローンする
- 依存関係をインストールします:
- プロジェクトをビルドします。
- MCP構成を更新する
サンプルスクリプトの使用
リポジトリには、MCP サーバーをプログラムで使用する方法を示すサンプル スクリプトが含まれています。
node examples/use-mcp-server.js
このスクリプトは MCP サーバーを起動し、curl コマンドを使用してサーバーにリクエストを送信します。
例
コードを生成する
{
"description": "Create a function that calculates the factorial of a number",
"language": "JavaScript"
}
ファイルにコードを生成
{
"description": "Create a function that calculates the factorial of a number",
"language": "JavaScript",
"filePath": "/path/to/factorial.js",
"lineNumber": 10,
"replaceLines": 0
}
generate_code_to_file
ツールは、相対パスと絶対パスの両方をサポートします。相対パスを指定した場合、MCP サーバーの現在の作業ディレクトリを基準として解決されます。
ドキュメントを生成する
{
"code": "function factorial(n) {\n if (n <= 1) return 1;\n return n * factorial(n - 1);\n}",
"language": "JavaScript",
"format": "JSDoc"
}
質問する
{
"question": "What is the difference between var, let, and const in JavaScript?",
"context": "I'm a beginner learning JavaScript and confused about variable declarations."
}
ライセンス