Metadata-Version: 2.4
Name: mcp-dynamic-proxy
Version: 0.1.6
Summary: Dynamic MCP proxy server with progressive discovery and lazy loading
Author: Nicolas Mallet
Maintainer: Nicolas Mallet
License: MIT License
        
        Copyright (c) 2025 Nicolas Mallet
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: ai,lazy-loading,llm,mcp,model-context-protocol,progressive-discovery,proxy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: Proxy Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: fastmcp~=2.13.0
Requires-Dist: jsonschema~=4.20.0
Requires-Dist: mcp~=1.19.0
Requires-Dist: psutil~=5.9.0
Requires-Dist: pydantic>=2.5.0
Requires-Dist: structlog~=24.4.0
Requires-Dist: tenacity~=8.2.0
Provides-Extra: dev
Requires-Dist: mypy~=1.8.0; extra == 'dev'
Requires-Dist: pytest-asyncio~=0.23.0; extra == 'dev'
Requires-Dist: pytest-cov~=4.1.0; extra == 'dev'
Requires-Dist: pytest-timeout~=2.2.0; extra == 'dev'
Requires-Dist: pytest~=8.0.0; extra == 'dev'
Requires-Dist: ruff~=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# MCP Dynamic Proxy

A dynamic MCP (Model Context Protocol) proxy server that provides progressive discovery and lazy loading of MCP servers, reducing initial context size from 20-300 tools to just 3 core tools.

## How it works

```
Assistant (Cursor) -MCP-> MCP Dynamic Proxy -MCP-> MCP Servers (AWS, PostgreSQL, etc.)
```

The proxy exposes only 3 core tools that let you discover and interact with any number of configured MCP servers without loading them all upfront.

## Tools

### mcp_list_servers
List all configured MCP servers with their metadata (id, description, tags, principal tools).

**Parameters:** None

**Returns:** `{count: int, servers: [...]}`

### mcp_list_tools
List all tools from a specific MCP server with their JSON schemas. Automatically loads the server if needed.

**Parameters:**
- `server_id` (required): The MCP server ID (e.g., `"aws-knowledge-mcp-server"`)

**Returns:** `{server_id: str, status: "loaded" | "error", tool_count: int, tools: [...], error?: str}`

### mcp_execute_tool
Execute a tool from a specific MCP server. Automatically loads the server if needed.

**Parameters:**
- `server_id` (required): The MCP server ID
- `tool_name` (required): The tool name (e.g., `"aws___read_documentation"`)
- `arguments` (required): Dictionary matching the tool's JSON schema

**Returns:** `{server_id: str, tool_name: str, status: "success" | "error", result?: any, error?: str}`

## Configuration

### config/mcp.json

Create a `config/mcp.json` file with your MCP server configurations:

```json
{
  "version": "1.0",
  "mcpServers": {
    "aws-knowledge-mcp-server": {
      "description": "AWS knowledge base with documentation, best practices, and service information",
      "tags": ["aws", "documentation", "cloud", "knowledge"],
      "tools": ["aws___read_documentation", "aws___search_documentation"],
      "command": "uvx",
      "args": ["fastmcp", "run", "https://knowledge-mcp.global.api.aws"]
    },
    "microsoft.docs.mcp": {
      "description": "Microsoft Learn documentation and Azure documentation access",
      "tags": ["microsoft", "azure", "documentation", "learn"],
      "tools": ["microsoft_docs_search", "microsoft_code_sample_search", "microsoft_docs_fetch"],
      "command": "uvx",
      "args": ["fastmcp", "run", "https://learn.microsoft.com/api/mcp"]
    }
  }
}
```

**Configuration fields:**
- `description`: Human-readable description
- `tags`: List of tags for organization
- `tools`: Optional list of principal tool names (not exhaustive)
- `command`: Command to start the MCP server
- `args`: Arguments for the command
- `env`: Optional environment variables (supports `${VAR_NAME}` expansion)

### Cursor Configuration

Add to your Cursor MCP configuration:

```json
{
  "mcpServers": {
    "mcp-dynamic-proxy": {
      "command": "uvx",
      "args": ["mcp-dynamic-proxy"],
      "env": {
        "MCP_CONFIG_PATH": "/path/to/config/mcp.json"
      }
    }
  }
}
```

## License

MIT
