About MCP Wrapper
MCP Wrapper is a proxy layer that runs a real MCP server as a subprocess and forwards protocol traffic between it and an MCP client. It preserves environment context and logs operations to the console and, when configured, a file.
Key features
- 01Launches a real server as a subprocess
- 02Forwards tools, resources, and prompts
- 03Preserves environment variables and context
- 04Logs operations and errors
- 05Supports a configurable log file
Use cases
- 01Add logging around an MCP server
- 02Insert a proxy between client and server
- 03Run a server with its required environment variables
MCP support
MCP Wrapper connects to an MCP client and starts the configured real MCP server using its command and arguments. It forwards protocol requests and responses, including tools, resources, and prompts.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP 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:
-
Command-line arguments:
- First argument: The command to run the real MCP server (e.g., "node")
- Second argument: The path to the real MCP server script (e.g., "/path/to/real/mcp-server/build/index.js")
-
Environment variables (via .env file or system environment):
- MCP_WRAPPER_LOG_PATH: The directory where logs should be stored (e.g., "/Users/username/logs")
- Any environment variables required by the real MCP server
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:
- The wrapper itself is now specified in the command field ("node") with its path in args[0] ("dist/index.js")
- The real MCP server command and path are now args[1] and args[2]
- 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 build
This will copy the main.js file to dist/index.js.
Development
To watch for changes and automatically rebuild:
npm run watch
How It Works
- The MCP client connects to the wrapper server
- The wrapper server connects to the real MCP server using the provided command and arguments
- Requests from the client are forwarded to the real server
- Responses from the real server are returned to the client
- 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-log
This 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
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.