← Back to MCP Documentation

Guard MCP API

Rate limiting and cost control for AI agents via Model Context Protocol

Overview

The Guard MCP API provides AI assistants with rate limiting and cost control capabilities. Optimized for AI integrations using the MCP protocol over HTTP transport with JSON-RPC 2.0.

MCP Endpoint

https://mcp.ainoflow.io/mcp/v1/guard

Transport:

HTTP (SSE)

Configuration

OpenAI Agent Builder

Add MCP server in the UI dialog:

URL:
Label:
Authentication (Access token / API Key):
Claude Desktop

Add to your Claude Desktop configuration:

Cursor IDE

Add to your Cursor MCP configuration:

Available Tools

guard_check
Check rate limit and increment execution counter. On first call with rateMax/rateWindow, a policy is auto-created.
key
required
- Guard key identifier (max 512 chars)
rateMax
optional*
- Max executions per window (1–1,000,000)
rateWindow
optional*
- Window size in seconds (1–86,400)
failOpen
optional
- Allow execution when the service is temporarily unavailable (default: false)
allowPolicyOverwrite
optional
- Update stored policy when rateMax/rateWindow differ instead of returning error (default: false)

* Required on first call to auto-create policy. Optional on subsequent calls.

Example Usage (first call):

Allowed Response:

Denied Response:

Check allowed field to determine if execution should proceed

guard_status
Check current counter status without incrementing. Uses stored policies.
key
required
- Guard key identifier

Example:

Response:

guard_reset
Reset rate limit counters for a key. For debugging only.
key
required
- Guard key identifier

Example:

Response:

Available Resources

guard://{key}
Read-only resource for checking counter status

MIME Type: application/json

Returns: {"key":"send-emails","exists":true,"rateLimit":{"current":42,"max":100,"window":3600,"resetsIn":2145}}

Use Cases for AI Assistants

Rate-Limited API Calls

Prevent expensive API overuse

Cost Budget Enforcement

Cap expensive operations per time window

Combined with Shield

Rate limit + deduplication

Check Before Batch

Check remaining budget before starting

Constraints and Limits
Key specifications for Guard operations
Key lengthMax 512 characters
rateMax range1 to 1,000,000
rateWindow range1 to 86,400 seconds
AlgorithmFixed window
Policy cache TTL5 minutes
Denied requestsNot counted toward limit
REST API Compatibility
Both MCP and REST APIs can be used simultaneously
REST APIMCP Tool
POST /guard/{key}/counterguard_check
GET /guard/{key}/counterguard_status
DELETE /guard/{key}/counterguard_reset

Ready to integrate Guard MCP?

Sign up for free and start rate-limiting your AI agent tasks