Prisma AIRS MCP安全继电器
Palo Alto Networks
- 独立安装程序 - 快速入门:通过pypi.org安装并运行 - 标准安装 - 安装尖端开发版本 - 升级
- MCP中继服务器配置 - 配置优先级 - 配置文件格式 - 环境变量 - MCP客户端配置 - 运输选项
- pan-mcp中继CLI用法 - 运行中继服务器 - stdio传输(默认) - 可流式HTTP传输 - SSE运输
概述
pan-mcp-relay 是否增强了安全性 模型上下文协议 (MCP)继电器(_代理_)为MCP客户端提供实时AI威胁防护的服务器,使用 Prisma AIRS AI运行时API拦截.
pan-mcp-relay 将通过自动扫描和阻止,帮助保护MCP客户端(如IDE、LLM聊天客户端和AI代理)免受有害的MCP服务器工具的侵害 各种威胁,包括提示注入、恶意URL、不安全输出、人工智能代理威胁、敏感数据丢失等。
MCP中继扫描所有MCP服务器工具描述、工具调用参数和工具调用响应。
有关许可、入职、激活以及获取API身份验证密钥和配置文件名称的信息,请参阅 Prisma AIRS AI运行时:API拦截概述 行政文件。
先决条件
遵循以下激活和入职指南:
- 创建并关联 部署配置文件 用于客户支持门户中的Prisma AIRS AI Runtime API拦截。
- 机载Prisma AIRS AI运行时API拦截 Strata Cloud Manager。
- 管理应用程序、API密钥、安全配置文件和自定义主题 Strata Cloud Manager。
Prisma AIRS API使用要求
- API密钥:在Strata Cloud Manager中的入职过程中生成API密钥(请参阅上面的入职先决条件步骤)。
- 通过配置标志、环境变量或配置文件指定API密钥。
- AI安全配置文件名称:这是您在Strata Cloud Manager的入职过程中创建的API安全配置文件(请参阅上面创建API安全配置文件的前提步骤)。
- 通过配置标志、环境变量或配置文件指定配置文件名称或配置文件ID。
\[!注意\] 您可以在Strata云管理器中管理API密钥和人工智能安全配置文件。 1. 登录到 Strata云管理器. 1. 引导到 洞察>Prisma AIRS>Prismaa AIRS AI运行时:API拦截. 1. 在右上角,单击: - 管理>API密钥 以复制、重新生成或旋转API密钥令牌。 - 管理>安全配置文件 获取详细信息或更新AI安全配置文件。 - 管理>自定义主题 为自定义主题护栏威胁检测创建或更新自定义主题。 有关完整的详细信息,请参阅激活和入职指南,了解如何 管理应用程序、API密钥、安全配置文件和自定义主题.
安装
我们 _强烈推荐_ 使用 uv 超过 pip 或 pipx试试看!你会喜欢的。
Installing uv
查看更多安装方法 .
独立安装程序
uv提供了一个独立的安装程序来下载和安装uv:
===“macOS和Linux”
Use `curl` to download the script and execute it with `sh`:
$ curl -LsSf https://astral.sh/uv/install.sh | sh
If your system doesn't have `curl`, you can use `wget`:
$ wget -qO- https://astral.sh/uv/install.sh | sh
Request a specific version by including it in the URL:
$ curl -LsSf https://astral.sh/uv/0.8.13/install.sh | sh
===“窗口”
Use `irm` to download the script and execute it with `iex`:
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Changing the [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4#powershell-execution-policies) allows running a script from the internet.
Request a specific version by including it in the URL:
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.8.13/install.ps1 | iex"
!!!小费
The installation script may be inspected before use:
=== "macOS and Linux"
$ curl -LsSf https://astral.sh/uv/install.sh | less
=== "Windows"
PS> powershell -c "irm https://astral.sh/uv/install.ps1 | more"
Alternatively, the installer or binaries can be downloaded directly from .如果已经安装了uv,请更新uv-uv会经常发布更新,因此请确保您使用的是最新版本。
uv self update快速入门:通过pypi.org安装并运行
安装并运行 pan-mcp-relay 在一行中,显示CLI帮助:
uvx pan-mcp-relay@latest --help\[!注意\] 虽然这使得入门变得容易,但您可以通过以下方式获得更快的启动时间 标准安装
标准安装
uv 安装到标准位置,该位置会自动添加到您的 $PATH 在紫外线安装过程中。
在macOS和Linux上,这通常是 ~/.local/bin.
# Installs to $(uv tool dir)/pan-mcp-relay
uv tool install pan-mcp-relay@latest
# Executable symlinked to $(uv tool dir --bin)/pan-mcp-relay
pan-mcp-relay --help安装尖端开发版本
uv tool install https://github.com/PaloAltoNetworks/aisecurity-mcp-relay.git
pan-mcp-relay --help升级
如果你正在使用 uvx pan-mcp-relay@latest,您已在使用最新版本。
使用以下命令更新已安装的版本
uv tool install --upgrade pan-mcp-relay- 安装或升级
pan-mcp-relay使用uv:uv tool install --upgrade pan-mcp-relay - 创建一个
mcp-relay.yaml配置文件包含:
1. Prisma AIRS API配置 - Prisma AIRS API密钥 - Prisma AIRS AI简介 - Prisma AIRS API终点 (可选,默认为美国Prisma AIRS API端点。) 1. MCP服务器 - 支持stdio、SSE和流式HTTP MCP服务器。 1. 运行MCP中继服务器
配置
MCP中继服务器配置
配置优先级
- CLI标志
- 环境变量
- .env文件变量
- 配置文件
pan-mcp-relay 支持通过以下方式加载配置文件 --config-file 旗, MCP_RELAY_CONFIG_FILE 或者检测一组预定位置上的配置文件:
--config-file(-c)CLI标志MCP_RELAY_CONFIG_FILE环境变量./mcp-relay.yaml~/.mcp-relay.yaml~/.config/pan-mcp-relay/mcp-relay.yaml./mcp-relay.json~/.mcp-relay.json~/.config/pan-mcp-relay/mcp-relay.json
配置文件格式
存储库中提供了MCP中继服务器配置示例 examples/config/mcp-relay.yaml
复制或创建新 mcp-relay.yaml 文件。唯一的 _必需的_ 部分是 mcpServers: {}.
# mcpRelay section is optional.
# Specify API Key, AI Profile and API Endpoint via CLI flags or environment variables.
mcpRelay:
# Prisma AIRS API Key (required), environment variables supported
apiKey: |
${PRISMA_AIRS_API_KEY}
# Prisma AIRS AI Profile Name or ID (required), environment variables supported
aiProfile: |
your-ai-profile-name-or-id
# Endpoint Optional, default shown
# endpoint: |
# https://service.api.aisecurity.paloaltonetworks.com
# mcpServers section requires at least one MCP Server.
mcpServers:
# Example / demo MCP Servers
homebrew:
command: brew
args:
- mcp-server
# Optional working directory, supports environment variables
cwd: "${HOMEBREW_PREFIX}"
# optional environment variables, inherited from the parent shell
env:
HOMEBREW_NO_ENV_HINTS: 1
fetch:
command: uvx
args:
- mcp-server-fetch
# filesystem:
# command: npx
# args:
# - -y
# - '@modelcontextprotocol/server-filesystem'
# - /var/tmp/change/this/path
# # Command line arguments support environment variables
# - "${XDG_PICTURES_DIR}"环境变量
除了CLI标志和配置文件之外, pan-mcp-relay 支持通过以下环境变量设置配置:
# Required for Prisma AIRS API
PRISMA_AIRS_API_KEY=YOUR_API_KEY
# Required for Prisma AIRS API
PRISMA_AIRS_AI_PROFILE=YOUR_AI_PROFILE_NAME
# Optional, default is https://service.api.aisecurity.paloaltonetworks.com
PRISMA_AIRS_API_ENDPOINT=https://service.api.aisecurity.paloaltonetworks.com
# See https://pan.dev/prisma-airs/scan/api/#scan-api-endpoints for additional regional API endpoints
# Defaults shown for all other Environment Variables
MCP_RELAY_CONFIG_FILE=~/.config/pan-mcp-relay/mcp-relay.yaml
MCP_RELAY_TRANSPORT=stdio
# Host For SSE Transport Mode
MCP_RELAY_HOST=127.0.0.1
# Port for SSE Transport Mode
MCP_RELAY_TOOL_CACHE_TTL=86400
MCP_RELAY_MAX_SERVERS=32
MCP_RELAY_MAX_TOOLS=256
# Path to optional .env file
MCP_RELAY_DOTENV=
# Supports $PATH-style colon-separated list and environment variables. Directory entries will search for a file named `.env`
# MCP_RELAY_DOTENV=$HOME/.env:~/.config/pan-mcp-relay:$PWD
MCP_RELAY_LOG_LEVEL=INFO
MCP客户端配置
创建新的配置文件 mcp-relay.json 与您的MCP客户端(IDE、聊天客户端或代理)一起使用。
{
"mcpServers": {
"pan-mcp-relay": {
"command": "uvx",
"args": [
"pan-mcp-relay@latest"
]
}
}
}为了加快启动时间,请安装/升级 pan-mcp-relay 使用 uv tool install --upgrade pan-mcp-relay,并直接使用命令名:
{
"mcpServers": {
"pan-mcp-relay": {
"command": "pan-mcp-relay"
}
}
}\[!小心\] pan-mcp-relay 应该是MCP客户端配置文件中列出的唯一MCP服务器。 此处列出的任何其他MCP服务器将 非 MCP继电器的安全功能可见。(可选)指定其他环境变量或CLI标志:
{
"mcpServers": {
"pan-mcp-relay": {
"command": "uvx",
"args": [
"pan-mcp-relay",
"--config-file",
"~/.config/pan-mcp-relay/mcp-relay.yaml"
],
"env": {
"PRISMA_AIRS_AI_PROFILE": "your-ai-profile",
"MCP_RELAY_LOG_LEVEL": "WARNING"
}
}
}
}运输选项
MCP中继服务器支持标准MCP传输机制:
stdio运输:用于本地进程通信(默认)Streamable运输:用于基于HTTP的通信,支持SSE(服务器发送事件)。SSE运输:用于与仅限SSE的MCP客户端向后兼容。
用法
pan-mcp中继CLI用法
pan-mcp-relay --help
Usage: pan-mcp-relay [OPTIONS] COMMAND [ARGS]...
Run the MCP Relay Server.
Options:
-k, --api-key TEXT Prisma AIRS API Key [PRISMA_AIRS_API_KEY=]
-e, --api-endpoint TEXT Prisma AIRS API Endpoint [PRISMA_AIRS_API_ENDPOINT=]
-p, --ai-profile TEXT Prisma AIRS AI Profile Name or ID [PRISMA_AIRS_AI_PROFILE=]
-c, --config-file FILE Path to configuration file (yaml, json) [MCP_RELAY_CONFIG_FILE=]
-t, --transport [stdio|sse|http]
Transport protocol to use [MCP_RELAY_TRANSPORT=] [default: stdio]
-h, --host TEXT Host for HTTP/SSE server [MCP_RELAY_HOST=] [default: 127.0.0.1]
-p, --port INTEGER Port for HTTP/SSE server [MCP_RELAY_PORT=] [default: 8000]
-TTL, --tool-registry-cache-ttl INTEGER
Tool registry cache TTL (in seconds) [MCP_RELAY_TOOL_CACHE_TTL=] [default: 86400]
-MS, --max-mcp-servers INTEGER Maximum number of downstream MCP servers to allow [MCP_RELAY_MAX_SERVERS=] [default: 32]
-MT, --max-mcp-tools INTEGER Maximum number of MCP tools to allow [MCP_RELAY_MAX_TOOLS=] [default: 256]
--env TEXT Use ./.env file, or specify colon separated path to .env file(s)or directories containing .env files. [MCP_RELAY_DOTENV=]
--system-ca Use System CA instead of Mozilla CA Bundle
--capath FILE Path to Custom Trusted CA bundle
-d, --debug Extremely verbose logging output (DEBUG)
-v, --verbose Verbose logging output (INFO, DEFAULT)
-q, --quiet Minimal logging output (WARNING)
--show-config, --dump-config Show configuration and exit [MCP_RELAY_SHOW_CONFIG=]
-V, --version Show the version and exit.
--help Show this message and exit.
Commands:
json-schema Print Configuration File JSON Schema, optionally to a file.
run Run the MCP Relay Server.
show-config Print MCP Relay Configuration and exit.运行中继服务器
stdio传输(默认)
# Run with stdio transport with automatic configuration detection (default)
uvx pan-mcp-relay
# Specify a configuration file
uvx pan-mcp-relay --config-file ~/.config/pan-mcp-relay/mcp-relay.yaml
# Specify a path to a custom .env file
uvx pan-mcp-relay --env /var/run/secrets/.env可流式HTTP传输
# Run with Streamable transport
pan-mcp-relay --transport=httpSSE运输
# Run with SSE transport
pan-mcp-relay --transport=sse法律
版权所有©2025,Palo Alto Networks
根据 Polyform内部使用许可证1.0.0 (“许可证”);除非遵守许可证,否则您不得使用此文件。
您可以在以下网址获得许可证副本:
https://polyformproject.org/licenses/internal-use/1.0.0
(或)
https://github.com/polyformproject/polyform-licenses/blob/76a278c4/PolyForm-Internal-Use-1.0.0.md
在法律允许的范围内,软件按原样提供,不提供任何保证 或条件,许可方将不对您承担任何损害赔偿责任 由这些条款或软件的使用或性质引起的,根据 任何形式的法律索赔。
