mcp-server-dify
by: yuru-sha
Sample MCP Server for Dify AI
📌Overview
Purpose: The framework is designed to facilitate communication between large language models (LLMs) and Dify AI through a standardized Model Context Protocol.
Overview: The mcp-server-dify serves as a Model Context Protocol server that enables seamless interaction with Dify AI's chat completion features. It allows developers to integrate advanced dialog capabilities and context management, ensuring a rich user experience.
Key Features:
-
Integration with Dify AI: Connects effortlessly to Dify AI’s chat completion API, enabling dynamic conversational interactions.
-
Restaurant Recommendation Tool: Known as meshi-doko, this feature provides users with personalized restaurant recommendations based on parameters like location and budget constraints.
-
Support for Conversation Context: Maintains the state of the conversation, allowing for more coherent exchanges over multiple interactions.
-
Streaming Response Support: Delivers responses in real-time, enhancing user engagement and satisfaction during conversations.
-
TypeScript Implementation: The server is built with TypeScript, ensuring type safety and better maintainability of the codebase.
mcp-server-dify
Model Context Protocol Server for Dify AI. This server enables LLMs to interact with Dify AI's chat completion capabilities through a standardized protocol.
Features
- Integration with Dify AI chat completion API
- Restaurant recommendation tool (meshi-doko)
- Support for conversation context
- Streaming response support
- TypeScript implementation
Installation
Using Docker
# Build the Docker image
make docker
# Run with Docker
docker run -i --rm mcp/dify https://your-dify-api-endpoint your-dify-api-key
Usage
With Claude Desktop
Add the following configuration to your claude_desktop_config.json
:
{
"mcpServers": {
"dify": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-dify",
"https://your-dify-api-endpoint",
"your-dify-api-key"
]
}
}
}
Replace your-dify-api-endpoint
and your-dify-api-key
with your actual Dify API credentials.
Tools
meshi-doko
Restaurant recommendation tool that interfaces with Dify AI:
Parameters:
LOCATION
(string): Location of the restaurantBUDGET
(string): Budget constraintsquery
(string): Query to send to Dify AIconversation_id
(string, optional): For maintaining chat context
Development
# Initial setup
make setup
# Build the project
make build
# Format code
make format
# Run linter
make lint
License
This project is released under the MIT License.
Security
This server interacts with Dify AI using your provided API key. Ensure to:
- Keep your API credentials secure
- Use HTTPS for the API endpoint
- Never commit API keys to version control
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.