Skip to main content

Minimal Redis-backed channel integration for Claude Code

Project description

Claude Code Redis Channels (claude-code-redis-channels)

A minimal Redis-backed channel integration for Claude Code, implemented in Python.

Overview

This package provides an MCP (Model Context Protocol) server that enables Claude Code to receive events and send replies via Redis. It supports multi-agent scenarios, inter-agent synchronization, and a synchronous "await" bridge for external callers.

Features

  • Python-Native: Built with mcp Python SDK and asyncio.
  • Multi-Agent Support: Route messages to specific agents via unique AGENT_ID.
  • Two-Way Support: Reply to messages from Claude Code using a Redis reply tool.
  • Sync-over-Async: Await an agent's response via a blocking HTTP endpoint (GET /await/{agent_id}).
  • Inter-Agent Coordination: Agents can wait for each other indefinitely using the await_message tool.
  • Minimal Dependencies: Only requires mcp, redis, starlette, and uvicorn.

Setup

Requirements

  • Python 3.12+
  • uv (recommended)

Installation

uv tool install .

Configuration

Add the server to your .mcp.json:

{
  "mcpServers": {
    "redis-channel": {
      "command": "uv",
      "args": ["run", "--package", "claude-code-redis-channels", "redis-channel"],
      "env": {
        "REDIS_URI": "redis://localhost:6379",
        "AGENT_ID": "dallas-main",
        "HTTP_PORT": "8000"
      }
    }
  }
}

Await Endpoint (Sync Bridge)

The server can optionally host an HTTP endpoint that blocks until the agent sends a reply. This allows CLI scripts or microservices to "wait" for Claude to finish.

# In one terminal, wait for Claude's next message (indefinite wait)
curl "http://localhost:8000/await/dallas-main"

# In Claude Code:
# > reply chat_id="123" text="Task complete!"

Usage

Start Claude Code with the development channel flag:

claude --dangerously-load-development-channels server:redis-channel

Sending Messages

Send a JSON payload to a specific agent's inbox:

redis-cli PUBLISH claude:inbox:dallas-main '{"content": "Hello Dallas!", "meta": {"chat_id": "123"}}'

Inter-Agent Communication

Agents can wait for each other indefinitely within their session: await_message(target_agent_id="other-agent")

Testing

A manual integration test script is included in scripts/test_mcp.py. It simulates a Claude Code session and verifies Redis communication.

uv run scripts/test_mcp.py

Note: Requires a running Redis instance on localhost:6379.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_code_redis_channels-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_code_redis_channels-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file claude_code_redis_channels-0.1.0.tar.gz.

File metadata

File hashes

Hashes for claude_code_redis_channels-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7af76a5e41cd17aaff58af656dd5cecfb95e508b5ef3fce261589cc2369ecd3
MD5 bac87320abb041cb23c83b437f3dad7f
BLAKE2b-256 86612a0a07998455a7dd48f287b116b2a6ec7d56fcd5fc6a7dd3dbd0f59a9022

See more details on using hashes here.

File details

Details for the file claude_code_redis_channels-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_code_redis_channels-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2bdd16906df8b9c76bf641a260bbcf5e4d214f72472ea642975b7c780097d64
MD5 05c37bbf3073f4ca8c6a8cfc66aa8895
BLAKE2b-256 9e74009bfb1f3346cffa9e5e689253aa12b634782a241d4b651cc01e79a79c0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page