Skip to main content
Glama
pottekkat

DiceDB MCP

by pottekkat

DiceDB MCP

DiceDB 的模型上下文协议 (MCP)服务器实现,以实现 AI 应用程序(主机/客户端)和 DiceDB 数据库服务器之间的交互。

此实现使用DiceDB Go SDK与 DiceDB 通信。

观看演示视频来了解其实际效果!

特征

  • PING DiceDB 来检查连接性。

  • 通过 DiceDB 回显一条消息。

  • 按键从 DiceDB 获取值。

  • 在 DiceDB 中设置一个键值对。

  • 从 DiceDB 中删除一个或多个键。

  • 将键的整数值增加一。

  • 将键的整数值减一。

Related MCP server: Database Tools for Claude AI

安装

下载二进制文件

您可以从“发布”页面下载并使用适合您的操作系统和处理器架构的二进制文件。

通过 Go 安装

先决条件:

  • Go 1.24 或更高版本

go install github.com/pottekkat/dicedb-mcp@latest

获取dicedb-mcp二进制文件的路径:

which dicedb-mcp

从源代码构建

请参阅下面的开发部分。

用法

使用 MCP 主机/客户端

将其添加到 Claude Desktop 的claude_desktop_config.json或 Cursor 的mcp.json中:

{
    "mcpServers": {
        "dicedb-mcp": {
            "command": "path/to/dicedb-mcp"
        }
    }
}

使用 OpenAI Agents SDK

下面的示例展示了如何将dicedb-mcp服务器与OpenAI Agents SDK一起使用:

from agents import Agent, Runner, trace
from agents.mcp import MCPServer, MCPServerStdio
from dotenv import load_dotenv
import os
import openai
import asyncio

load_dotenv()


async def run(mcp_server: MCPServer, prompt: str, server_url: str):
    agent = Agent(name="DiceDB MCP",
                  instructions=f"""You can interact with a DiceDB database
                                  running at {server_url}, use
                                  this for url.""",
                  mcp_servers=[mcp_server],)
    result = await Runner.run(starting_agent=agent, input=prompt)
    print(result.final_output)


async def main():
    openai.api_key = os.getenv("OPENAI_API_KEY")

    prompt = "Can you change the value of the 'name' key to 'Rachel Green'?"
    server_url = "localhost:7379"

    async with MCPServerStdio(
        cache_tools_list=True,
        params={"command": "path/to/dicedb-mcp", "args": [""]},
    ) as server:
        with trace(workflow_name="DiceDB MCP"):
            await run(server, prompt, server_url)


if __name__ == "__main__":
    asyncio.run(main())

可用工具

ping

对 DiceDB 服务器执行 ping 操作以检查连接性。

回声

通过 DiceDB 服务器回显消息。

得到

按键从 DiceDB 中检索值。

在 DiceDB 中设置键值对。

删除

从 DiceDB 中删除一个或多个键。

增加

将键的整数值增加一。

降级

将键的整数值减一。

发展

分叉并克隆存储库:

git clone https://github.com/username/dicedb-mcp.git

进入目录:

cd dicedb-mcp

安装依赖项:

make deps

构建项目:

make build

更新您的 MCP 服务器配置以指向本地构建:

{
    "mcpServers": {
        "dicedb-mcp": {
            "command": "/path/to/dicedb-mcp/dist/dicedb-mcp"
        }
    }
}

执照

MIT 许可证

-
security - not tested
A
license - permissive license
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

Appeared in Searches

Latest Blog Posts

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/pottekkat/dicedb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server