MCP setup
The @policygrain/mcp server wraps @policygrain/sdk over stdio JSON-RPC 2.0, reads POLICYGRAIN_API_KEY from the environment only, and redacts any credential prefixes from logs and errors.
Install and configure @policygrain/mcp
Add the PolicyGrain MCP server to your Claude Code, Cursor or Codex MCP configuration. No API key is required for public CheckMyDPDP scans; authenticated PolicyGrain routes read POLICYGRAIN_API_KEY from the process environment.
json
{
"mcpServers": {
"policygrain": {
"command": "npx",
"args": ["-y", "@policygrain/mcp"],
"env": {
"POLICYGRAIN_API_KEY": "${POLICYGRAIN_API_KEY}",
"POLICYGRAIN_API_URL": "https://api.policygrain.com"
}
}
}
}Passing POLICYGRAIN_API_KEY safely
Pass POLICYGRAIN_API_KEY by environment variable reference only. Never paste a pgk_ key into committed config files. The server strips pgk_, pgs_, pgr_ and pgt_ prefixes before writing any diagnostic or error message.
All 16 MCP tools
| Tool | Backed route | Auth |
|---|---|---|
| checkmydpdp_scan | POST /v1/scans | Optional (keyless or Bearer) |
| checkmydpdp_get_scan | GET /v1/scans/{id} | None (capability id) |
| checkmydpdp_create_handoff | POST /v1/scans/{id}/handoff | Bearer |
| policygrain_account | GET /v1/account | Bearer |
| policygrain_list_questions | GET /v1/questions | None |
| policygrain_list_profiles | GET /v1/profiles | Bearer |
| policygrain_create_profile | POST /v1/profiles | Bearer |
| policygrain_update_profile | PATCH /v1/profiles/{id} | Bearer |
| policygrain_generate_documents | POST /v1/generations | Bearer |
| policygrain_get_generation | GET /v1/generations/{id} | Bearer |
| policygrain_list_documents | GET /v1/documents | Bearer |
| policygrain_get_document_version | GET /v1/documents/{id}/versions/{n} | Bearer |
| policygrain_publish_document | PUT /v1/documents/{id}/publication | Bearer |
| policygrain_list_sites | GET /v1/sites | Bearer |
| policygrain_verify_domain | POST /v1/sites/{id}/domains/{domain}/verify | Bearer |
| policygrain_start_verification | POST /v1/sites/{id}/verifications | Bearer |