Back to MCP Catalog

Proxy MCP Server

Developer ToolsTypeScript
A TypeScript SSE proxy for MCP servers that use stdio transport
Available Tools

proxyServer

Sets up a proxy between a server and a client

serverclientcapabilities

startSSEServer

Starts a proxy that listens on a port and endpoint, and sends messages to the attached server via SSEServerTransport

portendpointcreateServer

startHTTPStreamServer

Starts a proxy that listens on a port and endpoint, and sends messages to the attached server via StreamableHTTPServerTransport

portendpointcreateServereventStore

startStdioServer

Starts a proxy that listens on stdio, and sends messages to the attached SSE or streamable server

serverTypeurl

tapTransport

Taps into a transport and logs events

transportcallback

MCP Proxy provides a bridge between Model Context Protocol (MCP) servers that use stdio transport and clients that expect Server-Sent Events (SSE) or HTTP streaming. It enables seamless communication between different transport mechanisms, making it easier to integrate MCP servers with web applications. With built-in CORS support and flexible configuration options, MCP Proxy simplifies the development workflow for AI-powered applications.

Overview

MCP Proxy is a TypeScript utility that creates a proxy between MCP servers using stdio transport and clients that expect Server-Sent Events (SSE) or HTTP streaming. This makes it easier to integrate MCP servers with web applications and other clients that don't directly support stdio communication.

Installation

You can install MCP Proxy using npm:

npm install mcp-proxy

Or using other package managers:

pnpm add mcp-proxy
yarn add mcp-proxy

Usage

Command-line Usage

MCP Proxy can be used directly from the command line to quickly set up a proxy server:

npx mcp-proxy --port 8080 --endpoint /sse tsx server.js

This starts a server and stdio server (running tsx server.js). The server listens on port 8080 and endpoint /sse by default, and forwards messages to the stdio server.

Command-line options:

  • --port: Specify the port to listen on (default: 8080)
  • --endpoint: Specify the endpoint to listen on (default: /sse for SSE server, /stream for stream server)
  • --server: Specify the server type to use (default: sse)
  • --debug: Enable debug logging

Node.js SDK

The Node.js SDK provides several utilities for creating a proxy:

Using proxyServer

The proxyServer function sets up a proxy between a server and a client:

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/transports/index.js";
import { proxyServer } from "mcp-proxy";

const transport = new StdioClientTransport();
const client = new Client();
const server = new Server(serverVersion, {
  capabilities: {},
});

proxyServer({
  server,
  client,
  capabilities: {},
});

Starting an SSE Server

The startSSEServer function starts a proxy that listens on a specified port and endpoint, sending messages to the attached server via SSEServerTransport:

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { startSSEServer } from "mcp-proxy";

const { close } = await startSSEServer({
  port: 8080,
  endpoint: "/sse",
  createServer: async () => {
    return new Server();
  },
});

// To close the server when done
close();

Starting an HTTP Stream Server

The startHTTPStreamServer function starts a proxy that uses HTTP streaming:

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { startHTTPStreamServer, InMemoryEventStore } from "mcp-proxy";

const { close } = await startHTTPStreamServer({
  port: 8080,
  endpoint: "/stream",
  createServer: async () => {
    return new Server();
  },
  eventStore: new InMemoryEventStore(), // optional - you can provide your own event store
});

// To close the server when done
close();

Starting a Stdio Server

The startStdioServer function starts a proxy that listens on stdio and sends messages to an attached SSE or streamable server:

import { ServerType, startStdioServer } from "mcp-proxy";

await startStdioServer({
  serverType: ServerType.SSE,
  url: "http://127.0.0.1:3000/sse",
});

Tapping into a Transport

The tapTransport function allows you to tap into a transport and log events:

import { tapTransport } from "mcp-proxy";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/transports/index.js";

const transport = tapTransport(new StdioClientTransport(), (event) => {
  console.log(event);
});

Notes

  • CORS is enabled by default for all server types.
  • For a Python implementation, see mcp-proxy.
  • MCP Proxy is used by FastMCP to enable SSE functionality.

Troubleshooting

If you encounter issues with the proxy:

  1. Enable debug logging with the --debug flag when using the command-line interface
  2. Check that your MCP server is correctly configured and running
  3. Verify that the port you're using isn't already in use by another application
  4. Ensure that your client is correctly configured to connect to the proxy endpoint

Related MCPs

Apple Shortcuts
Developer ToolsJavaScript

Control Apple Shortcuts automations from AI assistants

Clojars Dependency Lookup
Developer ToolsJavaScript

Fetch dependency information from Clojars, the Clojure community's artifact repository

Simple Timeserver
Developer ToolsPython

Provides Claude with current time and timezone information

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.