Skip to main content

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.

PyPI version

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 a value (string)
    • Returns a confirmation message upon success
  • get_value: Retrieve the value of a specified key

    • Takes a key (string)
    • Returns the value as a string, or None if the key does not exist
  • list_keys: List Redis keys matching a given pattern

    • Takes a pattern (default: "*")
    • Returns a list of matching keys
  • delete_key: Delete a specified key

    • Takes a key (string)
    • Returns the number of keys deleted (0 or 1)
  • 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 host
  • REDIS_PORT: Redis port
  • REDIS_DB: Redis database number
  • REDIS_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

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build

This will create source and wheel distributions in the dist/ directory.

  1. 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: --token or UV_PUBLISH_TOKEN
  • Or username/password: --username/UV_PUBLISH_USERNAME and --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.

Metadata

Release files for mcp-redis-airnet 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-redis-airnet 0.0.3
File Size Uploaded Provenance
mcp_redis_airnet-0.0.3.tar.gz 15.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-redis-airnet 0.0.3
File Interpreter ABI Platform
mcp_redis_airnet-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / mcp_redis_airnet-0.0.3.tar.gz

Download URL mcp_redis_airnet-0.0.3.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0083f56372b212f506bc07eb2b7c6164203a812269be15bcdb86f822e7f8602d
BLAKE2b-256 checksum
How to use checksums
7d2d7ad0bb4df354b60bdc8832107aa4f0a5e7eb015f3dcce4cc47be4778e818
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release files / mcp_redis_airnet-0.0.3-py3-none-any.whl

Download URL mcp_redis_airnet-0.0.3-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bd842a0cccf0b78a188ad615fa04003b86f792b5f2c7ab7ffe16be2c42442d9
BLAKE2b-256 checksum
How to use checksums
b07c07d5e1928263130e8cb6f9ad4f00e4e3b6e74f02964ef0c914cadecac885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Security for mcp-redis-airnet 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page