Metadata-Version: 2.4
Name: smf-mcp
Version: 0.1.21
Summary: Enterprise-grade MCP framework built on FastMCP
Project-URL: Homepage, https://github.com/guinat/smf-mcp
Project-URL: Repository, https://github.com/guinat/smf-mcp
Project-URL: Issues, https://github.com/guinat/smf-mcp/issues
Author: guinat
License: MIT License
        
        Copyright (c) 2026 guinat
        
        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,enterprise,fastmcp,llm,mcp
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.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <3.13,>=3.11
Requires-Dist: fastmcp<3,>=2.11
Requires-Dist: pydantic-settings<3,>=2
Requires-Dist: pydantic<3,>=2
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: elasticsearch7
Requires-Dist: elasticsearch<8,>=7; extra == 'elasticsearch7'
Provides-Extra: elasticsearch8
Requires-Dist: elasticsearch<9,>=8; extra == 'elasticsearch8'
Provides-Extra: elasticsearch9
Requires-Dist: elasticsearch<10,>=9; extra == 'elasticsearch9'
Description-Content-Type: text/markdown

# SMF - Enterprise MCP Framework

**SMF** is a production-ready Python framework built on top of [FastMCP](https://fastmcp.wiki/) that makes it significantly simpler to create, structure, and deploy MCP (Model Context Protocol) servers.

## Features

- 🏗️ **High-level abstractions**: `ServerFactory` and `AppBuilder` for minimal boilerplate
- 🔧 **Tool registration**: Simple decorator-based tool registration
- 🔌 **Plugin system**: Extensible architecture with stable interfaces
- 🚀 **CLI & Templates**: Project scaffolding and code generation
- 📦 **Simple & Focused**: Tools-only approach, no unnecessary complexity

## Architecture

```
┌─────────────────────────────┐
│   CLI & Templates           │
├─────────────────────────────┤
│  Extensions & Plugins       │
├─────────────────────────────┤
│    Core SMF Layer          │
├─────────────────────────────┤
│    FastMCP (Upstream)        │
└─────────────────────────────┘
```

SMF wraps FastMCP without modifying it, ensuring compatibility with FastMCP updates while adding enterprise features.

## Quick Start

### Installation

```bash
uv add smf-mcp
# or
pip install smf-mcp
```

### Simple Server

```python
from smf import create_server

# Create server
mcp = create_server("My Server")

# Register a tool
@mcp.tool
def greet(name: str) -> str:
    """Greet someone by name."""
    return f"Hello, {name}!"

if __name__ == "__main__":
    from smf.transport import run_server
    run_server(mcp)
```

### Advanced Server with AppBuilder

```python
from smf import AppBuilder

# Use AppBuilder for fluent registration
with AppBuilder() as builder:
    @builder.tool(tags=["math"])
    def add(a: float, b: float) -> float:
        """Add two numbers."""
        return a + b

    mcp = builder.build()

if __name__ == "__main__":
    from smf.transport import run_server
    run_server(mcp, transport="http", port=8000)
```

## CLI

```bash
# Initialize new project
smf init my-server

# Initialize project with Elasticsearch plugin
smf init my-server --elasticsearch --es-index "products"

# Run server
smf run server.py --transport http --port 8000

# Inspect server (Official Web Inspector)
smf inspector server.py
```

## Core Components

### ServerFactory

Creates configured FastMCP servers:

```python
from smf import ServerFactory

factory = ServerFactory()
mcp = factory.create(name="My Server")
```

### AppBuilder

Fluent interface for registering tools:

```python
from smf import AppBuilder

builder = AppBuilder()
builder.tool(my_function)
mcp = builder.build()
```

### Transport

Run servers with different transport mechanisms:

```python
from smf.transport import run_server

# Stdio (default)
run_server(mcp)

# HTTP
run_server(mcp, transport="http", host="0.0.0.0", port=8000)

# SSE
run_server(mcp, transport="sse", host="0.0.0.0", port=8000)
```

## Plugins

### Elasticsearch Plugin

Create Elasticsearch-powered MCP servers:

```bash
# Create server with CLI
smf init my-server --elasticsearch --es-index "products"

# Or use in code
from smf.plugins.elasticsearch import (
    ElasticsearchConfiguration,
    build_elasticsearch_connection,
    create_elasticsearch_tools,
)

es_config = ElasticsearchConfiguration.from_env()
es_client = build_elasticsearch_connection(es_config)
mcp = create_server("My Server")
tools = create_elasticsearch_tools(es_client, index="products")
for tool in tools:
    mcp.tool(tool)
```

Install: Choose the version matching your Elasticsearch cluster:

- `pip install smf-mcp[elasticsearch7]` or `uv add smf-mcp[elasticsearch7]` for Elasticsearch 7.x
- `pip install smf-mcp[elasticsearch8]` or `uv add smf-mcp[elasticsearch8]` for Elasticsearch 8.x
- `pip install smf-mcp[elasticsearch9]` or `uv add smf-mcp[elasticsearch9]` for Elasticsearch 9.x

## Project Structure

When you initialize a new project with `smf init`, you get:

```
my-server/
├── src/
│   └── tools/
│       ├── __init__.py
│       └── tools.py          # Your tools
├── server.py                  # Main server file
└── README.md                  # Project documentation
```

## Requirements

- Python 3.11+
- FastMCP >= 2.11

## License

MIT

## Credits

Built on [FastMCP](https://fastmcp.wiki/) by Prefect.
