ZM

zhjch05/mcp-plugins

Analytics & monitoring

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

6 stars 2 forks Качество 59 Тренд 14Apache-2.0

Add plugins like observability, timeout, timing, ratelimiting, guardrails, human-in-the-loop to your MCPs

Обзор

This package is currently in experimental mode and may contain bugs, breaking changes, or incomplete features. Use at your own risk in development and testing environments only. A collection of MCP middleware plugins based on FastMCP to add features like observability, error handling, guardrails, allowlists, and human-in-the-loop etc. for your MCP. Can be called from python code or through a cli proxy on top of MCP. This package provides both custom middleware plugins and integrates with FastMCP's built-in middleware system. Each middleware has its own detailed documentation: : When multiple MCP servers are joined together, the tool names to be allowed or denied would be in the format " _ ". For example, if you have a server named "weather" with a tool "get_forecast", you would reference it as "weather_get_forecast" in your allowlist or denylist configuration. You may use MCP inspector to check the exact tool names.

README

Показан фрагмент оригинального README. Открыть оригинал.

MCP Plugins

🚧 Experimental - Not Recommended for Production Use
This package is currently in experimental mode and may contain bugs, breaking changes, or incomplete features. Use at your own risk in development and testing environments only.

A collection of MCP middleware plugins based on FastMCP to add features like observability, error handling, guardrails, allowlists, and human-in-the-loop etc. for your MCP. Can be called from python code or through a cli proxy on top of MCP.

Quick Start

pip install mcp-plugins

Usage with python (FastMCP)

from fastmcp import FastMCP

from mcp_plugins import ToolLoggingMiddleware

MCP_CONFIG = {
    "hackernews": {
      "command": "uvx",
      "args": ["mcp-hn"],
      "transport": "stdio"
    },
    "every": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-everything"],
      "transport": "stdio"
    }
}

server = FastMCP.as_proxy(MCP_CONFIG, name="MCP-HN with Tool Logging")

server.add_middleware(
    ToolLoggingMiddleware(
        log_tool_metadata=True,
        log_arguments=True,
        log_results=True,
        include_timestamps=True,
        max_log_length=1000,
    )
)

server.run(transport="streamable-http", host="0.0.0.0", port=9000)

Usage with config.json via cli proxy

mcp-plugins run config.json --transport streamable-http --host 0.0.0.0 --port 9000

config.json

{
  "mcpServers": {
    "hackernews": {
      "command": "uvx",
      "args": ["mcp-hn"],
      "transport": "stdio"
    },
    "every": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-everything"],
      "transport": "stdio"
    }
  },
  "plugins": [
    {
      "type": "tool_logging",
      "config": {
        "enabled": true,
        "log_tool_metadata": true,
        "log_arguments": true,
        "log_results": true,
        "include_timestamps": true,
        "max_log_length": 1000,
        "log_format": "human"
      }
    }
  ]
}

Available Middleware

This package provides both custom middleware plugins and integrates with FastMCP’s built-in middleware system. Each middleware has its own detailed documentation:

⚠️ Important Caveat: When multiple MCP servers are joined together, the tool names to be allowed or denied would be in the format "_". For example, if you have a server named “weather” with a tool “get_forecast”, you would reference it as “weather_get_forecast” in your allowlist or denylist configuration. You may use MCP inspector to check the exact tool names.

Custom Middleware Plugins

Logging

Human-in-the-Loop

Открыть полный README на GitHub

Установка

uvx mcp-hn
Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "hackernews": { "command": "uvx", "args": ["mcp-hn"], "transport": "stdio" }, "every": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"], "transport": "stdio" } }, "plugins": [ { "type": "tool_logging", "config": { "enabled": true, "log_tool_metadata": true, "log_arguments": true, "log_results": true, "include_timestamps": true, "max_log_length": 1000, "log_format": "human" } } ] }