Skip to main content
Glama

Remote-MCP

by RemoteMCP

Remote-MCP: Remote Model Context Protocol

A type-safe, bidirectional and simple solution for remote MCP communication, allowing remote access and centralized management of model contexts.

preview

Architecture

Why I Made This (Now)

Yes, I know that the official MCP roadmap includes remote MCP support in the first quarter of 2025. However, the need for remote access was immediate for me, and likely for many others. This library was created to bridge that gap, providing a way to connect to a remote MCP server from a local MCP client right now, without waiting for future official implementations.

Note: I don't want this to be a sophisticated or overcomplicated thing. This way just works right now.

Getting Started

Note: This project is currently under active development and is considered experimental. Expect breaking changes and potential issues.

Client Usage

Use Publicly Published Package

Just put the following code in your MCP client settings, in here I'm using Claude as an example:

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

Code Your Own Local MCP Server

Install requirements:

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

then write your own code like the following:

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();

Server Usage (Remote MCP Implementation)

You can see some examples in the examples directory.

Code Your Own Remote MCP Server

After npm install @remote-mcp/server, you can your own remote MCP server like the following:

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));

Then you can see like the following in your MCP client:

Packages

This repository contains:

  • @remote-mcp/client: Client library acting as a local MCP server, connecting to a remote implementation.
  • @remote-mcp/server: Server library for creating remotely accessible MCP services (used as the remote implementation).

Roadmap

Core Features

  • Basic Type-safe Client/Server Communication
    • Basic MCP Command Support
    • Basic MCP Tool Support
    • Basic MCP Prompt Support
    • Crash-Safe Handling (WIP, top priority)
  • Complete Event Subscription System
    • Resource change notifications
    • Tool/Prompt list change notifications
  • HTTP Header Support
    • Custom Headers
    • Authentication Middleware
  • Basic error handling improvements
  • Basic middleware support

Framework Support

  • Nest.js Integration (@remote-mcp/nestjs)

Advanced Features

  • Bidirectional communication
    • Server-to-client requests
    • Resource sharing between server/client
  • Basic monitoring & logging

Contribute

Contributions are welcome. See CONTRIBUTING.md for details.

Disclaimer

This library is a complementary extension, not part of the official MCP specification, built upon existing MCP concepts.

License

This project is licensed under the MIT License. See the LICENSE file for details.

References

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

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

一种类型安全的解决方案,可实现对模型上下文协议 (MCP) 服务的远程访问,允许客户端连接到集中式 MCP 实现,而无需等待官方远程支持。

  1. 建筑学
    1. 我为什么现在做这个
      1. 入门
        1. 客户端使用情况
          1. 使用公开发布的包
          2. 编写您自己的本地 MCP 服务器
        2. 服务器使用情况(远程 MCP 实施)
          1. 编写您自己的远程 MCP 服务器
        3. 套餐
          1. 路线图
            1. 核心功能
            2. 框架支持
            3. 高级功能
          2. 贡献
            1. 免责声明
              1. 执照
                1. 参考

                  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
                    300
                    61
                    Apache 2.0
                  • -
                    security
                    A
                    license
                    -
                    quality
                    Enables type-safe, bidirectional communication with Model Context Protocol services, allowing centralized management of model contexts over HTTP.
                    Last updated -
                    197
                    MIT License
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A server implementation of the Model Context Protocol (MCP) that provides REST API endpoints for managing and interacting with MCP resources.
                    Last updated -
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Model Context Protocol (MCP) server that provides safe, read-only access to Kubernetes resources for debugging and inspection. Built with security in mind, it offers comprehensive cluster visibility without modification capabilities.
                    Last updated -
                    27
                    MIT License

                  View all related MCP servers

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/RemoteMCP/Remote-MCP'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server