ruliana/mcp-chain
A middleware architecture for MCP (Model Context Protocol) servers with dict-based transformers and FastMCP integration
Platform-specific configuration:
{
"mcpServers": {
"mcp-chain": {
"command": "npx",
"args": [
"-y",
"mcp-chain"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
[](https://github.com/ruliana/mcp-chain/actions/workflows/python-package.yml) [](https://codecov.io/gh/ruliana/mcp-chain) [](https://badge.fury.io/py/mcp-chain) [](https://github.com/ruliana/mcp-chain/releases) [](https://pypi.org/project/mcp-chain/) [](https://github.com/ruliana/mcp-chain/blob/main/LICENSE)
A composable middleware framework for building MCP server chains, inspired by Ruby Rack. MCP Chain lets you create transparent proxies that sit between MCP clients and servers, transforming requests and responses using Python functions.
MCP Chain solves the problem of adding cross-cutting concerns (authentication, logging, request transformation) to existing MCP servers without modifying them. It uses a transparent proxy pattern where each middleware layer appears as a standard MCP server to clients while forwarding requests to downstream servers. Middleware can also orchestrate multiple MCP calls behind the scenes using AI, transforming granular APIs into intelligent MCPs that perform complex multi-step tasks.
Install and run with uvx - no setup required:
# cli_server.py
from mcp_chain import mcp_chain, CLIMCPServer
cli_server = CLIMCPServer(
name="dev-tools",
commands=["git", "ls", "grep"],
descriptions={
"git": "Git version control operations",
"ls": "List directory contents",
"grep": "Search text patterns"
}
)
# Auto-detected by CLI
chain = mcp_chain().then(cli_server)uvx mcp-chain cli_server.pyAdd to your mcp.json
Loading reviews...