适配 Bailian WebParser 兼容接入并完善 sidecar 文档。

新增 WebParser 兼容工具与 MCP health/tools-sync 兼容模式,让 WebParser/sse 可注册到 agent 并暴露明确 schema;同时修复 mcp argv 环境变量展开并补齐微信 sidecar 纯本地化安装与文档说明。

Made-with: Cursor
This commit is contained in:
oliver 2026-05-01 17:40:52 +08:00
parent 329fb2239a
commit df91434936
16 changed files with 640 additions and 56 deletions

View file

@ -166,10 +166,42 @@ class McpAdapterTests(unittest.TestCase):
self.assertIn("GOOGLE_CALENDAR_MCP_TOKEN_PATH", keys)
self.assertIn("GITHUB_PERSONAL_ACCESS_TOKEN", keys)
self.assertIn("CONTEXT7_API_KEY", keys)
self.assertIn("DASHSCOPE_API_KEY", keys)
finally:
if old is not None:
os.environ["OPS_MCP_ENV_ALLOWLIST"] = old
def test_materialize_bailian_webparser_compat_tool(self) -> None:
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as td:
store = SqliteStore(str(Path(td) / "ops.sqlite"))
store.upsert_mcp_server(
server_id="webparser-compat",
source_type="npm",
source_ref="mcp-remote",
entry_command="npx",
entry_args=[
"-y",
"mcp-remote",
"https://dashscope.aliyuncs.com/api/v1/mcps/WebParser/sse",
"--header",
"Authorization: Bearer ${DASHSCOPE_API_KEY}",
],
enabled=True,
)
store.replace_mcp_server_tools(
server_id="webparser-compat",
tools=[
{
"tool_name": "bailian_webparser_parse",
"description": "compat",
"parameters": {"type": "object", "properties": {"url": {"type": "string"}}},
}
],
)
specs = materialize_mcp_tools(store)
names = {x.name for x in specs}
self.assertIn("mcp__webparser-compat__bailian_webparser_parse", names)
if __name__ == "__main__":
unittest.main()