HTTP-4-MCP is a powerful middleware server that transforms regular HTTP interfaces into MCP (Model Control Protocol) interfaces. With simple configuration, you can instantly convert your HTTP APIs into MCP tools, enabling seamless integration with MCP-compatible applications.
Clone the repository:
# Clone repository
git clone https://gitee.com/tght1211/http-for-mcp-server.git
# or
git clone https://github.com/tght1211/http-for-mcp-server.git
cd http-for-mcp-server
Install dependencies (recommended using uv package manager):
uv venv
uv pip install -r requirements.txt
Activate the virtual environment:
# On Windows
.venv/Scripts/activate
# On Linux/Mac
source .venv/bin/activate
Start the main server:
uv run run.py
Start the configuration UI (optional):
uv run run_config_ui.py
You can configure HTTP-4-MCP in two ways:
Create or edit a JSON configuration file with your API details:
{
"tools": [
{
"name": "weather_api",
"description": "Get real-time weather information for a specified city, including temperature, humidity, weather conditions, wind direction, and wind speed.",
"url": "https://devapi.qweather.com/v7/weather/now",
"method": "GET",
"params": {
"location": {
"type": "string",
"desc": "City name or ID",
"required": true,
"default": "101010100"
},
"key": {
"type": "string",
"desc": "API key",
"required": true,
"default": "05a3e2c04b65416e912088b76a7a487e"
},
"lang": {
"type": "string",
"desc": "Language",
"required": false,
"default": "zh"
},
"unit": {
"type": "string",
"desc": "Unit system",
"required": false,
"default": "m"
}
},
"headers": {
"User-Agent": "weather-app/1.0"
},
"response": {
"code": {
"path": "code",
"desc": "Response status code"
},
"updateTime": {
"path": "updateTime",
"desc": "Data update time"
},
"now_temp": {
"path": "now.temp",
"desc": "Current temperature (Celsius)"
},
"now_text": {
"path": "now.text",
"desc": "Weather phenomenon text description"
}
},
"response_mode": "metadata"
}
]
}
To connect to the MCP server, use the SSE (Server-Sent Events) endpoint:
# Example connection URL
sse_url = "http://localhost:8000/mcp/sse"
You can easily import API configurations by pasting a cURL command:
curl -X GET 'https://api.example.com/weather?city=beijing'
The server can be configured with the following parameters:
If you encounter any issues:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "http-4-mcp" '{"command":"python","args":["run.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"http-4-mcp": {
"command": "python",
"args": [
"run.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"http-4-mcp": {
"command": "python",
"args": [
"run.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect