from mcp.server.fastmcp import FastMCP
from redis.exceptions import RedisError
from connection import redis_client
from server import mcp
@mcp.tool()
def publish_message(channel: str, message: str) -> str:
"""Publish a message to a Redis channel
Args:
channel: Channel name
message: Message to publish
"""
try:
receivers = redis_client.publish(channel, message)
return f"Message published to {receivers} subscribers"
except RedisError as e:
return f"Error: {str(e)}"
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/prajwalnayak7/mcp-server-redis'
If you have feedback or need assistance with the MCP directory API, please join our Discord server