REST API Reference
The MCP Shield REST API allows you to programmatically manage providers, invoke MCP tools, configure policies, and query audit logs.
Base URL
https://api.mcpshield.comAll API requests should be made to this base URL. The API is versioned via URL path (e.g., /v1/).
Authentication
Authenticate API requests using Bearer tokens in the Authorization header:
curl https://api.mcpshield.com/v1/mcps \
-H "Authorization: Bearer mcp_live_xxxxxxxxxxxxx" \
-H "Content-Type: application/json"Token Types
User tokens (mcp_live_) are tied to a user session.
Service tokens (svc_live_) are for automation and CI/CD.
Quick Example
Invoke an MCP tool and receive a governed response:
curl -X POST https://api.mcpshield.com/v1/mcps/github:list_repos/invoke \
-H "Authorization: Bearer mcp_live_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"input": {
"limit": 5
}
}'{
"result": {
"repositories": [
{
"name": "project-a",
"visibility": "private",
"updated_at": "2024-01-15T14:32:00Z"
}
]
},
"governance": {
"decision": "allow",
"policy": "default-allow-read",
"dlp_result": "passed",
"audit_event_id": "evt_xxxxx"
}
}Endpoints
Authentication
/v1/auth/tokenExchange credentials for access token
/v1/auth/refreshRefresh an access token
/v1/auth/tokenRevoke a token
MCPs
/v1/mcpsList available MCP tools
/v1/mcps/{id}Get MCP tool details
/v1/mcps/{id}/invokeInvoke an MCP tool
Providers
/v1/providersList connected providers
/v1/providers/{slug}/connectInitiate provider OAuth
/v1/providers/{id}Disconnect a provider
/v1/providers/{id}/refreshRefresh provider credentials
Policies
/v1/policiesList policies
/v1/policies/{id}Get policy details
/v1/policies/simulateSimulate policy evaluation
Audit
/v1/audit/eventsList audit events
/v1/audit/events/{id}Get audit event details
/v1/audit/exportExport audit logs
Response Format
All API responses follow a consistent JSON format:
{
"data": { ... }, // Response data
"governance": { // Governance metadata (for MCP invocations)
"decision": "allow",
"policy": "policy-name",
"dlp_result": "passed",
"audit_event_id": "evt_xxxxx"
},
"meta": { // Pagination and request metadata
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T14:32:00Z"
}
}Error Handling
Errors return appropriate HTTP status codes with a JSON error body:
{
"error": {
"code": "policy_denied",
"message": "Request denied by policy: block-production-writes",
"details": {
"policy": "block-production-writes",
"reason": "Write operations to production are not allowed for this user"
}
},
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T14:32:00Z"
}
}| Status | Description |
|---|---|
| 400 | Bad request - invalid input |
| 401 | Unauthorized - invalid or missing token |
| 403 | Forbidden - policy denied the request |
| 404 | Not found - resource does not exist |
| 429 | Rate limited - too many requests |
| 500 | Server error - internal error |
Rate Limits
API requests are rate limited based on your plan:
| Plan | Requests/min | MCP Invocations/min |
|---|---|---|
| Free | 60 | 10 |
| Pro | 600 | 100 |
| Enterprise | Custom | Custom |
Rate limit headers are included in all responses: X-RateLimit-Limit,X-RateLimit-Remaining, X-RateLimit-Reset.
SDKs
Use our official SDKs for a better developer experience: