使用说明
mcp2ws
你刚从20年的昏迷中醒来吗?你构建了一堆符合流行语的web服务吗 早在21世纪初,我就希望你 简单对象访问协议 和 WSDL文件 再次相关?
现在,你可以通过暴露你的皮肤,将AI的光滑光泽放在你的一堆尖括号上 基于SOAP的web服务 模型上下文协议 (MCP)服务器。 是时候从昏迷中醒来,开始产生幻觉了。
什么?
解释这个笑话:早在21世纪初 网络服务 被几家公司大力推广为组织如何与每家公司互操作的未来 其他。具体的愿景包括大量从未被发现的基于XML的通信格式 在广义上。相反,支持REST的web API成为了常态。但20年后的今天,MCP声称 这也是公司如何互操作的未来,至少对于人工智能相关的应用程序来说是这样。不像 SOAP,有很多非常有用的MCP服务器和客户端实现了这一承诺。所以 这个repos的自负之处在于为基于SOAP的web服务提供了第二次引人注目的机会。
先决条件
- 有一个由WSDL文件描述的web服务。
- 有一个兼容的Python版本(用3.13测试)或
uv安装在您的计算机上。
跑步
随着 uv:
uv run main.py
使用常规python:
python -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
python main.py
用法
要启动MCP服务器,请运行 main.py 脚本中包含您要访问的WSDL文件的URL。
uv run main.py <WSDL_URL>
例如,如果您在以下位置有WSDL http://www.dneonline.com/calculator.asmx?wsdl:
uv run main.py http://www.dneonline.com/calculator.asmx?wsdl
这个工具已经用我在互联网上找到的这些随机WSDL文件进行了测试:
- http://www.dneonline.com/calculator.asmx?wsdl
- http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL
配置您的代理编码工具
配置您的MCP客户端(例如Gemini CLI或IDE扩展)以运行此脚本。
通用MCP配置示例:
{
"mcpServers": {
"soap-service": {
"command": "uv",
"args": [
"run",
"--project",
"/path/to/mcp2ws/pyproject.toml",
"/path/to/mcp2ws/main.py",
"http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL"
]
}
}
}
示例会话
在Gemini CLI中,使用 http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL 服务:
> What is the capital city of France? Use the soap tool.
✦ I will find the ISO code for France and then use it to get the capital city.
╭────────────────────────────────────────────────────────────────────────╮
│ ✓ CountryISOCode (soap-service MCP Server) {"sCountryName":"France"} │
│ │
│ FR │
╰────────────────────────────────────────────────────────────────────────╯
✦ I will now retrieve the capital city of France using its ISO code.
╭────────────────────────────────────────────────────────────────────────╮
│ ✓ CapitalCity (soap-service MCP Server) {"sCountryISOCode":"FR"} │
│ │
│ Paris │
╰────────────────────────────────────────────────────────────────────────╯
✦ The capital city of France is Paris.
