MCP ExplorerExplorer

Dify Plugin Tools Mcp Config During Use

@arrenxxxxxon a year ago
4 MIT
FreeCommunity
AI Systems
A Dify plugin for configuring MCP connections and tools during runtime.

Overview

What is Dify Plugin Tools Mcp Config During Use

dify-plugin-tools-mcp_config_during_use is a Dify plugin that allows users to configure Model Context Protocol (MCP) connections dynamically during runtime. It facilitates the discovery and invocation of tools via the MCP protocol using HTTP with Server-Sent Events (SSE) transport.

Use cases

Use cases include dynamically listing tools available on an MCP server for user selection, invoking specific tools based on user input or application logic, and configuring connection parameters at runtime for improved flexibility and control.

How to use

To use the plugin, you can call the mcp_list_tools to retrieve a list of available tools on an MCP server, or use mcp_call_tool to invoke a specific tool. You need to provide the server URL, optional HTTP headers, and timeout settings in JSON format.

Key features

Key features include the ability to configure MCP server connection information for each call, list available tools on MCP servers, call specific tools, support for HTTP headers for authorization, and configuration of different timeout parameters.

Where to use

This plugin can be used in various fields that require dynamic interaction with tools via the MCP protocol, such as software development, data processing, and real-time applications that need to leverage multiple services.

Content

MCP Config During Use

A Dify plugin that allows configuring MCP (Model Context Protocol) connections during use. It enables discovering and calling tools via MCP protocol through HTTP with SSE transport, with configuration done at runtime.

English | 中文简体

Features

  • Configure MCP server connection information for each call separately
  • List available tools on MCP servers
  • Call specific tools on MCP servers
  • Support HTTP headers configuration for authorization and other features
  • Configure different timeout parameters

Tool List

The plugin provides two main tools:

  1. List MCP Tools (mcp_list_tools)

    • Used to list all available tools on an MCP server
  2. Call MCP Tool (mcp_call_tool)

    • Used to call a specific tool on an MCP server

Usage

List MCP Tools

Use the mcp_list_tools tool to list all available tools on a specified MCP server.

Parameters:

  • server_url (required): The SSE endpoint URL of the MCP Server
  • headers (optional): HTTP headers in JSON format
  • timeout (optional): HTTP request timeout in seconds
  • sse_read_timeout (optional): SSE read timeout in seconds

Example:

{
  "server_url": "http://127.0.0.1:8000/sse",
  "headers": "{\"Authorization\":\"Bearer your_token\"}",
  "timeout": 60,
  "sse_read_timeout": 300
}

Call MCP Tool

Use the mcp_call_tool tool to call a specific tool on an MCP server.

Parameters:

  • server_url (required): The SSE endpoint URL of the MCP Server
  • headers (optional): HTTP headers in JSON format
  • timeout (optional): HTTP request timeout in seconds
  • sse_read_timeout (optional): SSE read timeout in seconds
  • tool_name (required): Name of the tool to execute
  • arguments (required): Tool arguments in JSON format

Example:

{
  "server_url": "http://127.0.0.1:8000/sse",
  "headers": "{\"Authorization\":\"Bearer your_token\"}",
  "timeout": 60,
  "sse_read_timeout": 300,
  "tool_name": "example_tool",
  "arguments": "{\"param1\":\"value1\",\"param2\":123}"
}

Differences from Pre-authorized MCP Tools

Compared to pre-authorized MCP tools, the main differences of this plugin are:

  1. Configuration Method: This plugin allows configuring connection information at call time, while pre-authorized MCP tools require configuration at the provider level
  2. Flexibility: Different tool calls can connect to different MCP servers
  3. Isolation: Each application can use its own MCP server configuration without affecting others
  4. Permission Management: No need for global authorization at the provider level, providing more flexible permission control

Requirements

  • Python 3.12 or higher
  • Dependencies:
    • httpx >= 0.27.0
    • httpx-sse >= 0.4.0
    • dify_plugin = 0.0.1b76

Notes

  • Ensure the provided MCP server URL is valid and supports SSE connections
  • In the headers and arguments parameters, JSON objects need to be converted to strings with properly escaped double quotes
  • Adjust timeout parameters as needed, especially for long-running tool calls

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers