Metadata-Version: 2.4
Name: promptguard-mcp-server
Version: 1.0.0
Summary: PromptGuard MCP server — scan prompts, redact PII, and audit LLM SDK usage from any MCP client
Project-URL: Homepage, https://promptguard.co
Project-URL: Documentation, https://docs.promptguard.co/tools/mcp
Project-URL: Repository, https://github.com/acebot712/promptguard
Project-URL: Issues, https://github.com/acebot712/promptguard/issues
Author-email: PromptGuard <support@promptguard.co>
License-Expression: MIT
Keywords: llm,mcp,pii,prompt-injection,promptguard,security
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: fastmcp>=2.0.0
Requires-Dist: httpx>=0.27.0
Description-Content-Type: text/markdown

# PromptGuard MCP Server

<!-- mcp-name: co.promptguard/security -->

Standalone [Model Context Protocol](https://modelcontextprotocol.io/) server for [PromptGuard](https://promptguard.co) — scan prompts for injection attacks, redact PII, and audit LLM SDK usage from any MCP-compatible client.

## Installing the MCP Server

### pip (recommended)

```bash
pip install promptguard-mcp-server
```

### uvx (zero-install)

```bash
uvx promptguard-mcp-server
```

### npx

```bash
npx @promptguard/mcp-server
```

### Docker

```bash
docker pull abhijoysarkar/promptguard-mcp-server
docker run -e PROMPTGUARD_API_KEY=pg_xxx abhijoysarkar/promptguard-mcp-server
```

### Homebrew (CLI)

```bash
brew tap promptguard/tap
brew install promptguard
```

## Quick Start

### 1. Install

```bash
pip install promptguard-mcp-server
```

### 2. Configure your API key

```bash
export PROMPTGUARD_API_KEY="pg_sk_prod_YOUR_KEY"
```

Or skip this — the agent will call `promptguard_auth` automatically when needed.

### 3. Add to your MCP client

**Cursor** — add to `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "promptguard": {
      "command": "promptguard-mcp-server",
      "args": []
    }
  }
}
```

**Claude Desktop** — add to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "promptguard": {
      "command": "promptguard-mcp-server",
      "args": []
    }
  }
}
```

**Claude Code**:

```bash
claude mcp add promptguard -- promptguard-mcp-server
```

**Gemini CLI**:

```bash
gemini mcp add -t stdio promptguard -- promptguard-mcp-server
```

**VS Code Copilot** — add to `settings.json`:

```json
{
  "github.copilot.chat.mcp.servers": {
    "promptguard": {
      "command": "promptguard-mcp-server",
      "args": []
    }
  }
}
```

## Transports

The server supports two transports:

| Transport | Command | Default |
|-----------|---------|---------|
| **stdio** | `promptguard-mcp-server` | Yes |
| **Streamable HTTP** | `promptguard-mcp-server --transport http` | Port 8000 |

### stdio (default)

Used by Cursor, Claude Desktop, VS Code, and most MCP clients. The server communicates via stdin/stdout using JSON-RPC 2.0.

```bash
promptguard-mcp-server
```

### Streamable HTTP

Used for remote/shared deployments. The MCP endpoint is served at `http://HOST:PORT/mcp`.

```bash
promptguard-mcp-server --transport http --host 0.0.0.0 --port 9000
```

## Docker

### stdio mode

```bash
docker run -i --rm \
  -e PROMPTGUARD_API_KEY=pg_xxx \
  abhijoysarkar/promptguard-mcp-server
```

### Streamable HTTP mode

```bash
docker run --rm -p 8000:8000 \
  -e PROMPTGUARD_API_KEY=pg_xxx \
  abhijoysarkar/promptguard-mcp-server \
  --transport http
```

## Available Tools

| Tool | Description | Auth Required |
|------|-------------|:---:|
| `promptguard_auth` | Authenticate with PromptGuard (opens dashboard or saves key) | No |
| `promptguard_logout` | Clear locally stored credentials | No |
| `promptguard_scan_text` | Scan text for prompt injection, jailbreaks, PII, toxic content | Yes |
| `promptguard_scan_project` | Scan a directory for unprotected LLM SDK usage | No |
| `promptguard_redact` | Redact PII from text (emails, phones, SSNs, credit cards) | Yes |
| `promptguard_status` | Check connection status, plan, and API version | No |

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `PROMPTGUARD_API_KEY` | — | API key (starts with `pg_sk_test_` or `pg_sk_prod_`) |
| `PROMPTGUARD_API_URL` | `https://api.promptguard.co` | API base URL (for self-hosted deployments) |
| `TRANSPORT` | `stdio` | Transport type when running via Docker |
| `HOST` | `0.0.0.0` | HTTP bind address |
| `PORT` | `8000` | HTTP port |

When no environment variable is set, the server reads from `~/.promptguard/config.json` (created by `promptguard_auth`).

## Development

```bash
git clone https://github.com/acebot712/promptguard.git
cd promptguard/mcp-server

pip install -e .
promptguard-mcp-server
```

### Building the Docker image

```bash
docker build -t abhijoysarkar/promptguard-mcp-server .
```

### Running tests

```bash
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | promptguard-mcp-server
```

## Links

- [Documentation](https://docs.promptguard.co/tools/mcp)
- [Homepage](https://promptguard.co)
- [Dashboard](https://app.promptguard.co)
- [Issues](https://github.com/acebot712/promptguard/issues)
