mcp-common


Namemcp-common JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryACB-native foundation library providing battle-tested patterns for MCP (Model Context Protocol) servers, with dependency injection, structured logging, and lifecycle management
upload_time2025-10-30 15:39:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseBSD-3-Clause
keywords configuration fastmcp http-client mcp model-context-protocol rate-limiting security utilities
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mcp-common

**Version:** 2.0.0 (ACB-Native)
**Status:** Implementation Phase

______________________________________________________________________

## Overview

mcp-common is an **ACB-native foundation library** for building production-grade MCP (Model Context Protocol) servers. Built on the Asynchronous Component Base (ACB) framework, it provides battle-tested patterns extracted from 9 production servers including crackerjack, session-mgmt-mcp, and fastblocks.

**๐ŸŽฏ What This Library Provides:**

- **ACB Adapters** - HTTP client, rate limiter, security with lifecycle management
- **Structured Logging** - ACB Logger with context binding and correlation IDs
- **Rich Console UI** - Beautiful panels and notifications for server operations
- **Settings Management** - YAML + environment variable configuration
- **Dependency Injection** - Testable, modular architecture
- **Tool Patterns** - Proven organization from production servers

**โš ๏ธ Prerequisites:** Understanding of ACB is required. See [`docs/ACB_FOUNDATION.md`](./docs/ACB_FOUNDATION.md) for:

- What ACB is and why it's required
- Core ACB concepts
- Getting started guide

**Design Principles:**

1. **ACB-Native** - Built on ACB's component system, not layered on top
1. **Production-Ready** - Extracted from real production systems
1. **Dependency Injection** - Uses ACB's `depends` throughout
1. **Rich UI** - Professional console output with Rich panels
1. **Type-safe** - Full type hints with crackerjack checking
1. **Well-Tested** - 90% coverage minimum

______________________________________________________________________

## ๐Ÿ“š Examples

See [`examples/`](./examples/) for a complete production-ready Weather MCP server demonstrating:

- HTTPClientAdapter with connection pooling (11x performance)
- MCPBaseSettings with YAML + environment configuration
- ServerPanels for beautiful terminal UI
- ACB dependency injection and lifecycle
- FastMCP tool integration

**Run the example:**

```bash
cd examples
python weather_server.py
```

**Full documentation:** [`examples/README.md`](./examples/README.md)

______________________________________________________________________

## Quick Start

### Installation

```bash
pip install mcp-common>=2.0.0
```

This automatically installs ACB and all required dependencies.

### Minimal Example

```python
# my_server/__init__.py
from acb import register_pkg

# Register package with ACB (REQUIRED)
register_pkg("my_server")

# my_server/settings.py
from mcp_common.config import MCPBaseSettings
from pydantic import Field


class MyServerSettings(MCPBaseSettings):
    """Server configuration using ACB Settings.

    Loads from:
    1. settings/local.yaml
    2. settings/my-server.yaml
    3. Environment variables MY_SERVER_*
    4. Defaults below
    """

    api_key: str = Field(description="API key for service")
    timeout: int = Field(default=30, description="Request timeout")


# my_server/main.py
from fastmcp import FastMCP
from acb.depends import depends
from mcp_common import ServerPanels, HTTPClientAdapter
from my_server.settings import MyServerSettings

# Initialize
mcp = FastMCP("MyServer")
settings = MyServerSettings()


# Define tools
@mcp.tool()
async def call_api():
    # Get adapter from DI container
    http = depends(HTTPClientAdapter)
    client = await http._create_client()

    # Make request
    response = await client.get("https://api.example.com")
    return response.json()


# Run server
if __name__ == "__main__":
    # Display startup panel
    ServerPanels.startup_success(
        server_name="My MCP Server",
        http_endpoint="http://localhost:8000",
        features=["HTTP Client", "Rate Limiting"],
    )

    mcp.run()
```

______________________________________________________________________

## Core Features

### ๐Ÿ”Œ ACB Adapters with Lifecycle Management

**HTTP Client Adapter:**

- Connection pooling (11x faster than creating clients per request)
- Automatic initialization and cleanup
- Configurable via ACB Settings

```python
from acb.depends import depends
from mcp_common.adapters.http import HTTPClientAdapter

http = depends(HTTPClientAdapter)
client = await http._create_client()
```

**Rate Limiter Adapter:**

- Token bucket algorithm
- Per-identifier limiting (user, IP, API key)
- Structured logging of rate limit events

```python
from mcp_common.adapters.rate_limit import RateLimiterAdapter, rate_limit


@mcp.tool()
@rate_limit(requests=100, window=60)  # 100 req/min
async def expensive_operation(): ...
```

### โš™๏ธ ACB Settings with YAML Support

- Extends `acb.config.Settings`
- Load from YAML files + environment variables
- Type validation with Pydantic
- Path expansion (`~` โ†’ home directory)

```python
from mcp_common.config import MCPBaseSettings


class ServerSettings(MCPBaseSettings):
    api_key: str  # Required
    timeout: int = 30  # Optional with default
```

### ๐Ÿ“ Structured Logging (ACB Logger)

- Automatic injection into adapters
- Context binding with correlation IDs
- JSON output for log aggregation

```python
# In adapters - logger is injected automatically
from acb.adapters.logger import LoggerProtocol


class MyAdapter(AdapterBase):
    logger: LoggerProtocol  # ACB injects this

    async def do_work(self):
        self.logger.info("Processing", item_id="abc123")
```

### ๐ŸŽจ Rich Console UI

- Beautiful startup panels
- Error displays with context
- Statistics tables
- Progress bars

```python
from mcp_common.ui import ServerPanels

ServerPanels.startup_success(
    server_name="Mailgun MCP",
    http_endpoint="http://localhost:8000",
    features=["Rate Limiting", "Security Filters"],
)
```

### ๐Ÿงช Testing Utilities

- Mock MCP clients
- HTTP response mocking
- Shared fixtures
- DI-friendly testing

```python
from mcp_common.testing import MockMCPClient, mock_http_response


async def test_tool():
    with mock_http_response(status=200, json={"ok": True}):
        result = await my_tool()
    assert result["success"]
```

______________________________________________________________________

## Documentation

- **[ACB_FOUNDATION.md](./docs/ACB_FOUNDATION.md)** - **START HERE** - ACB prerequisites and concepts
- **[ARCHITECTURE.md](./ARCHITECTURE.md)** - Technical design and ACB patterns
- **[IMPLEMENTATION_PLAN.md](./IMPLEMENTATION_PLAN.md)** - Adoption roadmap and migration guide
- **[docs/MCP_ECOSYSTEM_CRITICAL_AUDIT.md](./docs/MCP_ECOSYSTEM_CRITICAL_AUDIT.md)** - Analysis of 9 production servers

______________________________________________________________________

## Complete Example

See [`examples/complete_server/`](./examples/complete_server/) for a full working MCP server using mcp-common v2.0 patterns.

### Key Patterns Demonstrated:

1. **Package Registration** - `register_pkg("server_name")`
1. **ACB Settings** - YAML + environment variable configuration
1. **Adapter Usage** - HTTPClientAdapter from DI
1. **Rate Limiting** - `@rate_limit` decorator
1. **Structured Logging** - ACB Logger with context
1. **Rich UI** - ServerPanels for startup/errors
1. **Tool Organization** - Modular tool registration
1. **Testing** - DI-based testing patterns

______________________________________________________________________

## Performance Benchmarks

### HTTP Client Adapter (vs new client per request)

```
Before: 100 requests in 45 seconds, 500MB memory
After:  100 requests in 4 seconds, 50MB memory

Result: 11x faster, 10x less memory
```

### Rate Limiter Overhead

```
Without: 1000 requests in 1.2 seconds
With:    1000 requests in 1.25 seconds

Result: +4% overhead (negligible vs network I/O)
```

______________________________________________________________________

## ACB Integration Patterns

### Pattern 1: Creating an Adapter

```python
# my_server/adapters/email.py
from acb.config import AdapterBase, Settings
from acb.adapters.logger import LoggerProtocol
from acb.adapters import AdapterStatus
from uuid import UUID
from contextlib import suppress

# Static UUID7 - generated once, hardcoded
MODULE_ID = UUID("01947e12-5678-7abc-9def-1a2b3c4d5e6f")
MODULE_STATUS = AdapterStatus.STABLE


class EmailSettings(Settings):
    smtp_host: str = "smtp.example.com"
    smtp_port: int = 587


class EmailAdapter(AdapterBase):
    settings: EmailSettings | None = None
    logger: LoggerProtocol  # ACB injects

    def __init__(self, **kwargs):
        super().__init__(**kwargs)  # REQUIRED
        if self.settings is None:
            self.settings = EmailSettings()

    async def _create_client(self):
        """Lazy initialization."""
        # Initialize SMTP client
        self.logger.info("SMTP client initialized")

    async def _cleanup_resources(self):
        """Cleanup on shutdown."""
        # Close SMTP connection
        self.logger.info("SMTP client closed")


# Auto-register
with suppress(Exception):
    depends.set(EmailAdapter)
```

### Pattern 2: Using Adapters in Tools

```python
from acb.depends import depends
from mcp_common.adapters.http import HTTPClientAdapter
from mcp_common.adapters.rate_limit import rate_limit


@mcp.tool()
@rate_limit(requests=100, window=60)
async def send_request():
    # Get adapter from DI
    http = depends(HTTPClientAdapter)

    # Use adapter
    client = await http._create_client()
    response = await client.post("https://api.example.com")

    return {"success": response.status_code == 200}
```

### Pattern 3: Testing with DI

```python
from acb.depends import depends


def test_my_tool():
    # Create mock adapter
    mock_http = MockHTTPClientAdapter()

    # Override in DI container
    depends.set(HTTPClientAdapter, mock_http)

    # Test uses mock
    result = await my_tool()
    assert mock_http.called
```

______________________________________________________________________

## Development

### Setup

```bash
git clone https://github.com/lesaker/mcp-common.git
cd mcp-common
pip install -e ".[dev]"
```

### Running Tests

```bash
# Run all tests with coverage
pytest --cov=mcp_common --cov-report=html

# Run specific test
pytest tests/test_http_adapter.py -v

# Run with ACB integration tests
pytest tests/integration/ -v
```

### Code Quality

```bash
# Format code
ruff format

# Lint code
ruff check

# Type checking
mypy mcp_common tests

# Run all quality checks
crackerjack --all
```

______________________________________________________________________

## Migration from v1.x

**Breaking Changes in v2.0:**

- ACB is now **required** (was optional in v1.x)
- HTTP client is now `HTTPClientAdapter` (was `get_http_client()` function)
- Logging uses ACB Logger (no custom `MCPLogger` wrapper)
- Rate limiting is an adapter (not standalone decorator)
- Settings extend `acb.config.Settings` (not raw Pydantic)

**Migration Guide:** See [IMPLEMENTATION_PLAN.md](./IMPLEMENTATION_PLAN.md) for step-by-step migration instructions.

______________________________________________________________________

## Versioning

**Semantic Versioning:**

- **2.0.0** - ACB-native redesign (current)
- **2.1.0** - Additional adapters (security, caching)
- **2.2.0** - Enhanced testing utilities
- **3.0.0** - Breaking changes (if needed)

**ACB Compatibility:**

- Requires `acb>=0.19.0`
- Compatible with FastMCP 2.0+
- Python 3.13+ required

______________________________________________________________________

## Success Metrics

**v2.0 is successful if:**

1. โœ… All 9 MCP servers adopt ACB-native patterns
1. โœ… Zero production incidents caused by mcp-common
1. โœ… Ecosystem health improves from 74/100 to 85/100
1. โœ… Test coverage >90%
1. โœ… Professional Rich UI in all servers
1. โœ… Unified logging/settings/console across ecosystem

______________________________________________________________________

## License

BSD-3-Clause License - See [LICENSE](./LICENSE) for details

______________________________________________________________________

## Contributing

Contributions are welcome! Please:

1. Read [`docs/ACB_FOUNDATION.md`](./docs/ACB_FOUNDATION.md) first
1. Follow ACB patterns (see examples)
1. Fork and create feature branch
1. Add tests (coverage โ‰ฅ90%)
1. Ensure all quality checks pass
1. Submit pull request

______________________________________________________________________

## Acknowledgments

Built with patterns extracted from 9 production MCP servers:

**Primary Pattern Sources:**

- **crackerjack** - MCP server structure, Rich UI panels, rate limiting
- **session-mgmt-mcp** - ACB Settings patterns, DI configuration
- **fastblocks** - ACB adapter organization

**Additional Contributors:**

- raindropio-mcp (HTTP client patterns)
- excalidraw-mcp (testing patterns)
- opera-cloud-mcp
- mailgun-mcp
- unifi-mcp
- ACB core (component system)

Special thanks to the ACB framework for providing the foundation that makes this library possible.

______________________________________________________________________

## Support

- **Documentation:** [`docs/`](./docs/)
- **Issues:** [GitHub Issues](https://github.com/lesaker/mcp-common/issues)
- **Discussions:** [GitHub Discussions](https://github.com/lesaker/mcp-common/discussions)

______________________________________________________________________

**Ready to get started?** Read [`docs/ACB_FOUNDATION.md`](./docs/ACB_FOUNDATION.md) to understand ACB fundamentals, then check out [`examples/complete_server/`](./examples/complete_server/) for a working example!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mcp-common",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "configuration, fastmcp, http-client, mcp, model-context-protocol, rate-limiting, security, utilities",
    "author": null,
    "author_email": "Les Leslie <les@wedgwoodwebworks.com>",
    "download_url": "https://files.pythonhosted.org/packages/44/8c/7afc2d2e40153b3748e0703b3a28e7d4ed1e221639747311058e5470f573/mcp_common-0.2.0.tar.gz",
    "platform": null,
    "description": "# mcp-common\n\n**Version:** 2.0.0 (ACB-Native)\n**Status:** Implementation Phase\n\n______________________________________________________________________\n\n## Overview\n\nmcp-common is an **ACB-native foundation library** for building production-grade MCP (Model Context Protocol) servers. Built on the Asynchronous Component Base (ACB) framework, it provides battle-tested patterns extracted from 9 production servers including crackerjack, session-mgmt-mcp, and fastblocks.\n\n**\ud83c\udfaf What This Library Provides:**\n\n- **ACB Adapters** - HTTP client, rate limiter, security with lifecycle management\n- **Structured Logging** - ACB Logger with context binding and correlation IDs\n- **Rich Console UI** - Beautiful panels and notifications for server operations\n- **Settings Management** - YAML + environment variable configuration\n- **Dependency Injection** - Testable, modular architecture\n- **Tool Patterns** - Proven organization from production servers\n\n**\u26a0\ufe0f Prerequisites:** Understanding of ACB is required. See [`docs/ACB_FOUNDATION.md`](./docs/ACB_FOUNDATION.md) for:\n\n- What ACB is and why it's required\n- Core ACB concepts\n- Getting started guide\n\n**Design Principles:**\n\n1. **ACB-Native** - Built on ACB's component system, not layered on top\n1. **Production-Ready** - Extracted from real production systems\n1. **Dependency Injection** - Uses ACB's `depends` throughout\n1. **Rich UI** - Professional console output with Rich panels\n1. **Type-safe** - Full type hints with crackerjack checking\n1. **Well-Tested** - 90% coverage minimum\n\n______________________________________________________________________\n\n## \ud83d\udcda Examples\n\nSee [`examples/`](./examples/) for a complete production-ready Weather MCP server demonstrating:\n\n- HTTPClientAdapter with connection pooling (11x performance)\n- MCPBaseSettings with YAML + environment configuration\n- ServerPanels for beautiful terminal UI\n- ACB dependency injection and lifecycle\n- FastMCP tool integration\n\n**Run the example:**\n\n```bash\ncd examples\npython weather_server.py\n```\n\n**Full documentation:** [`examples/README.md`](./examples/README.md)\n\n______________________________________________________________________\n\n## Quick Start\n\n### Installation\n\n```bash\npip install mcp-common>=2.0.0\n```\n\nThis automatically installs ACB and all required dependencies.\n\n### Minimal Example\n\n```python\n# my_server/__init__.py\nfrom acb import register_pkg\n\n# Register package with ACB (REQUIRED)\nregister_pkg(\"my_server\")\n\n# my_server/settings.py\nfrom mcp_common.config import MCPBaseSettings\nfrom pydantic import Field\n\n\nclass MyServerSettings(MCPBaseSettings):\n    \"\"\"Server configuration using ACB Settings.\n\n    Loads from:\n    1. settings/local.yaml\n    2. settings/my-server.yaml\n    3. Environment variables MY_SERVER_*\n    4. Defaults below\n    \"\"\"\n\n    api_key: str = Field(description=\"API key for service\")\n    timeout: int = Field(default=30, description=\"Request timeout\")\n\n\n# my_server/main.py\nfrom fastmcp import FastMCP\nfrom acb.depends import depends\nfrom mcp_common import ServerPanels, HTTPClientAdapter\nfrom my_server.settings import MyServerSettings\n\n# Initialize\nmcp = FastMCP(\"MyServer\")\nsettings = MyServerSettings()\n\n\n# Define tools\n@mcp.tool()\nasync def call_api():\n    # Get adapter from DI container\n    http = depends(HTTPClientAdapter)\n    client = await http._create_client()\n\n    # Make request\n    response = await client.get(\"https://api.example.com\")\n    return response.json()\n\n\n# Run server\nif __name__ == \"__main__\":\n    # Display startup panel\n    ServerPanels.startup_success(\n        server_name=\"My MCP Server\",\n        http_endpoint=\"http://localhost:8000\",\n        features=[\"HTTP Client\", \"Rate Limiting\"],\n    )\n\n    mcp.run()\n```\n\n______________________________________________________________________\n\n## Core Features\n\n### \ud83d\udd0c ACB Adapters with Lifecycle Management\n\n**HTTP Client Adapter:**\n\n- Connection pooling (11x faster than creating clients per request)\n- Automatic initialization and cleanup\n- Configurable via ACB Settings\n\n```python\nfrom acb.depends import depends\nfrom mcp_common.adapters.http import HTTPClientAdapter\n\nhttp = depends(HTTPClientAdapter)\nclient = await http._create_client()\n```\n\n**Rate Limiter Adapter:**\n\n- Token bucket algorithm\n- Per-identifier limiting (user, IP, API key)\n- Structured logging of rate limit events\n\n```python\nfrom mcp_common.adapters.rate_limit import RateLimiterAdapter, rate_limit\n\n\n@mcp.tool()\n@rate_limit(requests=100, window=60)  # 100 req/min\nasync def expensive_operation(): ...\n```\n\n### \u2699\ufe0f ACB Settings with YAML Support\n\n- Extends `acb.config.Settings`\n- Load from YAML files + environment variables\n- Type validation with Pydantic\n- Path expansion (`~` \u2192 home directory)\n\n```python\nfrom mcp_common.config import MCPBaseSettings\n\n\nclass ServerSettings(MCPBaseSettings):\n    api_key: str  # Required\n    timeout: int = 30  # Optional with default\n```\n\n### \ud83d\udcdd Structured Logging (ACB Logger)\n\n- Automatic injection into adapters\n- Context binding with correlation IDs\n- JSON output for log aggregation\n\n```python\n# In adapters - logger is injected automatically\nfrom acb.adapters.logger import LoggerProtocol\n\n\nclass MyAdapter(AdapterBase):\n    logger: LoggerProtocol  # ACB injects this\n\n    async def do_work(self):\n        self.logger.info(\"Processing\", item_id=\"abc123\")\n```\n\n### \ud83c\udfa8 Rich Console UI\n\n- Beautiful startup panels\n- Error displays with context\n- Statistics tables\n- Progress bars\n\n```python\nfrom mcp_common.ui import ServerPanels\n\nServerPanels.startup_success(\n    server_name=\"Mailgun MCP\",\n    http_endpoint=\"http://localhost:8000\",\n    features=[\"Rate Limiting\", \"Security Filters\"],\n)\n```\n\n### \ud83e\uddea Testing Utilities\n\n- Mock MCP clients\n- HTTP response mocking\n- Shared fixtures\n- DI-friendly testing\n\n```python\nfrom mcp_common.testing import MockMCPClient, mock_http_response\n\n\nasync def test_tool():\n    with mock_http_response(status=200, json={\"ok\": True}):\n        result = await my_tool()\n    assert result[\"success\"]\n```\n\n______________________________________________________________________\n\n## Documentation\n\n- **[ACB_FOUNDATION.md](./docs/ACB_FOUNDATION.md)** - **START HERE** - ACB prerequisites and concepts\n- **[ARCHITECTURE.md](./ARCHITECTURE.md)** - Technical design and ACB patterns\n- **[IMPLEMENTATION_PLAN.md](./IMPLEMENTATION_PLAN.md)** - Adoption roadmap and migration guide\n- **[docs/MCP_ECOSYSTEM_CRITICAL_AUDIT.md](./docs/MCP_ECOSYSTEM_CRITICAL_AUDIT.md)** - Analysis of 9 production servers\n\n______________________________________________________________________\n\n## Complete Example\n\nSee [`examples/complete_server/`](./examples/complete_server/) for a full working MCP server using mcp-common v2.0 patterns.\n\n### Key Patterns Demonstrated:\n\n1. **Package Registration** - `register_pkg(\"server_name\")`\n1. **ACB Settings** - YAML + environment variable configuration\n1. **Adapter Usage** - HTTPClientAdapter from DI\n1. **Rate Limiting** - `@rate_limit` decorator\n1. **Structured Logging** - ACB Logger with context\n1. **Rich UI** - ServerPanels for startup/errors\n1. **Tool Organization** - Modular tool registration\n1. **Testing** - DI-based testing patterns\n\n______________________________________________________________________\n\n## Performance Benchmarks\n\n### HTTP Client Adapter (vs new client per request)\n\n```\nBefore: 100 requests in 45 seconds, 500MB memory\nAfter:  100 requests in 4 seconds, 50MB memory\n\nResult: 11x faster, 10x less memory\n```\n\n### Rate Limiter Overhead\n\n```\nWithout: 1000 requests in 1.2 seconds\nWith:    1000 requests in 1.25 seconds\n\nResult: +4% overhead (negligible vs network I/O)\n```\n\n______________________________________________________________________\n\n## ACB Integration Patterns\n\n### Pattern 1: Creating an Adapter\n\n```python\n# my_server/adapters/email.py\nfrom acb.config import AdapterBase, Settings\nfrom acb.adapters.logger import LoggerProtocol\nfrom acb.adapters import AdapterStatus\nfrom uuid import UUID\nfrom contextlib import suppress\n\n# Static UUID7 - generated once, hardcoded\nMODULE_ID = UUID(\"01947e12-5678-7abc-9def-1a2b3c4d5e6f\")\nMODULE_STATUS = AdapterStatus.STABLE\n\n\nclass EmailSettings(Settings):\n    smtp_host: str = \"smtp.example.com\"\n    smtp_port: int = 587\n\n\nclass EmailAdapter(AdapterBase):\n    settings: EmailSettings | None = None\n    logger: LoggerProtocol  # ACB injects\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)  # REQUIRED\n        if self.settings is None:\n            self.settings = EmailSettings()\n\n    async def _create_client(self):\n        \"\"\"Lazy initialization.\"\"\"\n        # Initialize SMTP client\n        self.logger.info(\"SMTP client initialized\")\n\n    async def _cleanup_resources(self):\n        \"\"\"Cleanup on shutdown.\"\"\"\n        # Close SMTP connection\n        self.logger.info(\"SMTP client closed\")\n\n\n# Auto-register\nwith suppress(Exception):\n    depends.set(EmailAdapter)\n```\n\n### Pattern 2: Using Adapters in Tools\n\n```python\nfrom acb.depends import depends\nfrom mcp_common.adapters.http import HTTPClientAdapter\nfrom mcp_common.adapters.rate_limit import rate_limit\n\n\n@mcp.tool()\n@rate_limit(requests=100, window=60)\nasync def send_request():\n    # Get adapter from DI\n    http = depends(HTTPClientAdapter)\n\n    # Use adapter\n    client = await http._create_client()\n    response = await client.post(\"https://api.example.com\")\n\n    return {\"success\": response.status_code == 200}\n```\n\n### Pattern 3: Testing with DI\n\n```python\nfrom acb.depends import depends\n\n\ndef test_my_tool():\n    # Create mock adapter\n    mock_http = MockHTTPClientAdapter()\n\n    # Override in DI container\n    depends.set(HTTPClientAdapter, mock_http)\n\n    # Test uses mock\n    result = await my_tool()\n    assert mock_http.called\n```\n\n______________________________________________________________________\n\n## Development\n\n### Setup\n\n```bash\ngit clone https://github.com/lesaker/mcp-common.git\ncd mcp-common\npip install -e \".[dev]\"\n```\n\n### Running Tests\n\n```bash\n# Run all tests with coverage\npytest --cov=mcp_common --cov-report=html\n\n# Run specific test\npytest tests/test_http_adapter.py -v\n\n# Run with ACB integration tests\npytest tests/integration/ -v\n```\n\n### Code Quality\n\n```bash\n# Format code\nruff format\n\n# Lint code\nruff check\n\n# Type checking\nmypy mcp_common tests\n\n# Run all quality checks\ncrackerjack --all\n```\n\n______________________________________________________________________\n\n## Migration from v1.x\n\n**Breaking Changes in v2.0:**\n\n- ACB is now **required** (was optional in v1.x)\n- HTTP client is now `HTTPClientAdapter` (was `get_http_client()` function)\n- Logging uses ACB Logger (no custom `MCPLogger` wrapper)\n- Rate limiting is an adapter (not standalone decorator)\n- Settings extend `acb.config.Settings` (not raw Pydantic)\n\n**Migration Guide:** See [IMPLEMENTATION_PLAN.md](./IMPLEMENTATION_PLAN.md) for step-by-step migration instructions.\n\n______________________________________________________________________\n\n## Versioning\n\n**Semantic Versioning:**\n\n- **2.0.0** - ACB-native redesign (current)\n- **2.1.0** - Additional adapters (security, caching)\n- **2.2.0** - Enhanced testing utilities\n- **3.0.0** - Breaking changes (if needed)\n\n**ACB Compatibility:**\n\n- Requires `acb>=0.19.0`\n- Compatible with FastMCP 2.0+\n- Python 3.13+ required\n\n______________________________________________________________________\n\n## Success Metrics\n\n**v2.0 is successful if:**\n\n1. \u2705 All 9 MCP servers adopt ACB-native patterns\n1. \u2705 Zero production incidents caused by mcp-common\n1. \u2705 Ecosystem health improves from 74/100 to 85/100\n1. \u2705 Test coverage >90%\n1. \u2705 Professional Rich UI in all servers\n1. \u2705 Unified logging/settings/console across ecosystem\n\n______________________________________________________________________\n\n## License\n\nBSD-3-Clause License - See [LICENSE](./LICENSE) for details\n\n______________________________________________________________________\n\n## Contributing\n\nContributions are welcome! Please:\n\n1. Read [`docs/ACB_FOUNDATION.md`](./docs/ACB_FOUNDATION.md) first\n1. Follow ACB patterns (see examples)\n1. Fork and create feature branch\n1. Add tests (coverage \u226590%)\n1. Ensure all quality checks pass\n1. Submit pull request\n\n______________________________________________________________________\n\n## Acknowledgments\n\nBuilt with patterns extracted from 9 production MCP servers:\n\n**Primary Pattern Sources:**\n\n- **crackerjack** - MCP server structure, Rich UI panels, rate limiting\n- **session-mgmt-mcp** - ACB Settings patterns, DI configuration\n- **fastblocks** - ACB adapter organization\n\n**Additional Contributors:**\n\n- raindropio-mcp (HTTP client patterns)\n- excalidraw-mcp (testing patterns)\n- opera-cloud-mcp\n- mailgun-mcp\n- unifi-mcp\n- ACB core (component system)\n\nSpecial thanks to the ACB framework for providing the foundation that makes this library possible.\n\n______________________________________________________________________\n\n## Support\n\n- **Documentation:** [`docs/`](./docs/)\n- **Issues:** [GitHub Issues](https://github.com/lesaker/mcp-common/issues)\n- **Discussions:** [GitHub Discussions](https://github.com/lesaker/mcp-common/discussions)\n\n______________________________________________________________________\n\n**Ready to get started?** Read [`docs/ACB_FOUNDATION.md`](./docs/ACB_FOUNDATION.md) to understand ACB fundamentals, then check out [`examples/complete_server/`](./examples/complete_server/) for a working example!\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "ACB-native foundation library providing battle-tested patterns for MCP (Model Context Protocol) servers, with dependency injection, structured logging, and lifecycle management",
    "version": "0.2.0",
    "project_urls": {
        "Documentation": "https://github.com/lesleslie/mcp-common#readme",
        "Homepage": "https://github.com/lesleslie/mcp-common",
        "Issues": "https://github.com/lesleslie/mcp-common/issues",
        "Repository": "https://github.com/lesleslie/mcp-common"
    },
    "split_keywords": [
        "configuration",
        " fastmcp",
        " http-client",
        " mcp",
        " model-context-protocol",
        " rate-limiting",
        " security",
        " utilities"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "44861b0e55be2534307a013c03065ad96e41f19f86af004534fd7e30c5f0ccbc",
                "md5": "cd23f167f5844c230c169edc94123ebb",
                "sha256": "45ffc90ac9d8c71eeaa3918551c79f7c6e043e49c74ab40ab354d77b244ddd46"
            },
            "downloads": -1,
            "filename": "mcp_common-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd23f167f5844c230c169edc94123ebb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 35946,
            "upload_time": "2025-10-30T15:39:24",
            "upload_time_iso_8601": "2025-10-30T15:39:24.451239Z",
            "url": "https://files.pythonhosted.org/packages/44/86/1b0e55be2534307a013c03065ad96e41f19f86af004534fd7e30c5f0ccbc/mcp_common-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "448c7afc2d2e40153b3748e0703b3a28e7d4ed1e221639747311058e5470f573",
                "md5": "0a5f853835972d6e020a17ced0e6aa85",
                "sha256": "a75c9b8b6efb7cefdb41105650b07a23a6719ee22c46cf3a26d64f889b2a06bd"
            },
            "downloads": -1,
            "filename": "mcp_common-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0a5f853835972d6e020a17ced0e6aa85",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 357050,
            "upload_time": "2025-10-30T15:39:25",
            "upload_time_iso_8601": "2025-10-30T15:39:25.936886Z",
            "url": "https://files.pythonhosted.org/packages/44/8c/7afc2d2e40153b3748e0703b3a28e7d4ed1e221639747311058e5470f573/mcp_common-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-30 15:39:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lesleslie",
    "github_project": "mcp-common#readme",
    "github_not_found": true,
    "lcname": "mcp-common"
}
        
Elapsed time: 0.76929s