MCP 가드레일
MCP 가드레일 (Guardrails)
LiteLLM은 보안과 컴플라이언스를 보장하기 위해 MCP 도구 호출에 가드레일을 적용하는 것을 지원해요. MCP 호출 전이나 중에 가드레일을 실행해 입력을 검증하고 민감 정보를 차단하거나 마스킹할 수 있어요.
출처: 문서
본문
지원되는 MCP 가드레일 모드 (Supported MCP Guardrail Modes)
MCP 가드레일은 다음 모드를 지원해요:
pre_mcp_call: MCP 호출 전에, 입력에 대해 실행. MCP 요청에 검증/마스킹/차단을 적용하고 싶을 때 이 모드 사용.during_mcp_call: MCP 호출 실행 중에 실행. 실시간 모니터링과 개입에 사용.
구성 예시 (Configuration Examples)
MCP 도구 호출 전에 실행되어 입력을 검증·정화하는 가드레일을 구성해 주세요:
config.yaml:
guardrails:
- guardrail_name: "mcp-input-validation"
litellm_params:
guardrail: presidio # or other supported guardrails
mode: "pre_mcp_call" # or during_mcp_call
pii_entities_config:
CREDIT_CARD: "BLOCK" # Will block requests containing credit card numbers
EMAIL_ADDRESS: "MASK" # Will mask email addresses
PHONE_NUMBER: "MASK" # Will mask phone numbers
default_on: true
사용 예시 (Usage Examples)
사전 MCP 호출 가드레일 테스트 (Testing Pre-MCP Call Guardrails)
민감 정보가 포함된 요청으로 MCP 가드레일을 테스트해 주세요:
curl http://localhost:4000/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ***" \
-d '{
"model": "gpt-5.6-luna",
"messages": [
{"role": "user", "content": "My credit card is 4111-1111-1111-1111 and my email is [email protected]"}
],
"guardrails": ["mcp-input-validation"]
}'
요청은 다음과 같이 처리돼요:
- 신용카드 번호가 차단됨(요청 거부)
- 이메일 주소가 마스킹됨(예:
<EMAIL_ADDRESS>로 대체)
MCP 도구와 함께 사용 (Using with MCP Tools)
MCP 도구를 사용할 때 가드레일은 도구 입력에 적용돼요:
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="http://localhost:4000"
)
# This request will trigger MCP guardrails
response = client.chat.completions.create(
model="gpt-5.6-luna",
messages=[
{"role": "user", "content": "Send an email to 555-123-4567 with my SSN 123-45-6789"}
],
tools=[{"type": "mcp", "server_label": "litellm", "server_url": "litellm_proxy"}],
extra_body={"guardrails": ["mcp-input-validation"]},
)
지원되는 가드레일 프로바이더 (Supported Guardrail Providers)
MCP 가드레일은 LiteLLM이 지원하는 모든 가드레일 프로바이더와 함께 작동해요:
- Presidio: PII 감지 및 마스킹
- Bedrock: AWS Bedrock 가드레일
- Lakera: 콘텐츠 모더레이션
- Aporia: 사용자 지정 가드레일
- Noma: Noma Security
- PANW Prisma AIRS: Prisma AIRS 가드레일
- Custom: 자체 가드레일 구현
더 알아보기 (Learn more)
- MCP 개요 — LiteLLM의 MCP 알아보기
- 가드레일 프로바이더 — 지원되는 가드레일 프로바이더