
zhjch05/mcp-plugins
Analytics & monitoring이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
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
- SimpleLoggingMiddleware - Basic logging for all MCP operations
- ToolLoggingMiddleware - Advanced tool execution tracking with JSON/human formats
Human-in-the-Loop
설치
uvx mcp-hn설정
{
"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"
}
}
]
}