π MCP Proxy Wrapper
Transform any MCP server into a powerful, extensible platform with enterprise-grade features
npm install mcp-proxy-wrapper
β¨ What is MCP Proxy Wrapper?
The MCP Proxy Wrapper is a TypeScript library that wraps existing Model Context Protocol (MCP) servers to add advanced functionality through a sophisticated plugin system, all without requiring any changes to your existing MCP server code.
Zero-Modification Enhancement: Add smart features like LLM summarization, chat memory, and custom processing to any MCP server without touching the original code.
π― Core Concept
The proxy wrapper intercepts tool calls between clients and your MCP server, allowing plugins to:
- π Authenticate and authorize users before tool execution
- π° Monitor and bill for tool usage in real-time
- β‘ Transform requests and responses for enhanced functionality
- π Log and analyze usage patterns and performance
- π Cache responses for improved performance
- π‘οΈ Rate limit to prevent abuse
π Quick Navigation
β Key Features
π Plugin Architecture
Extensible hook system for beforeToolCall
and afterToolCall
with zero server modifications.
π€ AI Enhancement Plugins
LLM Summarization and Chat Memory plugins included for intelligent tool enhancement.
π Authentication & Security
Flexible hook system for implementing access control, rate limiting, and user management.
π Analytics & Monitoring
Usage tracking, performance metrics, error reporting, and real-time monitoring capabilities.
π Transport Agnostic
Works with STDIO, WebSocket, SSE, HTTP, and InMemory transport protocols.
π’ Enterprise Ready
Robust error handling, comprehensive logging, and production-grade features.
π§ How the Proxy Wrapper Works with Tools
The proxy wrapper enhances your MCP server without breaking existing functionality - it's completely backward compatible!
- Tools registered BEFORE wrapping: Remain fully available and functional, but don't get enhanced with hooks/plugins
- Tools registered AFTER wrapping: Get full plugin functionality (summarization, memory, analytics, etc.)
- All underlying server functionality: Completely preserved (resources, prompts, metadata, transport)
The proxy wrapper intercepts the server.tool()
method registration process, not the tools themselves. So when you call wrapWithProxy(server)
, it overrides how new tools are registered to add the hook functionality, but existing tools continue to work exactly as before.
π This behavior is documented in detail in the Getting Started guide and How It Works section with examples showing the difference between enhanced and non-enhanced tools.
π» Quick Example
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { wrapWithProxy, LLMSummarizationPlugin } from 'mcp-proxy-wrapper';
import { z } from 'zod';
// Create your MCP server
const server = new McpServer({ name: 'My AI Tools', version: '1.0.0' });
// Add AI enhancement plugin
const summarizationPlugin = new LLMSummarizationPlugin();
// Wrap with proxy functionality
const proxiedServer = await wrapWithProxy(server, {
plugins: [summarizationPlugin]
});
// Register tools as usual - enhancement happens automatically
proxiedServer.tool('ai-analysis', {
text: z.string()
}, async (args) => {
return {
content: [{ type: 'text', text: `Analysis result: ${args.text}` }]
};
});