secure-http-gateway-mcp
A secure intermediary service enabling API interaction, specifically featuring robust testing capabilities for platforms like OpenAI's generative models. It handles sensitive credentials safely, visualizes returned data clearly, and supports synthetic media creation (e.g., image synthesis).
Author

Vikrant-Khedkar
Quick Info
Actions
Tags
Secure HTTP Endpoint Management Protocol (MCP) Server
This utility serves as a Model Context Protocol (MCP) proxy, allowing the connected AI agent to execute network calls to external endpoints on the user's behalf. It includes specialized hooks for interacting with OpenAI services.
Core Functionalities
- Execute standard web methods (GET, POST, PUT, DELETE) against arbitrary URLs.
- Safely interface with OpenAI's generative AI infrastructure (e.g., GPT series) without transmitting private access tokens.
- Leverage DALL-E for visual asset generation.
- Present all received data in a structured, human-readable format.
Deployment Checklist
Prerequisites
- Runtime environment: Python version 3.10 or newer.
- Required framework: MCP Software Development Kit (SDK) version 1.2.0 or later.
Installation Procedure
- Install necessary Python packages:
bash pip install "mcp[cli]" httpx python-dotenv
- Configure the OpenAI authorization token using one of the following secure methods:
Method 1: Operating System Environment Variables
bash
Windows PowerShell
$env:OPENAI_API_KEY = "your-secret-key"
Windows Command Prompt
set OPENAI_API_KEY=your-secret-key
Linux/macOS Shell
export OPENAI_API_KEY="your-secret-key"
Method 2: Utilizing a Local Configuration File (Recommended Practice)
Create a file named .env within the root directory (duplicate the structure from .env.example):
OPENAI_API_KEY=your_actual_openai_api_key_here
Launching the Service
Execute the main application file:
bash python main.py
Integration with Agent Frameworks (e.g., Claude Desktop)
After the proxy server is active, configure your client application to point to this local service endpoint.
Illustrative Usage Examples
Standard Network Data Retrieval
Invoke the get_request function targeting the following URI: https://jsonplaceholder.typicode.com/posts/1
Execute a post_request operation toward https://jsonplaceholder.typicode.com/posts using this payload structure: {"title": "Test Post", "body": "This is a test", "userId": 1}
Accessing OpenAI Capabilities
Call the openai_chat_completion function with parameters: prompt: "Compose a brief poetic piece concerning synthetic intelligence" system_message: "You function as an expert poet specializing in creative, concise verse." model: "gpt-4"
Invoke the openai_image_generation function using: prompt: "A visionary cityscape featuring airborne vehicles and towering reflective architecture during twilight hours" size: "1024x1024"
Exposed Functions (Tools)
General Web Communication Functions
get_request: Performs HTTP GET operations to specified endpoints.post_request: Submits data via HTTP POST, expecting JSON content.put_request: Updates resources using HTTP PUT with JSON payloads.delete_request: Executes HTTP DELETE requests.
OpenAI Service Interfaces
openai_chat_completion: Interfaces with text-based large language models.openai_image_generation: Interfaces with the DALL-E visual synthesis engine.
Security Directives
- The private OpenAI access credential remains confined to the server environment; it is never transmitted to the conversational interface.
- All service utilization is billed directly to your associated OpenAI account.
- For operational deployments, mandate token configuration via environment variables or the
.envfile. - The
.envfile is explicitly excluded from version control via.gitignoreto prevent accidental credential exposure.
