Use for AinrNet Redis,add tools
Project description
mcp-redis-airnet: A Redis MCP Server for AirNet
purpose:base mcp-server-redis add tools get_info、get_list、get_dbsize...
Chagne-Tip:
version = "0.0.1"
1、main.py & init.py invalid syntax:from mcp-redis-airnet import main Revise to from mcp_redis_airnet import main
2、add tools get_info: Get Redis server information
version = "0.0.2"
1、add tools get_list: Get client connection list using Redis CLIENT LIST command
version = "0.0.3"
1、add tools get_dbsize: Get the number of keys in the current database
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
This repository is an example of how to create an MCP server for managing Redis data.
Overview
A Model Context Protocol server for interacting with Redis. It provides tools for setting, retrieving, listing, and deleting keys in Redis.
Components
Tools
The server implements the following tools:
-
set_value: Set a specified key to a given value- Takes a
key(string) and avalue(string) - Returns a confirmation message upon success
- Takes a
-
get_value: Retrieve the value of a specified key- Takes a
key(string) - Returns the value as a string, or
Noneif the key does not exist
- Takes a
-
list_keys: List Redis keys matching a given pattern- Takes a
pattern(default: "*") - Returns a list of matching keys
- Takes a
-
delete_key: Delete a specified key- Takes a
key(string) - Returns the number of keys deleted (0 or 1)
- Takes a
-
get_info: Get Redis server information- Returns Redis server information
-
get_list: Get client connection list using Redis CLIENT LIST command- Returns client connection list
-
get_dbsize: Get the number of keys in the current database- Return redis_client.dbsize()
Configuration
The server connects to Redis using the following environment variables (all are required):
REDIS_HOST: Redis hostREDIS_PORT: Redis portREDIS_DB: Redis database numberREDIS_PASSWORD: Redis password
If any of these variables are missing, the server will raise an error during startup. Make sure to set each of these before running the server.
Quickstart
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"redis": {
"command": "uvx",
"args": [
"mcp-redis-airnet"
]
}
}
Trae Desktop
{
"mcpServers": {
"redis-airnet": {
"command": "uvx",
"args": [
"--from",
"mcp-redis-airnet==0.0.3",
"--refresh-package",
"mcp-redis-airnet",
"mcp-redis-airnet"
],
"env": {
"REDIS_HOST": "192.168.31.158",
"REDIS_PORT": "6379",
"REDIS_DB": "0",
"REDIS_PASSWORD": "cdatc"
}
}
}
}
本地调试运行
{
"mcpServers": {
"redis-debug": {
"command": "uv",
"args": [
"--directory",
"E:\\技术支持室\\Trae\\redis-AirNet\\src\\mcp_redis_airnet\\",
"run",
"server.py"
],
"env": {
"REDIS_HOST": "192.168.31.158",
"REDIS_PORT": "6379",
"REDIS_DB": "0",
"REDIS_PASSWORD": "cdatc"
}
}
}
}
Development
Building and Publishing
To prepare the package for distribution: python -m venv .venv .venv\Scripts\activate python -m ensurepip --upgrade python -m pip install --upgrade pip pip install twine twine check dist/* Checking dist\mcp_redis_airnet-1.0.1-py3-none-any.whl: PASSED Checking dist\mcp_redis_airnet-1.0.1.tar.gz: PASSED
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
uv publish --token pypi-Ag...
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD(PyPI已经移除了对用户名/密码认证的支持)
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory $(PWD) run mcp-redis-airnet
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_redis_airnet-0.0.3.tar.gz.
File metadata
- Download URL: mcp_redis_airnet-0.0.3.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0083f56372b212f506bc07eb2b7c6164203a812269be15bcdb86f822e7f8602d
|
|
| MD5 |
e54384f79fc9c530009f3dd6bc3f459e
|
|
| BLAKE2b-256 |
7d2d7ad0bb4df354b60bdc8832107aa4f0a5e7eb015f3dcce4cc47be4778e818
|
File details
Details for the file mcp_redis_airnet-0.0.3-py3-none-any.whl.
File metadata
- Download URL: mcp_redis_airnet-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bd842a0cccf0b78a188ad615fa04003b86f792b5f2c7ab7ffe16be2c42442d9
|
|
| MD5 |
02f8589bead21efdf2ce0e5826b58863
|
|
| BLAKE2b-256 |
b07c07d5e1928263130e8cb6f9ad4f00e4e3b6e74f02964ef0c914cadecac885
|