mcpcodeserver MCP Server
公式MCPツールを直接呼び出す代わりに、mcpcodeserverはMCPツール呼び出しをTypeScriptプログラムに変換し、LLMによるよりスマートで低レイテンシなオーケストレーションを実現します。
ドキュメント
mcpcodeserver
ツール呼び出しをTypeScriptコード生成に変換するModel Context Protocol (MCP) プロキシサーバーです。LLMは、複数のツール呼び出しを往復させる代わりに、複数のツールを自然に呼び出すTypeScriptコードを記述できるため、トークンオーバーヘッドを削減し、LLMの優れたコード生成能力を活用できます。
❌ mcpcodeserverを使用しない場合
LLMは複数の逐次的なツール呼び出しを行い、トークンを消費し、複雑なワークフローに苦戦します:
- ❌ LLMとツール間の複数回の往復
- ❌ 複雑なツール呼び出しシーケンスはエラーが発生しやすい
- ❌ ツール間でデータを簡単に受け渡せない
- ❌ 限定的なエラー処理と制御フロー
✅ mcpcodeserverを使用する場合
LLMは複数のツールを自然に呼び出すTypeScriptコードを記述します:
- ✅ 複数のツールを順次呼び出すコードを記述
- ✅ 変数、ループ、条件分岐を自然に使用
- ✅ try/catchによる優れたエラー処理
- ✅ 操作を組み合わせることでトークン使用量を削減
- ✅ LLMの強力なコード生成能力を活用
クイックスタート
- mcpcodeserverをインストール します(下記のインストールセクションを参照)
mcp.json設定ファイルを作成し、子MCPサーバーを定義します- 使い始める - LLMがツールを呼び出すTypeScriptコードを生成・実行できるようになります
// Instead of multiple tool calls, write code like this:
const files = await filesystem.list_directory({ path: "/tmp" });
const results = await Promise.all(
files.map(file => filesystem.read_file({ path: file.path }))
);
return results.filter(content => content.includes("important"));
概要
mcpcodeserver は、以下の特徴を持つユニークなMCPサーバーです:
- 1つ以上の子MCPサーバーに接続するMCPクライアントとして動作
- 子サーバーからすべてのツールを検出
- 親LLMクライアントに3つの強力なツールを公開:
list_servers- このMCPサーバーに接続されている利用可能なすべてのサブサーバーを一覧表示get_tool_definitions- 検出されたツールのTypeScript型定義を返します(サーバーでフィルタリング可能)generate_and_execute_code- サンドボックス内でそれらのツールを呼び出すTypeScriptコードを生成・実行
このアーキテクチャにより、LLMは逐次的なツール呼び出しを行う代わりにコードを記述することで、複雑なマルチツールワークフローを調整できます。これは最新の言語モデルにとって、より効率的で自然な方法です。
関連研究とリサーチ
このアプローチは、LLMが直接ツール呼び出しを行うよりも実行可能なコードを生成する方が優れたパフォーマンスを発揮することを示す最近の研究に触発されています:
-
CodeAct: Your LLM Agent Acts Better when Generating Code (Apple, ICML 2024) - LLMエージェントが、事前定義されたツール呼び出し形式ではなく、統一されたアクション空間として実行可能なPythonコードを使用する場合、最大20%高い成功率を達成することを実証しています。
-
Cloudflare Code Mode - MCPツールをTypeScript APIに変換する同様の実装で、「LLMはMCPを直接呼び出すよりも、MCPを呼び出すコードを記述する方が優れている」ことを示しています。
この研究からの重要な洞察は、LLMは実世界のコードに関する広範なトレーニングを受けている一方で、合成ツール呼び出し形式への露出は限られているため、複雑なエージェントワークフローではコード生成がより自然で効果的なアプローチになるということです。
なぜこれを使うのか?
従来のツール呼び出しの問題点
- LLMとツール間の複数回の往復がトークンを消費
- LLMは複雑なツール呼び出しシーケンスにしばしば苦戦
- 各ツール呼び出しにはJSONスキーマの理解とフォーマットが必要
- LLMを介さずにツール間でデータを簡単に受け渡せない
コード生成ソリューション
- 複数のツールを順次呼び出すTypeScriptコードを記述
- 変数、ループ、条件分岐を自然に使用
- try/catchによる優れたエラー処理
- 操作を組み合わせることでトークン使用量を削減
- LLMの強力なコード生成能力を活用
動的ツール検出
mcpcodeserverは子MCPサーバーのツール変更を自動的に監視し、ツールが追加、削除、または変更されたときに親クライアントに通知します:
- 自動更新: 30秒ごとにツールの変更をチェック
- リアルタイム通知: 親クライアントに
notifications/tools/list_changedを送信 - 動的更新: ツール定義とサマリーが自動的に更新
- 手動更新不要: 親LLMはツール知識を更新するための通知を受け取ります
これにより、親LLMは手動介入なしに常に最新のツール定義を利用できます。
サーバーフィルタリング
コンテキストウィンドウの使用量を削減し、集中力を高めるために、mcpcodeserverは特定のサーバーによるツール定義のフィルタリングをサポートしています:
- 利用可能なサーバーの一覧表示:
list_serversを使用して、接続されているすべてのサブサーバーを表示 - フィルタリングされたツール定義:
get_tool_definitionsとserver_namesパラメータを使用して、特定のサーバーのツールのみを取得 - 冗長性の削減: LLMのコンテキストウィンドウを圧迫せずに、焦点を絞ったTypeScript定義を取得
- メソッドの名前空間化: 生成されるすべての関数にはサーバー名のプレフィックスが付きます(例:
pizzashop_create_pizza、filesystem_read_file)
使用例:
// List available servers
const servers = await list_servers({});
// Returns: ["pizzashop", "filesystem", "memory"]
// Get all tool definitions
const allTools = await get_tool_definitions({});
// Get only pizzashop tools
const pizzashopTools = await get_tool_definitions({
server_names: ["pizzashop"]
});
高度なMCP機能
mcpcodeserverは、親サーバーと子サーバーの両方がサポートしている場合、高度なMCPプロトコル機能のパススルーをサポートします:
- Elicitation: 子サーバーはツール実行中にユーザー入力を要求でき、それが親クライアントにパススルーされます
- Roots: すべての子サーバーからのルートを一覧表示および集約し、利用可能なリソースの統一ビューを提供
- Sampling: 高度なAI機能のために、LLMサンプリングリクエストを子サーバーにパススルーできます
これらの機能は親クライアントに自動的に通知され、基盤となる子MCPサーバーがサポートしている場合にシームレスに動作します。
クイックスタート
npxですぐに試す(インストール不要):
# From GitHub
npx github:zbowling/mcpcodeserver --help
# Or when published to npm
npx mcpcodeserver --help
🛠️ インストール
要件
- Node.js >= v18.0.0
- Cursor、Claude Code、VSCode、Windsurf、またはその他のMCPクライアント
Smithery経由でのインストール
Smithery 経由で任意のクライアントにmcpcodeserverを自動インストールするには:
npx -y @smithery/cli@latest install mcpcodeserver --client <client-name> --key <smithery-key>
Cursorへのインストール
移動先: Settings -> Cursor Settings -> MCP -> Add new global MCP server
Cursorの ~/.cursor/mcp.json ファイルに以下の設定を貼り付けるのが推奨される方法です。プロジェクトフォルダに .cursor/mcp.json を作成して、特定のプロジェクトにインストールすることもできます。
Cursor ワンクリックインストール
Cursor ローカルサーバー接続
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
Cursor リモートサーバー接続(HTTPトランスポートを設定した場合)
{
"mcpServers": {
"mcpcodeserver": {
"url": "http://localhost:3000/mcp"
}
}
}
Claude Codeへのインストール
このコマンドを実行します。詳細は Claude Code MCP docs を参照してください。
Claude Code ローカルサーバー接続
claude mcp add mcpcodeserver -- npx -y mcpcodeserver --config /path/to/your/mcp.json
Claude Code リモートサーバー接続
claude mcp add --transport http mcpcodeserver http://localhost:3000/mcp
VSCodeへのインストール
VSCode ワンクリックインストール
VSCode 手動設定
VSCodeのMCP設定に追加:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
Windsurfへのインストール
Windsurf ワンクリックインストール
AIコーディングアシスタントへのインストール
Continue、Cline、RooCode の場合、設定に追加:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
Ampへのインストール
ターミナルでこのコマンドを実行します。詳細は Amp MCP docs を参照してください。
amp mcp add mcpcodeserver -- npx -y mcpcodeserver --config /path/to/your/mcp.json
テキストエディタへのインストール
Aider、Codium、Zed、Nova、Sublime Text の場合、設定に追加:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
Neovimへのインストール
NeovimのMCP設定に追加:
{
mcpServers = {
mcpcodeserver = {
command = "npx",
args = {"-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"}
}
}
}
Emacsへのインストール
EmacsのMCP設定に追加:
(setq mcp-servers
'((mcpcodeserver
:command "npx"
:args ("-y" "mcpcodeserver" "--config" "/path/to/your/mcp.json"))))
JetBrains IDEへのインストール
IntelliJ IDEA、WebStorm、PyCharm、Android Studio の場合、MCP設定に追加:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
AIツールへのインストール
Codeium、Tabnine、GitHub Copilot、Amazon CodeWhisperer の場合、MCP設定に追加:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
クラウドIDEへのインストール
Replit、CodeSandbox、StackBlitz、GitPod、GitHub Codespaces、GitLab Web IDE、Bitbucket Cloud の場合、MCP設定に追加:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
その他のツールへのインストール
Xcode、Fleet、Sourcegraph、JetBrains Gateway の場合、MCP設定に追加:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
リモート開発へのインストール
リモート開発環境では、HTTPトランスポートも使用できます:
{
"mcpServers": {
"mcpcodeserver": {
"url": "http://your-server:3000/mcp"
}
}
}
設定ファイル
mcp.json 設定ファイルを作成して、子MCPサーバーを定義します:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
"env": { "DEBUG": "false" }
},
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
},
"brave-search": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": { "BRAVE_API_KEY": "your-api-key" }
}
}
}
開発用インストール
# Install dependencies (using Bun for faster performance)
bun install
# Or with npm
npm install
# Build the project
bun run build
# Test the built server
bun dist/index.js --help
注意: このプロジェクトはパフォーマンス向上のためBunを使用していますが、npm/nodeでも問題なく動作します。
🚨 トラブルシューティング
モジュールが見つからないエラー
ERR_MODULE_NOT_FOUND が発生した場合は、npx の代わりに bunx を使用してみてください:
{
"mcpServers": {
"mcpcodeserver": {
"command": "bunx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
ESM解決の問題
Error: Cannot find module のようなエラーの場合は、--experimental-vm-modules フラグを試してください:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-vm-modules", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
TLS/証明書の問題
--experimental-fetch フラグを使用して、TLS関連の問題を回避します:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-fetch", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
}
}
}
一般的なMCPクライアントエラー
- パッケージ名に
@latestを追加してみる npxの代わりにbunxを使用する- 別の代替として
denoの使用を検討する - ネイティブfetchサポートのためにNode.js v18以上を使用していることを確認する
設定の問題
mcp.jsonファイルが有効なJSONであることを確認- すべての子サーバーコマンドがPATHで利用可能であることを確認
- 子サーバーが独立して起動できることを確認
- 設定ファイルパスのファイル権限を確認
MCP Inspectorでのテスト
npx -y @modelcontextprotocol/inspector npx mcpcodeserver --config /path/to/your/mcp.json
💻 開発
CLI引数
mcpcodeserver は以下のCLIフラグを受け付けます:
--config <path>– MCP設定ファイルへのパス(デフォルト:./mcp.json)--transport <stdio|http>– 使用するトランスポート(デフォルトはstdio)。HTTPトランスポートは自動的にHTTPとSSEの両方のエンドポイントを提供することに注意してください--port <number>–httpトランスポート使用時にリッスンするポート(デフォルト3000)--help– ヘルプメッセージを表示
HTTPトランスポートとポート8080の例:
npx mcpcodeserver --config /path/to/mcp.json --transport http --port 8080
stdioトランスポートの例:
npx mcpcodeserver --config /path/to/mcp.json --transport stdio
環境変数
設定に環境変数を使用できます:
MCP_CONFIG_PATH– MCP設定ファイルへのパス(--configの代替)MCP_TRANSPORT– トランスポートタイプ(--transportの代替)MCP_PORT– HTTPトランスポートのポート番号(--portの代替)
環境変数を使用した例:
# .env
MCP_CONFIG_PATH=/path/to/your/mcp.json
MCP_TRANSPORT=stdio
環境変数を使用したMCP設定例:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver"],
"env": {
"MCP_CONFIG_PATH": "/path/to/your/mcp.json"
}
}
}
}
注意: CLIフラグと環境変数の両方が提供された場合、CLIフラグが優先されます。
ローカル開発設定
ローカル開発では、TypeScriptソースを直接実行できます:
{
"mcpServers": {
"mcpcodeserver": {
"command": "npx",
"args": ["tsx", "/path/to/mcpcodeserver/src/index.ts", "--config", "/path/to/your/mcp.json"]
}
}
}
実行モード
Stdioモード(デフォルト)
サーバーはデフォルトでstdioモードで実行され、Claude DesktopなどのMCPクライアントとの統合に最適です:
# Run in stdio mode
npx mcpcodeserver --config mcp.json
# Or with custom config path
npx mcpcodeserver --config /path/to/your/mcp.json
HTTPモード
デバッグ、テスト、またはWebベースのMCPクライアントとの統合のために、サーバーをHTTPモードで実行できます:
# Run in HTTP mode on default port 3000
npx mcpcodeserver --http --config mcp.json
# Run on custom port and host
npx mcpcodeserver --http --port 8080 --host 0.0.0.0 --config mcp.json
HTTPモードで実行中、サーバーは以下で利用可能になります:
- サーバーURL:
http://localhost:3000/mcp(またはカスタムのhost:port) - MCP Inspector:
npx @modelcontextprotocol/inspector http://localhost:3000/mcpを使用してデバッグとテストを行います
MCP Inspector統合
MCP Inspectorは、MCPサーバーのデバッグとテストのための強力なツールです。HTTPモードで実行中に、以下が可能です:
- 利用可能なツールとそのスキーマの検査
- ツール呼び出しのインタラクティブなテスト
- リソースアクセスとプロンプトのデバッグ
- リアルタイム通知の監視
# Start the server in HTTP mode
npx mcpcodeserver --http --config mcp.json
# In another terminal, start the MCP Inspector
npx @modelcontextprotocol/inspector http://localhost:3000/mcp
# Or use the shorthand script (includes all example servers)
npm run inspector
インスペクターはブラウザで開き、MCPサーバーの探索とテストのための完全なインターフェースを提供します。
注意: npm run inspector コマンドは mcp-test.json を使用します。これには、公式例 からのTypeScript(npx)およびPython(uvx)ベースのサーバーを含む、8つのMCPサーバー(合計67ツール)が含まれています。
設定
接続する子 MCP サーバーを定義する mcp.json ファイルを作成します。これは標準の MCP クライアント設定形式に従います。
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
"env": {
"DEBUG": "false"
}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here"
}
},
"weather": {
"url": "http://localhost:3000/mcp",
"transport": "sse"
}
}
}
設定オプション
各サーバーエントリは以下をサポートします。
stdio トランスポートの場合:
command(必須) - 実行するコマンド (例: "node"、"python"、"npx")args(オプション) - コマンドに渡す引数の配列env(オプション) - 子プロセスの環境変数
HTTP/SSE トランスポートの場合:
url(必須) - HTTP エンドポイント URLtransport- Server-Sent Events の場合は "sse" に設定
使用方法
サーバーの起動
# Use default config (./mcp.json)
mcpcodeserver
# Use custom config location
mcpcodeserver --config /path/to/custom-mcp.json
# Show help
mcpcodeserver --help
MCP サーバーとしての使用
MCP クライアント (Claude Desktop、Claude Code、Cline など) で mcpcodeserver を設定します。
npx を使用する場合 (推奨 - インストール不要):
{
"mcpServers": {
"codeserver": {
"command": "npx",
"args": ["-y", "mcpcodeserver", "--config", "/path/to/mcp.json"]
}
}
}
GitHub から使用する場合 (すぐに動作します):
{
"mcpServers": {
"codeserver": {
"command": "npx",
"args": ["-y", "github:zbowling/mcpcodeserver", "--config", "/path/to/mcp.json"]
}
}
}
他のパッケージマネージャーを使用する場合:
// yarn
{ "command": "yarn", "args": ["dlx", "mcpcodeserver", "--config", "/path/to/mcp.json"] }
// pnpm
{ "command": "pnpm", "args": ["dlx", "mcpcodeserver", "--config", "/path/to/mcp.json"] }
// bun
{ "command": "bunx", "args": ["mcpcodeserver", "--config", "/path/to/mcp.json"] }
その他の設定例や MCP クライアント固有のセットアップについては、examples/ を参照してください。
ツール 1: get_tool_definitions
このツールは、子サーバーから検出されたすべてのツールの TypeScript 型定義を返します。
入力:
include_examples(オプションのブール値) - 使用例を含めるかどうか
例:
// Call the tool (in your MCP client)
get_tool_definitions({ include_examples: true })
出力: インターフェースと関数宣言を含む TypeScript コードを返します。
/**
* Auto-generated TypeScript definitions for MCP tools
*/
interface ToolResult {
content: Array<{
type: string;
text?: string;
// ...
}>;
isError?: boolean;
}
/**
* Read contents of a file
* Server: filesystem
* Tool: read_file
*/
interface ReadFileParams {
path: string;
}
declare function filesystem_read_file(params: ReadFileParams): Promise<ToolResult>;
// ... more tool definitions
ツール 2: generate_and_execute_code
このツールは、検出されたすべてのツール関数にアクセスできるサンドボックス内で TypeScript コードを実行します。
入力:
code(必須の文字列) - 実行する TypeScript/JavaScript コードtimeout(オプションの数値) - 最大実行時間 (ミリ秒) (デフォルト: 30000、最大: 300000)
例:
// Call the tool with TypeScript code
generate_and_execute_code({
code: `
// Read multiple files and combine them
const file1 = await filesystem_read_file({ path: "/tmp/file1.txt" });
const file2 = await filesystem_read_file({ path: "/tmp/file2.txt" });
const text1 = file1.content[0].text;
const text2 = file2.content[0].text;
console.log("File 1 length:", text1.length);
console.log("File 2 length:", text2.length);
return {
combined: text1 + text2,
totalLength: text1.length + text2.length
};
`
})
出力:
=== Console Output ===
File 1 length: 42
File 2 length: 38
=== Result ===
{
"combined": "...",
"totalLength": 80
}
サンドボックス環境
TypeScript 実行サンドボックスは以下を提供します。
利用可能:
- 検出されたすべてのツール関数 (非同期関数として)
- コンソールメソッド:
console.log()、console.error()、console.warn()、console.info() - 基本的な JavaScript グローバル:
Math、JSON、Date、Array、Object、String、Number、Boolean - Promise と async/await のサポート
- try/catch によるエラーハンドリング
- タイマー:
setTimeout、setInterval、clearTimeout、clearInterval
利用不可:
- Node.js モジュール (fs、http、child_process など)
- ファイルシステムアクセス (MCP ツール経由を除く)
- ネットワークアクセス (MCP ツール経由を除く)
- プロセス情報
セキュリティに関する注意: これは完全に安全なサンドボックスではありません。VM コンテキストは分離を提供しますが、完全無欠ではありません。信頼できるコードのみを実行してください。
エラーハンドリング
サンドボックス内のエラーはキャッチされ、スタックトレースと共に返されます。
generate_and_execute_code({
code: `
try {
const result = await filesystem_read_file({ path: "/nonexistent" });
return result;
} catch (error) {
console.error("Failed to read file:", error.message);
throw error; // Re-throw to surface to parent
}
`
})
Claude Code でのテスト
mcpcodeserver を Claude Code で試してみませんか?ワンコマンドセットアップを使用します。
./setup-claude-code-test.sh
これにより、プロジェクトがビルドされ、テスト依存関係がインストールされ、Claude Code 設定に追加する内容が正確に表示されます。詳細な手順については、TESTING_WITH_CLAUDE.md を参照してください。
開発
# Install dependencies
bun install
# Build the project
bun run build
# Watch mode for development
bun run dev
# Run the server
bun start
# Run tests
bun test # All tests
bun run test:unit # Unit tests only
bun run test:integration # Integration tests (requires Python)
# Code quality
bun run lint # Check linting
bun run format # Format code
bun run typecheck # Type checking
プロジェクト構造
詳細なプロジェクト構造とコンポーネントのドキュメントについては、AGENTS.md を参照してください。
ユースケース
複数ファイル操作
LLM を通じて複数のツール呼び出しを行う代わりに、コードを記述します。
const files = ["/tmp/a.txt", "/tmp/b.txt", "/tmp/c.txt"];
const contents = await Promise.all(
files.map(path => filesystem_read_file({ path }))
);
return contents.map(r => r.content[0].text);
データ変換
LLM の介入なしにツール呼び出し間でデータを処理します。
const data = await api_fetch({ url: "https://api.example.com/data" });
const json = JSON.parse(data.content[0].text);
const filtered = json.items.filter(item => item.active);
return filtered.length;
条件付きロジック
ツールの結果に基づいて判断を行います。
const exists = await filesystem_read_file({ path: "/tmp/config.json" });
if (exists.isError) {
console.log("Config doesn't exist, using defaults");
return { source: "defaults" };
} else {
return { source: "file", config: JSON.parse(exists.content[0].text) };
}
エラーリカバリ
ワークフロー全体を中断することなく、エラーを適切に処理します。
const results = [];
for (const path of ["/tmp/a.txt", "/tmp/b.txt", "/tmp/c.txt"]) {
try {
const content = await filesystem_read_file({ path });
results.push({ path, success: true, data: content });
} catch (error) {
results.push({ path, success: false, error: error.message });
}
}
return results;
アップストリーム MCP サーバー統合
mcpcodeserver は、Model Context Protocol servers リポジトリ の公式アップストリーム MCP サーバーと統合できます。これにより、カスタムツールと共に、本番環境で使用可能な MCP サーバーを利用できます。
サポートされているアップストリームサーバー
- filesystem: ファイルシステム操作 (読み取り、書き込み、ディレクトリ一覧)
- memory: インメモリのキー・バリューストア
- sqlite: SQLite データベース操作
- github: GitHub API 統合
- brave-search: Web 検索機能
- fetch: HTTP リクエスト機能
設定例
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
},
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
},
"sqlite": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "/tmp/test.db"]
}
}
}
アップストリーム統合のテスト
このプロジェクトには、アップストリームサーバー統合の包括的なテストが含まれています。
# Run upstream servers integration tests
bun tests/integration/run-upstream-tests.ts
# Or manually test with upstream config
npx mcpcodeserver --config tests/integration/upstream-test-config.json
クロスサーバーワークフロー
アップストリームサーバーを使用すると、強力なクロスサーバーワークフローを作成できます。
// Store database query results in memory and write to file
const queryResult = await sqlite_execute_sql({
sql: "SELECT COUNT(*) as count FROM users"
});
const count = queryResult.content[0].text;
await memory_create({
key: "user-count",
value: count
});
await filesystem_write_file({
path: "/tmp/user-count.txt",
content: `Total users: ${count}`
});
制限事項
- 実行タイムアウト: 最大 5 分 (設定可能、デフォルト 30 秒)
- メモリ: Node.js VM コンテキストによる制限
- 実行間での永続的な状態は保持されません
- 外部モジュールの require/import は不可
- セキュリティサンドボックスではありません - 信頼できないコードを実行しないでください
コントリビューション
コントリビューションを歓迎します!このプロジェクトは以下で構築されています。
- TypeScript 5.7+
- Node.js 18+
- MCP TypeScript SDK 1.20+
- バリデーションに Zod を使用
詳細なコントリビューションガイドラインについては、CONTRIBUTING.md を参照してください。
サポート
このプロジェクトが役に立ったと思われたら、コーヒーをおごってください!
ライセンス
MIT