Palaryn MCP Server
Governs AI agent HTTP requests with policy enforcement, security scanning, and audit logging via MCP.
README
Palaryn MCP Server
Agent I/O governance for every HTTP request your AI agent makes — exposed as an MCP server.
Palaryn MCP wraps the Palaryn gateway as a Model Context Protocol server, giving Claude Code, Cursor, Windsurf, and any MCP-compatible client policy-enforced access to external APIs with zero code changes.
What It Does
Every HTTP request your AI agent makes flows through the Palaryn pipeline:
Claude Code / Cursor / MCP Client
|
| stdio (JSON-RPC 2.0) or HTTP (/mcp)
v
Palaryn MCP Server
|
+---> Rate Limiting (per-actor sliding window)
+---> Anomaly Detection (statistical outlier flagging)
+---> Policy Engine (YAML rules: allow / deny / require approval)
+---> DLP Scanner (secrets, PII, 119 detection patterns)
+---> Prompt Injection (3-layer cascade: regex → DeBERTa → LLM)
+---> Call Limits (per-user / workspace daily & monthly caps)
+---> HTTP Execution (retries, backoff, SSRF protection)
+---> Output DLP Scan (response body scanning)
+---> Audit Logging (immutable append-only trace)
|
v
External API
Three MCP tools exposed:
| Tool | Method | Capability | Description |
|---|---|---|---|
http_request |
Any | Inferred | Execute any HTTP request (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS) |
http_get |
GET | read |
GET request shorthand |
http_post |
POST | write |
POST request shorthand |
Each tool accepts: url (required), headers, body, timeout_ms, purpose, labels.
Quick Start
Option 1: Hosted (requires a Palaryn account)
claude mcp add --transport http palaryn https://app.palaryn.com/mcp
Done. All requests from Claude Code now route through Palaryn. You will be prompted to log in via OAuth on first use.
Option 2: Project-level config
Create .mcp.json in your project root (see .mcp.json.example):
{
"mcpServers": {
"palaryn": {
"type": "stdio",
"command": "npx",
"args": ["palaryn-mcp"],
"env": {
"POLICY_PACK_PATH": "./policy-packs/default.yaml"
}
}
}
}
Note: Ensure
palaryn-mcpis installed (e.g., vianpm install palaryn-mcp) sonpxcan resolve it.
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
PALARYN_MCP_WORKSPACE |
ws-claude-code |
Workspace ID for tool calls |
PALARYN_MCP_ACTOR |
claude-code |
Actor ID for audit trails |
PALARYN_MCP_PLATFORM |
claude_code |
Platform identifier |
POLICY_PACK_PATH |
./policy-packs/default.yaml |
Path to the active policy pack |
Custom Policy Pack
Pass a custom policy via environment variable:
claude mcp add palaryn \
-e POLICY_PACK_PATH=./policy-packs/prod_strict.yaml \
-- node bin/palaryn-mcp.js
Policy Packs
Three pre-built policy packs are included:
default.yaml -- Sensible starter rules
- Block SSRF (cloud metadata endpoints)
- Allow all read operations (GET)
- Require human approval for writes (POST/PUT/PATCH)
- Deny delete and admin operations
dev_fast.yaml -- Permissive for development
- Block SSRF
- Allow reads and writes without approval
- Require approval for delete/admin operations
prod_strict.yaml -- Minimal permissions for production
- Block SSRF + internal IPs + localhost
- Allow reads only to allowlisted domains (e.g.,
api.github.com,api.slack.com) - Require security review for all writes
- Deny all delete and admin operations
- Require admin approval for anything unmatched
Custom Policy Example
name: my-policy
version: "1.0.0"
description: "Custom policy for my project"
domain_blocklist:
- "169.254.169.254"
rules:
- name: "Allow GitHub API"
effect: ALLOW
priority: 10
conditions:
capabilities: ["read"]
domains: ["api.github.com"]
- name: "Require approval for writes"
effect: REQUIRE_APPROVAL
priority: 20
conditions:
capabilities: ["write"]
approval:
scope: "admin"
ttl_seconds: 3600
reason: "Write operations require approval"
- name: "Deny everything else"
effect: DENY
priority: 100
conditions: {}
How It Works
Architecture
Palaryn MCP server is a thin adapter layer that translates MCP tool calls into the Palaryn gateway pipeline:
MCP Client (Claude Code, Cursor, etc.)
|
| JSON-RPC 2.0 over stdio
v
+-----------------------------+
| Palaryn MCP Server |
| |
| tools/list -> 3 HTTP tools |
| tools/call -> Gateway |
+-----------------------------+
|
v
+-----------------------------+
| Palaryn Gateway Pipeline |
| |
| 1. Rate Limiting |
| 2. Anomaly Detection |
| 3. Policy Evaluation |
| 4. DLP Scan (input) |
| 5. Prompt Injection (3L) |
| 6. Call Limit Check |
| 7. HTTP Execution |
| 8. DLP Scan (output) |
| 9. Audit Logging |
+-----------------------------+
|
v
External API
MCP Protocol
The server implements the Model Context Protocol specification:
| Method | Description |
|---|---|
initialize |
Protocol handshake -- returns server info and capabilities |
tools/list |
Returns the 3 HTTP tool definitions with JSON schemas |
tools/call |
Executes a tool through the gateway pipeline |
ping |
Health check |
Two Transport Modes
| Mode | Protocol | Best For |
|---|---|---|
| Stdio | JSON-RPC 2.0 over stdin/stdout | Claude Code, Cursor, local IDE agents |
| HTTP | Streamable HTTP at /mcp |
Hosted/remote deployment, shared servers |
Response Format
Every tool call returns two content blocks:
- Primary content: The actual HTTP response body (or error message)
- Gateway metadata: Policy decision, DLP report, call limits, timing
{
"content": [
{ "type": "text", "text": "{\"data\": \"response from API\"}" },
{ "type": "text", "text": "--- Gateway Metadata ---\n{...}" }
],
"isError": false
}
Security Features
Prompt Injection Detection (3-Layer Cascade)
Three-layer defense against prompt injection attacks, evaluated in cascade (fast layers first, expensive layers only if needed):
- Regex + Heuristic (sync, <1ms, $0) — 119 patterns across 17 categories with text normalization (zero-width char stripping, homoglyph collapse, ROT13/base64 decoding, leetspeak, HTML/URL decoding). Multilingual: EN, PL, DE, ES, FR.
- Fine-tuned DeBERTa (sync, ~50ms, $0) — Local ML model for semantic classification. URL-aware scanning (extracts query param values, ignores URL structure). Zero API cost, works offline.
- LLM Classifier (async, ~800ms, ~$0.001/req) — Semantic classification via gpt-4o-mini. Detects 12 attack categories including instruction override, prompt extraction, roleplay hijack, social engineering, game manipulation, memory manipulation, data exfiltration, multilingual injection, compound attacks, and classifier self-manipulation.
Cascade logic: LLM only runs if Regex + DeBERTa find nothing — reducing API calls by ~35%.
DLP (Data Loss Prevention)
- 119 detection patterns: secrets (14), PII (5), prompt injection (65), tool injection (28), exfiltration (6), sensitive files (9)
- Scans request arguments AND response bodies
- Detects API keys, tokens, passwords, SSNs, credit card numbers, AWS credentials in URLs, markdown image injection, large payload exfiltration
- Automatically redacts sensitive data before it reaches external services
- Configurable severity levels and multiple detection backends
Policy Engine
- YAML-based policy rules with priority ordering
- Four decisions:
ALLOW,DENY,TRANSFORM,REQUIRE_APPROVAL - Conditions: capability level, HTTP method, target domain, tool name
- Domain blocklists for SSRF protection
- Optional OPA/Rego integration for advanced policy logic
SSRF Protection
- Blocks requests to cloud metadata endpoints (169.254.169.254, etc.)
- Blocks private/reserved IP ranges
- Integer-encoded IP detection (e.g., 2852039166 → 169.254.169.254)
- Domain allowlisting for production environments
Call Limits
- Per-user daily and monthly call limits
- Per-workspace daily and monthly call limits
- Max steps per task
- Prevents runaway loops from agent execution
- Real-time limit tracking with remaining calls in responses
Rate Limiting
- Sliding-window rate limiting per actor and per workspace
- Prevents abuse and ensures fair resource allocation
Integration Patterns
Claude Code
# Hosted (requires Palaryn account)
claude mcp add --transport http palaryn https://app.palaryn.com/mcp
Cursor
Add to your Cursor MCP settings:
{
"mcpServers": {
"palaryn": {
"type": "stdio",
"command": "npx",
"args": ["palaryn-mcp"]
}
}
}
Windsurf
Add to your Windsurf MCP configuration:
{
"mcpServers": {
"palaryn": {
"serverUrl": "https://app.palaryn.com/mcp"
}
}
}
Remote MCP (HTTP)
For hosting Palaryn as a remote MCP server, the full gateway includes the /mcp HTTP endpoint with OAuth 2.0. Contact us at app.palaryn.com for access.
Tool Reference
http_request
Execute an arbitrary HTTP request through the Palaryn gateway.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | Target URL |
method |
string | No | HTTP method (default: GET) |
headers |
object | No | HTTP headers as key-value pairs |
body |
string | No | Request body (typically JSON) |
timeout_ms |
number | No | Request timeout in milliseconds |
purpose |
string | No | Why this request is being made |
labels |
string[] | No | Classification labels |
http_get
Shorthand for GET requests. Same parameters as http_request minus method and body.
http_post
Shorthand for POST requests. Same parameters as http_request minus method.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。