From dad01945c764660033befe0ab211c6c84c21de4a Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Wed, 18 Dec 2024 16:11:29 +0000 Subject: [PATCH] docs: Update README.md to include FastMCP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- README.md | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4ef08cf..e393a20 100644 --- a/README.md +++ b/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. \ No newline at end of file