Back to MCP directory
publicPublicdnsLocal runtime

unstorage-mcp

基于unjs/unstorage的键值存储MCP服务器,支持多种存储驱动如内存、文件系统、Redis、HTTP服务器和MongoDB,提供丰富的存储操作工具。

article

README

🚀 未存储服务器

未存储服务器提供了灵活的存储配置和扩展能力,可根据不同需求进行定制化部署,支持多种存储类型和环境变量配置。

🚀 快速开始

要使用未存储服务器,你需要进行相应的配置和安装,以下是详细步骤。

📦 安装指南

最小配置

{
  "unstorage": {
    "adapter": "default"
  }
}

最大配置

{
  "unstorage": {
    "adapter": "default",
    "options": {
      "host": "localhost",
      "port": 3001,
      "prefix": "/api/v1/storage"
    }
  }
}

🔧 环境变量

Redis 配置

UNSTORAGE_REDIS_URL=redis://default:password@localhost:6379
UNSTORAGE_REDIS_BASE=my:mcp:values:
UNSTORAGE_REDIS_MOUNTPOINT=/my/redis/mountpoint

HTTP 服务器配置

UNSTORAGE_HTTP_BASE=http://localhost:3001
UNSTORAGE_HTTP_MOUNTPOINT=/http/mountpoint
UNSTORAGE_HTTP_HEADERS="Authorization=Bear 123;A=1;B=2"

文件系统配置

UNSTORAGE_FS_BASE=/path/to/base/directory
UNSTORAGE_FS_MOUNTPOINT=/fs/mountpoint

📚 详细文档

扩展指南

  1. 克隆此仓库。
  2. 拷贝 src/storage/redis.ts 到一个新的文件并根据需求修改它(unjs/unstorage 的学习曲线非常友好)。
  3. 测试并验证效果。
  4. (可选)提交一个合并请求。

如果你不是 TypeScript 开发者,请提交一个问题以请求其他驱动支持。

对于 cursor/cline 协助编程的提示

@/src/storage/mongodb.ts ,请实现这个文件:
1. 你需要使用存储类型的相应文档 URL(https://unstorage.unjs.io/drivers/<存储类型>)获取信息。
2. 可以参考 @/src/adapter/redis.ts 和 @/src/storage/http.ts 中的例子。
3. 你只需要生成代码,而不需要执行测试。

> 如果你没有安装 fetch MCP 服务器,请删除第一句话

调试方法

使用 mcp-inspector

mcp-inspector -e HTTP_BASE=http://localhost:3001 -e HTTP_MOUNT_POINT=http_storage -e FS_BASE=D:/temp -e FS_MOUNT_POINT=fs_storage -e HTTP_HEADERS="Authorization=Bear 123;" tsx ./src/index.ts

使用 tsx 配置本地开发

{
  "mcpServers": {
    "command": "cmd",
    "env": {
      "REDIS_URL": "redis://default:password@localhost:6379",
      "REDIS_BASE": "my:mcp:values:",
      "REDIS_MOUNT_POINT": "/my/redis/mountpoint"
    },
    "args": ["/c", "tsx", "D:/xxx/projects/unstorage-mcp/src/index.ts"]
  }
}

⚠️ 重要提示

重启服务器以使更改生效。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client