Metadata-Version: 2.4
Name: mcp-server-core
Version: 0.3.2
Summary: Universal MCP Server Framework: Streamable HTTP ASGI, Cloudflare Tunnel, OAuth 2.1 & Process Supervisor
Author: yimmr
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp<2,>=1.2.0
Requires-Dist: starlette>=0.36.0
Requires-Dist: uvicorn>=0.27.0
Requires-Dist: pywin32>=306; platform_system == "Windows"
Provides-Extra: test
Requires-Dist: httpx>=0.27.0; extra == "test"
Provides-Extra: tray
Requires-Dist: pystray>=0.19.5; extra == "tray"
Requires-Dist: pillow>=10.0.0; extra == "tray"
Dynamic: license-file

# MCP Server Core 🚀

**Universal MCP Server Framework for Streamable HTTP ASGI, Cloudflare Tunnel, OAuth 2.1 & Process Supervisor**

Decoupled, reusable transport and lifecycle layer for FastMCP services (e.g. Codexen, Literary Workflow).

---

## 📦 Features

- **ASGI Streamable HTTP Transport**: Starlette + FastMCP integration supporting SSE, streaming, and atomic JSON-RPC responses.
- **Cache-Busting & Anti-Stale Guarantees**: Built-in `NoCacheMiddleware` ensuring `Cache-Control: no-cache, no-store, must-revalidate` across all discovery and tool execution routes to prevent intermediate CDN/Cloudflare heuristic caching.
- **Embedded OAuth 2.1 Server**: Full RFC 9728 (Protected Resource Metadata), RFC 8414 (Authorization Server Metadata), RFC 7591 (Dynamic Client Registration), and PKCE S256 support for ChatGPT Developer Mode & third-party AI agents.
- **Cloudflare Tunnel Singleton Supervisor**: Outbound named tunnel daemon lifecycle management with automated health check and heartbeat recovery.
- **Windows Named Mutex & Process Lifecycle**: Prevents duplicate server port bindings, cleans up zombie PIDs, and handles cross-platform single-instance constraints.

---

## 🛠️ Installation & Usage

### 1. From PyPI (Recommended for Production)
```bash
pip install mcp-server-core
# or with uv
uv add mcp-server-core
```
Or declare in `pyproject.toml`:
```toml
dependencies = [
    "mcp-server-core>=0.2.1",
]
```

### 2. Python Code Usage
```python
from mcp_server_core import (
    MCPServer,
    OAuthProvider,
    TunnelManager,
    SingleInstanceManager,
    NoCacheMiddleware,
)
```
> 💡 *Note: For existing projects, `import mcp_framework` is fully supported as a backward-compatibility alias forwarding to `mcp_server_core`.*

### 3. Local Editable Development (Instant Sync across Projects)
In consumer projects (e.g. `Codexen` or `literary-workflow`):
```bash
uv pip install -e path/to/mcp-framework
```
Changes made in this repository will instantly reflect across all local consumer services without copying code.

---

## 📄 License
MIT License.
