npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dfs-mcp

v5.0.0

Published

本地MCP服务器,用于将文件上传到dfs,支持多配置和目录指定

Readme

DFS MCP 服务器 🚀

中文版 | English

一个基于Model Context Protocol (MCP)的服务器,用于将文件上传到DFS服务器。此服务器使大型语言模型能够直接将文件上传到分布式文件系统。

💡 使用场景

DFS MCP服务器能够与其他MCP工具无缝集成,为您提供强大的工作流程:

  • Playwright MCP集成:可以先使用Playwright MCP抓取网页截图或下载网页资源,然后直接上传到DFS存储。
  • Figma MCP集成:下载图片资源到本地后直接上传DFS、或者Figma网络文件直接上传DFS。
  • Filesystem MCP集成:可以浏览和选择本地文件系统中的文件,然后一步上传到DFS存储。
  • 数据备份流程:将重要数据从本地或其他服务自动备份到DFS。
  • 媒体处理流程:结合其他处理工具,可以对图片、视频进行处理后直接上传并获取可访问的URL。

✨ 功能特点

  • 📁 支持文件上传到DFS服务器
  • 🔄 简单易用的接口
  • ⚡ 基于HTTP multipart/form-data上传

🔧 安装

您可以通过npm或从源码安装:

使用npm安装

# 使用npm全局安装
npm install -g dfs-mcp

# 或使用pnpm全局安装
pnpm add -g dfs-mcp

使用示例

# 直接启动 (stdio模式)
dfs-mcp --dfs-url="http://dfs-service:31001/fileupload"

# 使用Inspector调试
dfs-mcp --dfs-url="http://dfs-service:31001/fileupload" --inspect

从源码安装

# 克隆仓库
git clone http://10.0.0.152/business/qproducts/backend/typescript/dfs-mcp.git
cd dfs-mcp

# 安装依赖
pnpm install

# 构建项目
pnpm build

⚙️ 配置

您可以通过以下方式配置DFS服务参数:

方式一:使用.env文件

在项目根目录创建.env文件,参考.env.example模板:

# DFS服务URL
DFS_SERVICE_URL=http://dfs-service:31001/fileupload

方式二:直接设置环境变量

您也可以直接在系统中或启动命令中设置环境变量:

# 设置环境变量并启动
pnpm dev --dfs-url="http://your-dfs-server:port/upload"

🔍 参数说明

  • DFS_SERVICE_URL: DFS服务的上传接口URL(默认:http://dfs-service:31001/fileupload)

📋 使用方法

命令行选项

选项:
  -s, --stdio    使用stdio传输启动服务器
  -h, --http     使用HTTP传输启动服务器
  -p, --port     HTTP服务器端口 (默认: 3000)
  -i, --inspect  使用Inspector工具启动
  -?, --help     显示帮助信息

📡 传输模式

DFS MCP 服务器支持两种传输模式:

Stdio 模式(本地集成)

适用于 Claude Desktop、Cursor 等本地 AI 工具的直接集成。

特点

  • ✅ 简单配置
  • ✅ 自动启动
  • ❌ 仅限本地访问

HTTP/SSE 模式(远程访问)

适用于需要远程访问或 Web 应用集成的场景。

特点

  • ✅ 支持远程访问
  • ✅ 可多客户端连接
  • ❌ 需要手动启动服务器

🚀 HTTP 模式启动

从源码启动 HTTP 服务器

# 开发模式(默认端口 3000)
pnpm dev

# 生产模式启动 HTTP 服务
pnpm start:http

# 或直接运行(默认 HTTP 模式)
pnpm build
node dist/index.js

# 指定端口
PORT=8080 node dist/index.js

# 使用 Inspector 调试
pnpm inspect

全局安装后启动 HTTP 服务器

# 默认端口 3000
dfs-mcp --dfs-url="http://dfs-service:31001/fileupload"

# 指定端口
dfs-mcp --dfs-url="http://dfs-service:31001/fileupload" --port 8080

HTTP 端点

  • SSE 连接:http://localhost:3000/sse
  • 消息端点:http://localhost:3000/messages

从源码启动(Stdio 模式)

# 启动服务 (stdio模式)
pnpm start:stdio

# 或使用环境变量
NODE_ENV=cli node dist/index.js

🛠️ 与 Claude/Cursor 配置集成

Cursor 配置方法(Stdio 模式)

适用于本地开发,Cursor 会自动启动和管理 MCP 服务器。

方式一:从 npm 安装(推荐)

  1. 在 Cursor 中打开设置(Settings)
  2. 转到 MCP 服务器(MCP Servers)部分
  3. 添加新服务器配置:
{
  "mcpServers": {
    "dfs-mcp": {
      "command": "npx",
      "args": [
        "dfs-mcp",
        "--dfs-url=http://dfs-service:31001/fileupload",
        "--stdio"
      ]
    }
  }
}

方式二:从 Git 仓库安装

适用于需要使用最新开发版本或私有仓库的场景。

  1. 在 Cursor 中打开设置(Settings)
  2. 转到 MCP 服务器(MCP Servers)部分
  3. 添加新服务器配置:
{
  "mcpServers": {
    "dfs-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "http://10.0.0.152/business/qproducts/backend/typescript/dfs-mcp.git",
        "--stdio"
      ]
    }
  }
}

注意事项

  • 使用 -y 参数自动确认安装
  • 确保有访问 Git 仓库的权限
  • 如果是私有仓库,可能需要配置 Git 凭证
  • 首次启动时会自动从 Git 仓库克隆并安装依赖

Cursor 配置方法(HTTP 模式)

适用于连接到远程 DFS MCP 服务器。

步骤 1:启动 HTTP 服务器

在服务器上运行:

# 使用默认端口 3000
dfs-mcp --dfs-url="http://dfs-service:31001/fileupload"

# 或指定端口
PORT=8080 dfs-mcp --dfs-url="http://dfs-service:31001/fileupload"

步骤 2:配置 Cursor

在 Cursor 的 MCP 设置中添加:

{
  "mcpServers": {
    "dfs-mcp-remote": {
      "transport": {
        "type": "sse",
        "url": "http://your-server-ip:3000/sse"
      }
    }
  }
}

注意事项

  • your-server-ip 替换为实际的服务器 IP 地址或域名
  • 确保服务器端口(默认 3000)可以被 Cursor 访问
  • 如果使用防火墙,需要开放相应端口

配置对比

| 配置方式 | 适用场景 | 优点 | 缺点 | |---------|---------|------|------| | Stdio 模式 | 本地开发 | 自动启动、配置简单 | 仅限本地 | | HTTP 模式 | 远程访问、团队共享 | 支持远程、多客户端 | 需手动启动服务器 |


## 🧰 可用工具

服务器提供以下工具:

### 1. 上传文件到DFS (`upload_to_dfs`)

**参数**:
- `filePath`: 本地文件路径(必需)
- `fileName`: 文件名(可选,默认使用原文件名)

## 📦 发布

```bash
# 发布到npm
pnpm pub:release

# 本地打包测试
pnpm publish:local

📊 Star History

Star History Chart

📄 许可证

MIT