mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 06:54:18 +01:00
docs: Update README.md to include FastMCP
Update the README.md to include FastMCP as the recommended way to build MCP servers. FastMCP is a high-level, Pythonic interface that makes it easy to build MCP servers with minimal boilerplate. The low-level implementation is still available for more control. 🤖 Generated with Claude CLI. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
37
README.md
37
README.md
@@ -71,18 +71,35 @@ Connections between clients and servers are established through transports like
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Creating a Server
|
||||
### FastMCP
|
||||
|
||||
MCP servers follow a decorator approach to register handlers for MCP primitives like resources, prompts, and tools. The goal is to provide a simple interface for exposing capabilities to LLM clients.
|
||||
|
||||
**example_server.py**
|
||||
The fastest way to build MCP servers is with FastMCP, which provides a high-level, Pythonic interface:
|
||||
|
||||
```python
|
||||
from fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("Demo")
|
||||
|
||||
@mcp.tool()
|
||||
def add(a: int, b: int) -> int:
|
||||
"""Add two numbers"""
|
||||
return a + b
|
||||
|
||||
@mcp.resource("greeting://{name}")
|
||||
def get_greeting(name: str) -> str:
|
||||
"""Get a personalized greeting"""
|
||||
return f"Hello, {name}!"
|
||||
```
|
||||
|
||||
FastMCP handles all the complex protocol details and server management, so you can focus on building great tools. It's designed to be high-level and Pythonic - in most cases, decorating a function is all you need.
|
||||
|
||||
For more information about FastMCP, see the [FastMCP documentation](https://github.com/jlowin/fastmcp).
|
||||
|
||||
### Low-Level Implementation
|
||||
|
||||
For more control, you can use the low-level MCP implementation directly. This gives you full access to the protocol and allows you to customize every aspect of your server:
|
||||
|
||||
```python
|
||||
# /// script
|
||||
# dependencies = [
|
||||
# "mcp"
|
||||
# ]
|
||||
# ///
|
||||
from mcp.server import Server, NotificationOptions
|
||||
from mcp.server.models import InitializationOptions
|
||||
import mcp.server.stdio
|
||||
@@ -339,4 +356,4 @@ We are passionate about supporting contributors of all levels of experience and
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the LICENSE file for details.
|
||||
This project is licensed under the MIT License - see the LICENSE file for details.
|
||||
Reference in New Issue
Block a user