服务调用配置
MCP 服务需要用 MCP Agent 客户端进行连接、调用,常见的客户端有 360 纳米 AI、360 CopilotCodePro、Cherry Studio、VSCode、Python SDK 等。
纳米 AI 配置方式
下载纳米 AI 客户端或进入纳米 AI 官网www.n.cn/downloads完成下载安装
进入大模型模块,点击「添加工具」,填写 MCP 工具基本信息及 URL 链接信息
选择协议类型(SSE 或 Streamable HTTP),将携带 API Key 的 URL 链接添加其中。添加完成后测试 MCP 服务,查看服务中的各工具信息,并进行验证
{
"mcpServers": {
"360_TI": {
"type": "streamable-http",
"url": "https://mcp.ti.360.net/mcp/v2/ioc/",
"headers": {
"X-API-Key": "APIKEY",
"Content-Type": "application/json"
}
}
}
}360 CopilotCodePro 配置方式
从官方网站ai.geelib.360.cn/copilotcode下载 CopilotCodePro 外网模型版。打开 VSCode 中的插件市场,安装对应 .vsix 插件
登录完成后,在 VSCode 中进行 MCP 服务配置
{
"mcpServers": {
"tiaiholder": {
"type": "http",
"url": "https://mcp.ti.360.net/mcp/v2/ioc/",
"headers": {
"X-API-Key": "APIKEY",
"Content-Type": "application/json"
}
}
}
}配置完成后,进行测试应用
Cherry Studio 配置方式
启动 Cherry Studio 客户端,点击界面左下角的设置图标,选择「MCP 服务器」
点击「添加服务器」或「编辑 MCP 配置」,在弹出的窗口中填写服务器信息
{
"mcpServers": {
"360_TI": {
"type": "streamable-http",
"url": "https://mcp.ti.360.net/mcp/v2/ioc/",
"headers": {
"X-API-Key": "APIKEY",
"Content-Type": "application/json"
}
}
}
}配置完成后,在 Agent 编辑窗口中启用该 MCP 服务器
VSCode 配置示例
在 VSCode 中配置 360 MCP 服务,需在项目根目录或用户设置中创建 MCP 配置文件
在 VSCode 插件市场中安装支持 MCP 协议的客户端插件(如 mcp-client 或 copilot-mcp)
在项目根目录或用户设置目录下创建 .mcp/config.json 文件,配置 360 MCP 服务信息
配置完成后,在 VSCode 中测试 MCP 服务连接,查看工具列表是否正常加载
{
"mcpServers": {
"360_TI": {
"type": "streamable-http",
"url": "https://mcp.ti.360.net/mcp/v2/ioc/",
"headers": {
"X-API-Key": "APIKEY",
"Content-Type": "application/json"
}
}
}
}配置完成后,在 VSCode 中启用 MCP 服务即可调用 360 威胁情报工具
Python SDK 配置方式
执行 pip install mcp 安装 MCP Python SDK
使用 streamablehttp_client 连接 MCP 服务,初始化会话并调用工具
import asyncio
import json
import httpx
from mcp import ClientSession
from mcp.client.streamable_http import streamable_http_client
MCP_URL = "https://mcp.ti.360.net/mcp/v2/ioc/"
APIKEY = ""
async def main():
async with httpx.AsyncClient(
headers={"X-API-Key": APIKEY},
timeout=120.0,
follow_redirects=True,
) as http_client:
async with streamable_http_client(
MCP_URL,
http_client=http_client,
) as (read_stream, write_stream, _):
async with ClientSession(read_stream, write_stream) as session:
await session.initialize()
tools = await session.list_tools()
print([tool.name for tool in tools.tools])
result = await session.call_tool(
"query_domain",
arguments={"domain": "example.com", "sections": ["icp"], "limit": 10},
)
if result.isError:
raise RuntimeError(str(result.content))
payload = result.structuredContent
if payload is None:
payload = json.loads(next(item.text for item in result.content if item.type == "text"))
print(json.dumps(payload, ensure_ascii=False, indent=2))
asyncio.run(main())代码参考自 360 MCP 服务官方配置文档