mcp-wrapper
a wrapper that allows to run mcp servers in wrapped light subprocesses with custom multi environments
Documentation
MCP Wrapper
A proxy wrapper for MCP (Model Context Protocol) servers.
Overview
This project creates a proxy layer that sits between MCP clients and MCP servers. It forwards requests from clients to the real MCP server and returns the responses.
Features
- Acts as a bridge between MCP clients and real MCP servers
- Transparently forwards all MCP protocol operations (tools, resources, prompts)
- Preserves environment variables and context
- Handles errors gracefully
- Detailed logging to a file in the directory specified by MCP_WRAPPER_LOG_PATH environment variable
Usage
Configuration
The MCP wrapper requires command-line arguments and environment variables:
1. Command-line arguments:
2. Environment variables (via .env file or system environment):
Configuration Change Note
The configuration structure has changed from the original version:
Before (Original):
{
"mcpServers": {
"my mcp server": {
"command": "node /path/to/real/mcp-server/build/index.js",
"env": {
"HOME_LOG_PATH": "/Users/username/logs",
"OTHER_ENV_VAR": "value"
}
}
}
}After (Current):
{
"mcpServers": {
"my mcp server": {
"command": "node",
"args": [
"dist/index.js",
"node",
"/path/to/real/mcp-server/build/index.js"
],
"env": {
"MCP_WRAPPER_LOG_PATH": "/Users/username/logs",
"OTHER_ENV_VAR": "value"
}
}
}
}Note that:
1. The wrapper itself is now specified in the command field ("node") with its path in args[0] ("dist/index.js")
2. The real MCP server command and path are now args[1] and args[2]
3. The environment variable has changed from HOME_LOG_PATH to MCP_WRAPPER_LOG_PATH
The wrapper is designed to be run automatically by tools like Claude and Cursor, not manually launched.
Building
To build the wrapper:
npm run buildThis will copy the main.js file to dist/index.js.
Development
To watch for changes and automatically rebuild:
npm run watchHow It Works
1. The MCP client connects to the wrapper server
2. The wrapper server connects to the real MCP server using the provided command and arguments
3. Requests from the client are forwarded to the real server
4. Responses from the real server are returned to the client
5. All operations are logged to the console and a log file in the MCP_WRAPPER_LOG_PATH directory
This allows you to add a proxy layer that can:
- Modify requests or responses
- Add logging
- Handle authentication
- Implement rate limiting
- Add caching
Logs
The MCP wrapper logs all operations to:
- Console output (for real-time monitoring)
- Log file at `$MCP_WRAPPER_LOG_PATH/mcp-proxy.log` (if MCP_WRAPPER_LOG_PATH is set)
Each log entry includes:
- Timestamp (ISO format)
- Operation type (listing tools, calling tools, etc.)
- Request details
- Response summary
- Error information (when applicable)
Monitoring Logs
To tail the log file and monitor activity in real-time, run:
npm run tail-logThis will display the existing log content and watch for new entries. Press Ctrl+C to exit.
Requirements
- Node.js 14 or higher
- An MCP client
- A real MCP server to proxy to
- Write access to the MCP_WRAPPER_LOG_PATH directory
Frequently asked questions
What is mcp-wrapper?
mcp-wrapper is a wrapper that allows to run mcp servers in wrapped light subprocesses with custom multi environments
How do I install mcp-wrapper?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-wrapper open source?
Yes — it is hosted on GitHub at https://github.com/tibzejoker/mcp-wrapper and has 2 stars.
Related MCP tools
An MCP server that installs other MCP servers for you JavaScript-based implementation. Trusted by 1400+ developers. Trusted by 1400+ developers.
MCP server for interacting with the iOS simulator JavaScript-based implementation. Trusted by 1200+ developers. Trusted by 1200+ developers.
A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only...
This is an MCP server that allows you to directly download transcripts of YouTube videos. JavaScript-based implementation.
The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.
An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others. Built for the Model Context Protocol to enhance AI capabiliti
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP