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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wallacewen/dify-mcp-server

v1.0.0

Published

Model Context Protocol server for Dify AI integration - supports server management, monitoring, and system tools

Downloads

21

Readme

Dify MCP Server

npm version License: MIT

A Model Context Protocol (MCP) server that integrates with Dify AI to provide server management, monitoring, and system administration tools through conversational AI.

Features

  • 🧹 Log Cleaning: Automated server log cleaning and maintenance
  • 🚀 Server Deployment: Environment deployment and Jenkins integration
  • 📊 Server Monitoring: Real-time server resource monitoring (CPU, memory, disk)
  • 🔧 System Tools: Network connectivity checks, port monitoring, and system utilities
  • 🔒 Secure Configuration: Environment-based configuration for sensitive data
  • 🎯 MCP Compatible: Works with Claude Desktop and other MCP clients

Installation

npm install -g @wallacewen/dify-mcp-server

Or with pnpm:

pnpm add -g @wallacewen/dify-mcp-server

Configuration

Required Environment Variables

Before using the server, you must configure these environment variables:

| Variable | Description | Required | |----------|-------------|----------| | DIFY_API_TOKEN | Your Dify API authentication token | ✅ | | DIFY_BASE_URL | Base URL of your Dify instance | ✅ | | DIFY_DEFAULT_USER | Default user ID for Dify API requests | ✅ |

Environment Setup

Create a .env file or set environment variables:

# .env file
DIFY_API_TOKEN=your_dify_api_token_here
DIFY_BASE_URL=https://your-dify-instance.com
DIFY_DEFAULT_USER=your_user_id_here

Or export them in your shell:

export DIFY_API_TOKEN="your_dify_api_token_here"
export DIFY_BASE_URL="https://your-dify-instance.com"
export DIFY_DEFAULT_USER="your_user_id_here"

Claude Desktop Configuration

Add the server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "dify-server": {
      "command": "dify-mcp-server",
      "env": {
        "DIFY_API_TOKEN": "your_dify_api_token_here",
        "DIFY_BASE_URL": "https://your-dify-instance.com",
        "DIFY_DEFAULT_USER": "your_user_id_here"
      }
    }
  }
}

Usage

Once configured, the server provides the following tools through your MCP client:

🧹 Log Cleaning (dify_log_clean)

Clean server logs and manage log files:

Query: "清理服务器日志,10.0.19.41"
Query: "清理10.0.19.41 /var/log 目录下的旧日志文件"

🚀 Server Deployment (dify_server_deployment)

Manage server deployments and Jenkins integration:

Query: "服务器环境到jenkins"
Query: "配置生产环境jenkins"

📊 Server Monitoring (dify_server_monitoring)

Monitor server resources and performance:

Query: "查看服务器10.0.19.41的CPU和内存使用情况"
Query: "监控生产环境服务器资源状态"

🔧 System Tools (dify_system_tools)

Execute system utilities and checks:

Query: "检查网络连通性ping baidu.com"
Query: "查看磁盘空间df -h"
Query: "检查端口8080占用netstat -tulpn | grep 8080"

Development

Prerequisites

  • Node.js >= 18.0.0
  • pnpm (recommended) or npm

Setup

  1. Clone the repository:
git clone https://github.com/wallacewen/dify-mcp-server.git
cd dify-mcp-server
  1. Install dependencies:
pnpm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your configuration
  1. Build the project:
pnpm run build
  1. Run in development mode:
pnpm run dev

Testing

Run the test suite:

pnpm test

Run tests with coverage:

pnpm run test:coverage

Code Quality

Format code:

pnpm run format

Lint code:

pnpm run lint

Type check:

pnpm run check-types

Run all checks:

pnpm run ci

How to Get Dify Configuration

1. Get Your Dify API Token

  1. Log in to your Dify instance
  2. Go to your application settings
  3. Navigate to the "API Access" section
  4. Copy your API key

2. Get Your Dify Base URL

This is the base URL of your Dify instance, for example:

  • https://api.dify.ai (for Dify Cloud)
  • https://your-domain.com (for self-hosted)

3. Get Your User ID

The user ID can be found in:

  • Your Dify application logs
  • API response headers
  • Contact your Dify administrator

Troubleshooting

Common Issues

Missing Environment Variables

❌ Missing required environment variables:
   DIFY_API_TOKEN
   DIFY_BASE_URL
   DIFY_DEFAULT_USER

Solution: Ensure all required environment variables are set correctly.

Connection Errors

  • Verify your DIFY_BASE_URL is correct and accessible
  • Check your DIFY_API_TOKEN is valid and has proper permissions
  • Ensure your network allows connections to the Dify instance

Authentication Errors

  • Verify your API token is correct
  • Check if the token has expired
  • Ensure the user ID has proper permissions

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

License

MIT © Wallace Wen

Support