soap-api-gateway
Converts SOAP WSDL services into a REST interface and provides MCP tools to describe, invoke, and manage SOAP operations with caching and WS-Security support.
README
🛰 Hybrid SOAP→REST Gateway (Async + Cache + MCP + FastAPI)
A production‑grade gateway that:
- Converts SOAP WSDL services into a REST‑style interface.
- Runs FastAPI HTTP API and MCP server as separate processes in the different containers.
- Supports WS‑Security UsernameToken authentication from
.env. - Caches raw WSDL XML and fully processed WSDL (Zeep client, docs, examples).
- Allows manual cache clear and manual processed WSDL refresh via HTTP or MCP.
- Uses
.envfor environment‑specific configuration.
📂 Project Structure
.
├── soap_gateway.py # Shared SOAP→REST logic
├── fastapi_app.py # FastAPI HTTP API
├── mcp_server.py # MCP server
├── requirements.txt # Python dependencies
├── Dockerfile # Container build instructions
├── docker-compose.yml # docker compose file
├── .env # Environment variables
└── README.md # This file
🚀 Features
- Dual‑process: FastAPI and MCP run independently — no blocking.
- Async‑ready: Core functions can be adapted for async.
- Caching:
- Raw WSDL XML
- Fully processed WSDL (Zeep client, operation docs, element docs)
- Clear cache:
/clear_cacheendpoint or MCPclear()tool. - Refresh processed WSDL:
/refresh_wsdlendpoint or MCPrefresh_wsdl()tool. - Dockerized: Minimal image with
supervisordmanaging both processes. - Configurable health check: WSDL URL set via
HEALTHCHECK_WSDL_URLenv var.
⚙️ Environment Variables
| Variable | Purpose | Default |
|---|---|---|
HEALTHCHECK_WSDL_URL |
WSDL URL used by health check and as default for /describe and MCP describe |
http://example.com?wsdl |
SOAP_USERNAME |
Username for WS‑Security UsernameToken authentication | (none) |
SOAP_PASSWORD |
Password for WS‑Security UsernameToken authentication | (none) |
DEBUG |
If true, returns full error + traceback in responses |
false |
PORT |
Port for FastAPI HTTP server | 9000 |
📄 Example .env
HEALTHCHECK_WSDL_URL=https://dev.example.com/service?wsdl
SOAP_USERNAME=myuser
SOAP_PASSWORD=supersecret
DEBUG=true
PORT=9000
🐳 Docker Deployment
docker compose up -d
🛠 Usage
1. HTTP API (FastAPI)
- http://localhost:9000/docs - FastAPI documentation
POST /describe— List operations and input schema.POST /invoke— Call a SOAP operation.POST /clear_cache— Flush all caches.POST /refresh_wsdl— Force rebuild of processed WSDL cache.
2. MCP Server
Tools:
describe(wsdl_url=None, operation=None, username=None, password=None)invoke(wsdl_url=None, endpoint_url, operation, params, username=None, password=None)clear()refresh_wsdl(wsdl_url=None, username=None, password=None, version="v1")
HTTP MCP transport (mounted at /mcp)
The MCP wrapper in mcp_server.py mounts an HTTP transport at /mcp by default.
When calling the HTTP MCP endpoint, send a JSON POST where tool is the tool
name and args is an object containing the tool arguments. Example payload:
{
"tool": "describe",
"args": {
"wsdl_url": "https://example.com/service?wsdl",
"operation": null,
"username": null,
"password": null
}
}
The endpoint will return a JSON response containing the tool result (same shape as the internal function return values). This is useful for MCP agents that communicate over HTTP instead of stdio.
🤝 MCP Agent Configuration
Local spawn (stdio)
{
"mcpServers": {
"soap-gateway": {
"type": "stdio",
"command": "python",
"args": ["mcp_server.py"],
"env": {
"HEALTHCHECK_WSDL_URL": "https://dev.example.com/service?wsdl",
"SOAP_USERNAME": "myuser",
"SOAP_PASSWORD": "supersecret"
}
}
}
}
Remote/HTTP
{
"mcpServers": {
"soap-gateway": {
"type": "http",
"url": "http://your-server-host:9010/mcp",
"env": {
"HEALTHCHECK_WSDL_URL": "https://prod.example.com/service?wsdl",
"SOAP_USERNAME": "myuser",
"SOAP_PASSWORD": "supersecret"
}
}
}
}
🐳 MCP Configuration for Docker Deployment
When running inside Docker, connect over HTTP:
{
"mcpServers": {
"soap-gateway": {
"type": "http",
"url": "http://localhost:9010/mcp",
"env": {
"HEALTHCHECK_WSDL_URL": "https://dev.example.com/service?wsdl",
"SOAP_USERNAME": "myuser",
"SOAP_PASSWORD": "supersecret"
}
}
}
}
❤️ Health Check
ENV HEALTHCHECK_WSDL_URL="http://example.com?wsdl"
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -sf http://localhost:9000/describe \
-H "Content-Type: application/json" \
-d "{\"wsdl_url\":\"${HEALTHCHECK_WSDL_URL}\"}" || exit 1
🧹 Cache Management
- Automatic: Processed WSDL cache is built on first use and reused until cleared or refreshed.
- Manual clear:
- HTTP:
POST /clear_cache - MCP:
clear()tool
- HTTP:
- Manual refresh:
- HTTP:
POST /refresh_wsdl - MCP:
refresh_wsdl()tool
- HTTP:
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。