Skip to main content

A MCP tool for HTTP request testing using httpx

Project description

HTTPX MCP

An MCP tool for HTTP interface testing, built on the httpx library, designed for AI.

Features

  • 🚀 Full HTTP Method Support: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • 📝 Multiple Request Formats: JSON, form data, raw text
  • 🔧 Custom Headers: Support for arbitrary HTTP headers
  • 📋 Raw Request Parsing: Directly paste Burp Suite captured requests
  • ⏱️ Response Details: Status code, response headers, response body, timing statistics
  • 🔒 SSL Control: Optional SSL certificate verification

Installation

cd httpx-mcp
pip install -e .

MCP Configuration

Add to your MCP configuration file:

{
  "mcpServers": {
    "httpx-mcp": {
      "command": "python",
      "args": ["-m", "httpx_mcp.server"],
      "cwd": "c:/Users/ZHEFOX/Desktop/mcptools/httpx-mcp"
    }
  }
}

Or use directly after installation:

{
  "mcpServers": {
    "httpx-mcp": {
      "command": "httpx-mcp"
    }
  }
}

Available Tools

1. http_request - General HTTP Request

Send any HTTP request, switch request method via the method parameter.

Parameters:

Parameter Type Required Default Description
url string - Full URL
method string - GET HTTP method: GET/POST/PUT/DELETE/PATCH/HEAD/OPTIONS
params string - - URL query parameters, JSON or key=value format
headers string - - Request headers, JSON format
body string - - Request body
content_type string - application/json Content-Type
timeout number - 30 Timeout in seconds
follow_redirects boolean - true Whether to follow redirects
verify_ssl boolean - true Whether to verify SSL
include_headers boolean - true Whether response includes headers

Examples:

# GET request
method="GET", url="https://httpbin.org/get"

# GET with query parameters
method="GET", url="https://httpbin.org/get", params='{"page": "1", "size": "10"}'

# POST JSON
method="POST", url="https://httpbin.org/post", body='{"name": "test", "value": 123}'

# PUT update
method="PUT", url="https://httpbin.org/put", body='{"id": 1, "name": "updated"}'

# DELETE
method="DELETE", url="https://httpbin.org/delete"

# With authentication header
method="GET", url="https://api.example.com/users", headers='{"Authorization": "Bearer token123"}'

# POST form
method="POST", url="https://httpbin.org/post", body="username=admin&password=123", content_type="application/x-www-form-urlencoded"

# Disable SSL verification
method="GET", url="https://self-signed.example.com", verify_ssl=false

2. http_raw - Raw HTTP Request

Directly parse raw HTTP requests captured by tools like Burp Suite.

Parameters:

Parameter Type Required Default Description
raw_request string - Raw HTTP request text
base_url string - - Base URL (if request doesn't contain full URL)
verify_ssl boolean - true Whether to verify SSL

Example:

raw_request="""
POST /api/login HTTP/1.1
Host: example.com
Content-Type: application/json
Cookie: session=abc123

{"username":"admin","password":"123456"}
"""
base_url="https://example.com"

Response Format

The tool returns formatted response information:

HTTP/1.1 200 OK

=== Response Headers ===
content-type: application/json
date: Mon, 01 Jan 2024 00:00:00 GMT
...

=== Response Body ===
{
  "result": "success",
  "data": {...}
}

=== Request Info ===
Time: 0.234s
Size: 1024 bytes

Use Cases

  1. API Testing: Quickly test REST API endpoints
  2. Security Testing: Send custom payloads for security testing
  3. Interface Debugging: View detailed request/response information
  4. Request Replay: Directly use Burp captured content to replay requests

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpx_mcp-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

httpx_mcp-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file httpx_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: httpx_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for httpx_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9df7bfb958ecdb67178b659a5859a22e72c4dcf6ae2c88608983d7e4044243f3
MD5 2d68b15116ab693ccb5bb8f70c22c1cd
BLAKE2b-256 38147d14bd5546a15b6d9a80d31bef822da5c5b84dd8d307cbddf0f56abb5352

See more details on using hashes here.

File details

Details for the file httpx_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: httpx_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for httpx_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3152f691cf5c87ecb8f01a0168b8fbcac8fca497984b877cd0b219816c8b9a0c
MD5 5c7aeb048a5d5ee06f041fbf7695f6c0
BLAKE2b-256 9d2a946129755ee3b39ccf1a62aefc34fb0c9a4696678b6b6035e792b4062be1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page