Remote-MCP

by RemoteMCP
MIT License

Integrations

  • Supports deploying the remote MCP server on Cloudflare Workers, allowing for globally distributed MCP functionality with low latency

  • Planned integration with NestJS framework mentioned in the roadmap for enhanced server-side implementation options

  • Provides a standalone Node.js implementation option for hosting the remote MCP server

リモートMCP: リモートモデルコンテキストプロトコル

リモート MCP 通信用の型安全で双方向のシンプルなソリューション。モデル コンテキストのリモート アクセスと集中管理を可能にします。

建築

私がこれを作った理由(今)

はい、公式のMCPロードマップには2025年第1四半期にリモートMCPサポートが含まれていることは承知しています。しかし、リモートアクセスの必要性は私にとって、そしておそらく多くの人にとって差し迫ったものでした。このライブラリは、そのギャップを埋めるために作成されました。将来の公式実装を待つことなく、ローカルMCPクライアントからリモートMCPサーバーに今すぐ接続する方法を提供します。

注:これを複雑すぎるものにしたくはありません。今のところはこの方法でうまくいっています

はじめる

注: このプロジェクトは現在開発中であり、実験段階です。変更や潜在的な問題が発生する可能性があります。

クライアントの使用状況

公開パッケージを使用する

MCP クライアント設定に次のコードを入力するだけです。ここでは、例として Claude を使用しています。

{ "mcpServers": { "remote-mcp": { "command": "npx", "args": ["-y", "@remote-mcp/client"], "env": { "REMOTE_MCP_URL": "http://localhost:9512", "HTTP_HEADER_Authorization": "Bearer <token>" } } } }

独自のローカル MCP サーバーをコーディングする

インストール要件:

$ npm install @remote-mcp/client @trpc/client@next zod

次に、次のような独自のコードを記述します。

import { RemoteMCPClient } from "@remote-mcp/client"; const client = new RemoteMCPClient({ remoteUrl: "http://localhost:9512", onError: (method, error) => console.error(`Error in ${method}:`, error) }); void client.start();

サーバーの使用(リモート MCP 実装)

いくつかの例はexamplesディレクトリで参照できます。

独自のリモート MCP サーバーをコーディングする

npm install @remote-mcp/server実行すると、次のようにして独自のリモート MCP サーバーを作成できます。

import { MCPRouter, LogLevel } from "@remote-mcp/server"; import { createHTTPServer } from '@trpc/server/adapters/standalone'; import { z } from "zod"; // Create router instance const mcpRouter = new MCPRouter({ logLevel: LogLevel.DEBUG, name: "example-server", version: "1.0.0", capabilities: { logging: {}, }, }); // Add example tool mcpRouter.addTool( "calculator", { description: "Perform basic calculations. Add, subtract, multiply, divide. Invoke this every time you need to perform a calculation.", schema: z.object({ operation: z.enum(["add", "subtract", "multiply", "divide"]), a: z.string(), b: z.string(), }), }, async (args) => { const a = Number(args.a); const b = Number(args.b); let result: number; switch (args.operation) { case "add": result = Number(a) + b; break; case "subtract": result = a - b; break; case "multiply": result = a * b; break; case "divide": if (b === 0) throw new Error("Division by zero"); result = a / b; break; } return { content: [{ type: "text", text: `${result}` }], }; }, ); const appRouter = mcpRouter.createTRPCRouter(); void createHTTPServer({ router: appRouter, createContext: () => ({}), }).listen(Number(process.env.PORT || 9512));

すると、MCP クライアントで次のように表示されます。

パッケージ

このリポジトリには次のものが含まれます。

  • @remote-mcp/client : ローカル MCP サーバーとして機能し、リモート実装に接続するクライアント ライブラリ。
  • @remote-mcp/server : リモートからアクセス可能な MCP サービスを作成するためのサーバー ライブラリ (リモート実装として使用)。

ロードマップ

コア機能

  • [x] 基本的な型安全なクライアント/サーバー通信
    • [x] 基本的なMCPコマンドのサポート
    • [x] 基本的なMCPツールのサポート
    • [x] 基本的なMCPプロンプトのサポート
    • [ ] クラッシュセーフハンドリング(WIP、最優先事項)
  • [ ] 完全なイベントサブスクリプションシステム
    • [ ] リソース変更通知
    • [ ] ツール/プロンプトリストの変更通知
  • [ ] HTTPヘッダーのサポート
    • [x] カスタムヘッダー
    • [ ] 認証ミドルウェア
  • [ ] 基本的なエラー処理の改善
  • [ ] 基本的なミドルウェアのサポート

フレームワークのサポート

  • [ ] Nest.js 統合 ( @remote-mcp/nestjs )

高度な機能

  • [ ] 双方向通信
    • [ ] サーバーからクライアントへのリクエスト
    • [ ] サーバー/クライアント間のリソース共有
  • [ ] 基本的な監視とログ記録

貢献する

貢献を歓迎します。詳細はCONTRIBUTING.mdをご覧ください。

免責事項

このライブラリは、既存の MCP コンセプトに基づいて構築された補完的な拡張機能であり、公式の MCP 仕様の一部ではありません。

ライセンス

このプロジェクトはMITライセンスの下で提供されています。詳細はLICENSEファイルをご覧ください。

参考文献

-
security - not tested
A
license - permissive license
-
quality - not tested

モデル コンテキスト プロトコル (MCP) サービスへのリモート アクセスを可能にするタイプ セーフ ソリューション。これにより、クライアントは公式のリモート サポートを待たずに、集中管理された MCP 実装に接続できます。

  1. Architecture
    1. Why I Made This (Now)
      1. Getting Started
        1. Client Usage
          1. Use Publicly Published Package
          2. Code Your Own Local MCP Server
        2. Server Usage (Remote MCP Implementation)
          1. Code Your Own Remote MCP Server
        3. Packages
          1. Roadmap
            1. Core Features
            2. Framework Support
            3. Advanced Features
          2. Contribute
            1. Disclaimer
              1. License
                1. References

                  Related MCP Servers

                  • A
                    security
                    A
                    license
                    A
                    quality
                    A beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.
                    Last updated -
                    3
                    9
                    36
                    JavaScript
                    Apache 2.0
                  • A
                    security
                    F
                    license
                    A
                    quality
                    A Model Context Protocol (MCP) server that provides a simple sleep/wait tool, useful for adding delays between operations such as waiting between API calls or testing eventually consistent systems.
                    Last updated -
                    1
                    6
                    7
                    JavaScript
                  • -
                    security
                    -
                    license
                    -
                    quality
                    A specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.
                    Last updated -
                    1
                    TypeScript
                  • -
                    security
                    -
                    license
                    -
                    quality
                    A Model Context Protocol (MCP) server that interacts with system APIs, allowing users to check connections, search employees, register breakfast, and update chemical information by shifts.
                    Last updated -
                    2

                  View all related MCP servers

                  ID: ov5c745xe1