Skip to content

Fixing CI issues and adding tests for the list of tools #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Redis MCP Server
[![Integration](https://github.com/redis/mcp-redis/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/redis/lettuce/actions/workflows/integration.yml)
[![Integration](https://github.com/redis/mcp-redis/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/redis/mcp-redis/actions/workflows/ci.yml)
[![Python Version](https://img.shields.io/badge/python-3.13%2B-blue)](https://www.python.org/downloads/)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
[![smithery badge](https://smithery.ai/badge/@redis/mcp-redis)](https://smithery.ai/server/@redis/mcp-redis)
[![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/70102150-efe0-4705-9f7d-87980109a279)
[![codecov](https://codecov.io/gh/redis/mcp-redis/branch/master/graph/badge.svg?token=yenl5fzxxr)](https://codecov.io/gh/redis/mcp-redis)
![Docker Image Version](https://img.shields.io/docker/v/mcp/redis?sort=semver&logo=docker&label=Docker)


[![Discord](https://img.shields.io/discord/697882427875393627.svg?style=social&logo=discord)](https://discord.gg/redis)
Expand Down
3 changes: 3 additions & 0 deletions src/common/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
import pkgutil
from mcp.server.fastmcp import FastMCP


def load_tools():
import src.tools as tools_pkg

for _, module_name, _ in pkgutil.iter_modules(tools_pkg.__path__):
importlib.import_module(f"src.tools.{module_name}")


# Initialize FastMCP server
mcp = FastMCP("Redis MCP Server", dependencies=["redis", "dotenv", "numpy"])

Expand Down
7 changes: 4 additions & 3 deletions src/tools/json.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import json
from typing import Union, Mapping, List, TYPE_CHECKING, Any
from typing import Union, Mapping, List, TYPE_CHECKING
from redis.exceptions import RedisError

from src.common.connection import RedisConnectionManager
from src.common.server import mcp

# Define JsonType for type checking to match redis-py definition
# Use object as runtime type to avoid issubclass() issues with Any in Python 3.10
if TYPE_CHECKING:
JsonType = Union[
str, int, float, bool, None, Mapping[str, "JsonType"], List["JsonType"]
]
else:
# Use Any at runtime to avoid Pydantic issues with recursive types
JsonType = Any
# Use object at runtime to avoid MCP framework issubclass() issues
JsonType = object


@mcp.tool()
Expand Down
4 changes: 3 additions & 1 deletion src/tools/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@


@mcp.tool()
async def set(key: str, value: Union[str, bytes, int, float, dict], expiration: int = None) -> str:
async def set(
key: str, value: Union[str, bytes, int, float, dict], expiration: int = None
) -> str:
"""Set a Redis string value with an optional expiration time.

Args:
Expand Down
Loading
Loading