akhshyganesh/mcp-http-proxy
If you are the rightful owner of mcp-http-proxy and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP HTTP Proxy is a robust server designed to facilitate HTTP request proxying for AI applications, ensuring secure and structured communication with external APIs.
๐ MCP HTTP Proxy
A powerful Model Context Protocol (MCP) server that provides HTTP request proxying for AI applications. All responses are structured for AI consumption with consistent status, data, and error fields.
๐ Repository Information
Field | Value |
---|---|
๐ GitHub | akhshyganesh/mcp-http-proxy |
๐ค Author | Akhshy Ganesh (akhshy.balakannan@gmail.com) |
๐ License | MIT License |
๐ Version | 1.0.0 |
๐ฆ Package | mcp-http-proxy |
๐ค What is MCP?
The Model Context Protocol (MCP) is an open standard that enables secure connections between AI applications and external data sources. This server implements MCP to provide AI assistants with the ability to perform HTTP operations against external APIs through a standardized interface.
โจ Features
- ๐ HTTP Request Proxying: Support for GET, POST, PUT, DELETE methods to external APIs
- ๐ฅ๏ธ Curl Proxy: Uses system curl commands to communicate with target servers
- ๐ค AI-Friendly Responses: Structured JSON responses with status, HTTP code, data, and error fields
- ๐ก๏ธ Intelligent Error Handling: Provides helpful guidance for common HTTP errors (401, 403, 429, etc.)
- โ Schema Validation: Input validation using Zod schemas
- ๐ Security: Built-in timeout protection and input sanitization to prevent command injection
- ๐ TypeScript: Fully typed implementation with the MCP SDK
๐๏ธ Architecture
graph LR
A[AI Assistant] <--> B[MCP Client]
B <--> C[This MCP Server]
C <--> D[Curl]
D <--> E[Target API Server]
The server receives MCP requests, validates input, constructs curl commands, executes them, and returns structured responses.
๐ Installation & Setup
๐ฆ For End Users (Recommended)
Option 1: Install from NPM (Easiest)
# Install globally to use anywhere
npm install -g mcp-http-proxy
# Start the server
mcp-http-proxy
Option 2: Install from GitHub
# Install directly from the repository
npm install -g git+https://github.com/akhshyganesh/mcp-http-proxy.git
# Start the server
mcp-http-proxy
Option 3: Use with npx (No Installation)
# Run directly without installing
npx mcp-http-proxy
๐ ๏ธ For Developers
1๏ธโฃ Clone and Install Dependencies
git clone https://github.com/akhshyganesh/mcp-http-proxy.git
cd mcp-http-proxy
npm install
2๏ธโฃ Build the Project
npm run build
3๏ธโฃ Start the Server
npm start
# or for development with auto-reload
npm run dev
๐ง MCP Client Configuration
Once installed, you can use this server with any MCP-compatible client. Here are example configurations:
Claude Desktop Configuration
Add to your claude_desktop_config.json
:
{
"mcpServers": {
"mcp-http-proxy": {
"command": "mcp-http-proxy"
}
}
}
VS Code MCP Extension
Add to your .vscode/mcp.json
:
{
"mcpServers": {
"mcp-http-proxy": {
"command": "mcp-http-proxy"
}
}
}
๐ ๏ธ Development
๐ Available Scripts
Command | Description |
---|---|
npm run build | ๐จ Compile TypeScript to JavaScript |
npm start | โถ๏ธ Start the compiled server |
npm run dev | ๐ Watch mode for development (auto-recompile on changes) |
npm run clean | ๐งน Remove compiled files |
npm test | ๐งช Run test suite |
npm run test:watch | ๐ Run tests in watch mode |
npm run test:coverage | ๐ Run tests with coverage report |
npm run lint | ๐ Check code style and quality |
npm run lint:fix | ๐ง Fix linting issues automatically |
๐ Project Structure
โโโ ๐ src/
โ โโโ ๐ index.ts # Main MCP server implementation
โ โโโ ๐ @types/ # Custom type declarations
โ โโโ ๐ modelcontextprotocol__sdk.d.ts
โโโ ๐ tests/ # Test files
โ โโโ ๐ server.test.ts # Server functionality tests
โ โโโ ๐ setup.ts # Test setup configuration
โโโ ๐ dist/ # Compiled JavaScript (generated, not tracked)
โโโ ๐ .vscode/
โ โโโ ๐ mcp.json # VS Code MCP integration config
โ โโโ ๐ tasks.json # VS Code build tasks
โโโ ๐ .github/
โ โโโ ๐ workflows/
โ โโโ ๐ ci.yml # Continuous Integration pipeline
โโโ ๐ jest.config.js # Jest testing configuration
โโโ ๐ .eslintrc.js # ESLint configuration
โโโ ๐ .npmignore # NPM package exclusions
โ โโโ ๐ copilot-instructions.md # GitHub Copilot workspace instructions
โโโ ๐ test-requests.json # Sample test requests
โโโ ๐ test-requests.md # Test requests documentation
โโโ ๐ package.json # Project dependencies and scripts
โโโ ๐ tsconfig.json # TypeScript configuration
โโโ ๐ tsconfig.build.json # TypeScript build configuration
โโโ ๐ .gitignore # Git ignore patterns
โโโ ๐ LICENSE # MIT license file
โโโ ๐ README.md # This file
๐ Usage
๐ฅ Input Schema
The server accepts requests with the following structure:
interface Request {
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
url: string; // Valid URL
data?: Record<string, any>; // Request body (for POST/PUT)
headers?: Record<string, string>; // HTTP headers
}
๐ค Response Schema
All responses follow this structure:
interface Response {
status: 'ok' | 'error';
code: number; // HTTP status code
data: any; // Response body (parsed JSON if possible)
error?: string; // Error message (if status is 'error')
}
๐ก Examples
๐ GET Request
{
"method": "GET",
"url": "https://api.example.com/users/123",
"headers": {
"Authorization": "Bearer token123"
}
}
โ POST Request
{
"method": "POST",
"url": "https://api.example.com/users",
"headers": {
"Content-Type": "application/json"
},
"data": {
"name": "John Doe",
"email": "john@example.com"
}
}
โ Success Response
{
"status": "ok",
"code": 200,
"data": {
"id": 123,
"name": "John Doe",
"email": "john@example.com"
}
}
โ Error Response
{
"status": "error",
"code": 401,
"data": {
"message": "Unauthorized"
},
"error": "Authentication required (HTTP 401). The API endpoint requires authentication. Please provide an Authorization header (e.g., \"Authorization\": \"Bearer YOUR_TOKEN\" or \"Authorization\": \"Basic YOUR_CREDENTIALS\"). Check the API documentation for the correct authentication method."
}
๐จ Intelligent Error Handling
The server provides helpful guidance for common HTTP errors:
Status | Error | Guidance |
---|---|---|
401 | ๐ Unauthorized | Suggests adding authentication headers with examples |
403 | โ Forbidden | Explains permission issues and troubleshooting steps |
429 | โฐ Rate Limited | Recommends waiting and implementing backoff strategies |
400 | โ Bad Request | Guides on fixing request format and validation issues |
404 | ๐ Not Found | Helps verify URLs and resource existence |
5xx | ๐ ๏ธ Server Errors | Advises on retry strategies and temporary issues |
Each error response includes specific, actionable guidance to help resolve the issue quickly.
๐ป VS Code Integration
๐ง Setting Up MCP in VS Code
1๏ธโฃ Install an MCP Extension
Install one of these MCP extensions in VS Code:
๐ฆ automatalabs.copilot-mcp
๐ฆ buildwithlayer.mcp-integration-expert-eligr
๐ฆ semanticworkbenchteam.mcp-server-vscode
2๏ธโฃ Configure MCP Settings
The .vscode/mcp.json
file is already configured:
{
"servers": {
"curl": {
"type": "stdio",
"command": "node",
"args": ["dist/index.js"]
}
}
}
3๏ธโฃ Build and Start
npm run build
npm start
4๏ธโฃ Use in VS Code
Open VS Code's command palette (Cmd+Shift+P
) and look for MCP-related commands to interact with your server.
๐งช Testing with Dummy Endpoints
Here are some free JSON API endpoints you can use for testing:
๐ท๏ธ JSONPlaceholder (Fake REST API)
- ๐ Base URL:
https://jsonplaceholder.typicode.com
- ๐ Features: Users, Posts, Comments, Albums, Photos, Todos
๐ฌ Example Requests to Test Your MCP Server
1๏ธโฃ GET Users
{
"method": "GET",
"url": "https://jsonplaceholder.typicode.com/users"
}
2๏ธโฃ GET Single User
{
"method": "GET",
"url": "https://jsonplaceholder.typicode.com/users/1"
}
3๏ธโฃ CREATE Post
{
"method": "POST",
"url": "https://jsonplaceholder.typicode.com/posts",
"headers": {
"Content-Type": "application/json"
},
"data": {
"title": "My New Post",
"body": "This is the content of my post",
"userId": 1
}
}
4๏ธโฃ UPDATE Post
{
"method": "PUT",
"url": "https://jsonplaceholder.typicode.com/posts/1",
"headers": {
"Content-Type": "application/json"
},
"data": {
"id": 1,
"title": "Updated Post Title",
"body": "Updated post content",
"userId": 1
}
}
5๏ธโฃ DELETE Post
{
"method": "DELETE",
"url": "https://jsonplaceholder.typicode.com/posts/1"
}
๐ Other Test APIs
API | Description | Example Endpoints |
---|---|---|
HTTPBin | HTTP testing service | https://httpbin.org/get , https://httpbin.org/post |
ReqRes | Fake user API | https://reqres.in/api/users , https://reqres.in/api/users/2 |
๐ VS Code Usage Workflow
graph TD
A[๐ Start MCP Server] --> B[๐ Open VS Code]
B --> C[โจ๏ธ Access MCP Commands]
C --> D[๐จ Send HTTP Requests]
D --> E[๐ View JSON Responses]
A1[npm start] --> A
C1[Cmd+Shift+P โ MCP] --> C
- ๐ Start the MCP Server: Run
npm start
in your terminal - ๐ Open VS Code: Open any file or workspace
- โจ๏ธ Access MCP Commands: Use
Cmd+Shift+P
โ Search for "MCP" - ๐จ Send Requests: Use the MCP interface to send HTTP requests through your server
- ๐ View Responses: See structured JSON responses in VS Code
๐งช Testing Commands
The repository includes a comprehensive test-requests.json
file with sample requests for testing all HTTP operations. For detailed information about each test request, see .
๐ Test Coverage Includes:
- JSONPlaceholder API: Users and Posts HTTP operations
- HTTPBin API: HTTP testing with custom headers
- ReqRes API: User API with pagination
You can use these test requests directly with your MCP client to verify the server functionality.
๐ Security Considerations
Security Feature | Description |
---|---|
โ Input Validation | All inputs are validated using Zod schemas |
๐ก๏ธ Command Injection Prevention | Input sanitization prevents curl command injection attacks |
โฐ Timeout Protection | Built-in timeouts (30s max, 10s connect) prevent hanging requests |
๐ Network Access | This server can make arbitrary HTTP requests - ensure proper network policies |
๐ Headers | Be careful with sensitive headers like API keys |
๐ Rate Limiting | The server includes guidance for handling API rate limits appropriately |
๐ง Troubleshooting
โ ๏ธ Common Issues
๐ซ "Cannot find module dist/index.js"
Solution:
- Run
npm run build
to compile TypeScript to JavaScript - The
dist/
directory will be created automatically during build - Note: The
dist/
folder is not tracked in git as it contains compiled output - Check that
tsconfig.json
has"outDir": "./dist"
and"rootDir": "./src"
๐ด TypeScript Compilation Errors
Solution:
Ensure all dependencies are installed (npm install
)
๐ MCP SDK Types
Solution:
Custom type declarations are provided in src/@types/
๐ฅ๏ธ Curl Not Found
Solution: Ensure curl is installed on your system
๐ Network Errors
Solution: Check target server accessibility and network policies
๐ Authentication Errors (401/403)
Solutions:
- Verify API keys and tokens are correct
- Check if headers are properly formatted
- Ensure your account has the required permissions
โฐ Rate Limiting (429)
Solutions:
- Implement delays between requests
- Use exponential backoff strategies
- Check API documentation for rate limit policies
โฑ๏ธ Timeout Errors
Solutions:
- Server requests timeout after 30 seconds for safety
- Check if the target API is responding slowly
- Consider if the endpoint requires different timeout settings
๐ก Development Tips
- ๐ Use
npm run dev
for watch mode during development - ๐ Check VS Code problems panel for TypeScript errors
- ๐ Test with simple GET requests first
- โ Validate JSON responses from target servers
๐ค Contributing
We welcome contributions to improve the MCP HTTP Proxy server! Here's how you can contribute:
๐ Quick Start
- ๐ด Fork the repository on GitHub: akhshyganesh/mcp-http-proxy
- ๐ฟ Create a feature branch:
git checkout -b feature/your-feature-name
- โจ Make your changes and ensure they follow the existing code style
- ๐งช Add tests if applicable
- ๐พ Commit your changes:
git commit -am 'Add some feature'
- ๐ค Push to the branch:
git push origin feature/your-feature-name
- ๐ Submit a pull request through GitHub
๐ Development Guidelines
- โ Follow TypeScript best practices
- ๐ Use meaningful commit messages
- ๐ Update documentation for new features
- ๐๏ธ Ensure all builds pass before submitting PR
๐ References
- ๐ Model Context Protocol Documentation
- ๐ ๏ธ MCP SDK Reference
- ๐ TypeScript Documentation
- โ Zod Schema Validation
๐งช Testing
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
Test Coverage
The test suite includes:
- โ Server startup tests - Ensures the server starts without crashing
- โ Executable validation - Verifies CLI binary has correct shebang
- โ Module import tests - Confirms the module can be imported
- โ Build verification - Validates TypeScript compilation
Continuous Integration
GitHub Actions automatically:
- โ Runs tests on multiple Node.js versions (18, 20, 22)
- โ Tests on multiple platforms (Ubuntu, Windows, macOS)
- โ Performs security audits
- โ Validates code quality with ESLint
๐ Security
Security Features
- โ Input Sanitization - All user inputs are validated and sanitized
- โ Command Injection Protection - Safe curl command construction
- โ Timeout Protection - Prevents hanging requests
- โ Error Handling - Secure error messages without sensitive data
- โ Dependency Scanning - Regular security audits of dependencies
Security Auditing
# Run security audit
npm audit
# Fix security issues
npm audit fix
# Check for high-severity vulnerabilities
npm audit --audit-level=high
Reporting Security Issues
If you discover a security issue, please:
- DO NOT open a public GitHub issue
- Email security concerns to: akhshy.balakannan@gmail.com
- Include details about the vulnerability
- Allow time for the issue to be addressed before public disclosure
๐ค Contributing
Development Workflow
- Fork the repository
- Clone your fork locally
- Install dependencies:
npm install
- Build the project:
npm run build
- Run tests:
npm test
- Make changes and add tests
- Lint code:
npm run lint:fix
- Create a pull request
Code Quality Standards
- โ All code must pass TypeScript compilation
- โ All tests must pass
- โ Code coverage should not decrease
- โ ESLint rules must be followed
- โ Security audit must pass
๐ License
This project is licensed under the MIT License - see the file for details.
๐ Made with โค๏ธ by Akhshy Ganesh
โญ Star this repo if you found it helpful!