Upstash MCP — Serverless Redis & Kafka for AI Agents
MCP server for Upstash serverless Redis and Kafka. Give AI agents access to caching, rate limiting, pub/sub, and message queues with zero infrastructure. Pay-per-request pricing. 2,000+ stars.
What it is
Upstash MCP is a Model Context Protocol server that gives AI agents access to Upstash's serverless Redis and Kafka services. With this MCP server configured, Claude Code or Cursor can create caches, set rate limits, publish messages, and manage queues through natural language tool calls.
It targets developers who use AI coding agents and need database operations without provisioning or managing infrastructure. Upstash's pay-per-request pricing means you only pay for what your agent uses.
How it saves time or tokens
Without this MCP server, interacting with Redis or Kafka from an AI agent requires pasting connection strings, writing client code, and managing credentials manually in each conversation. The MCP server handles all of this: credentials are configured once, and the agent calls high-level tools like 'set key' or 'publish message' directly.
The estimated token cost for this workflow is approximately 2,400 tokens.
How to use
- Add to your MCP configuration:
{
"mcpServers": {
"upstash": {
"command": "npx",
"args": ["-y", "@upstash/mcp-server"],
"env": {
"UPSTASH_REDIS_REST_URL": "https://your-db.upstash.io",
"UPSTASH_REDIS_REST_TOKEN": "your-token"
}
}
}
}
- Restart your AI agent (Claude Code or Cursor).
- Ask the agent to interact with Redis:
You: Cache the user profile for user_123 with a 1-hour TTL
Agent: I will use the Upstash Redis MCP to set the key...
Example
# Example MCP tool calls the agent makes:
# Set a cache key with TTL
redis.set('user:123:profile', '{"name": "Alice"}', { ex: 3600 })
# Rate limiting check
redis.incr('ratelimit:api:user:123')
redis.expire('ratelimit:api:user:123', 60)
# Pub/Sub publish
redis.publish('notifications', '{"type": "alert", "msg": "deploy done"}')
# Kafka produce (if Kafka is configured)
kafka.produce('events', { key: 'user_123', value: '{"action": "login"}' })
Related on TokRepo
- MCP Integrations -- Database tools and MCP servers for AI agents
- AI Tools for Automation -- Workflow automation with AI agents
Common pitfalls
- Upstash requires an account and API credentials. The MCP server does not work without valid UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN environment variables.
- Pay-per-request pricing can accumulate if the AI agent runs many operations in a loop. Monitor your Upstash dashboard for unexpected usage spikes.
- Kafka features require a separate Upstash Kafka instance with its own credentials. Redis and Kafka are configured independently.
Frequently Asked Questions
Upstash Redis is a serverless, HTTP-based Redis service. You do not manage servers or connections. It uses a REST API instead of the Redis protocol, which makes it work well with serverless functions and MCP servers. Data is persisted and replicated automatically.
The MCP server exposes a curated set of Redis operations optimized for AI agent use cases: key-value operations, lists, sets, sorted sets, and pub/sub. Advanced commands like Lua scripting or cluster management are not exposed.
Yes. Add the MCP server configuration to your Claude Desktop's MCP config file. The same configuration works for Claude Code, Claude Desktop, and Cursor.
Upstash charges per request with a generous free tier. There is no fixed monthly cost for small usage. Check upstash.com for current pricing details and free tier limits.
Upstash encrypts data in transit via HTTPS and at rest. The REST API uses token-based authentication. Do not store unencrypted secrets or PII in Redis keys without your own encryption layer.
Citations (3)
- Upstash MCP GitHub— Upstash MCP server for serverless Redis and Kafka
- Upstash Documentation— Upstash provides serverless Redis with REST API
- MCP Specification— Model Context Protocol for AI agent tool integration