page

FastMCP Server Class

FastMCP server class documentation

server api configuration

The FastMCP Server

The central piece of a FastMCP application is the FastMCP server class. This class acts as the main container for your application's tools, resources, and prompts, and manages communication with MCP clients.

Creating a Server

Instantiating a server is straightforward. You typically provide a name for your server, which helps identify it in client applications or logs.

from fastmcp import FastMCP

# Create a basic server instance
mcp = FastMCP(name="MyAssistantServer")

# You can also add instructions for how to interact with the server
mcp_with_instructions = FastMCP(
    name="HelpfulAssistant",
    instructions="""
        This server provides data analysis tools.
        Call get_average() to analyze numerical data.
    """,
)

Constructor Parameters

  • name (str): Human-readable name for your server
  • instructions (str, optional): Description of how to interact with this server
  • version (str, optional): Version string for your server
  • website (str, optional): URL to a website with more information
  • icons (list, optional): List of icon representations
  • auth (OAuthProvider | TokenVerifier | None): Authentication provider
  • include_tags (set[str], optional): Only expose components with matching tags
  • exclude_tags (set[str], optional): Hide components with matching tags

Running the Server

if __name__ == "__main__":
    mcp.run()  # Default STDIO transport
    # Or specify transport:
    # mcp.run(transport="http", host="127.0.0.1", port=9000)

FastMCP supports STDIO (default), HTTP (recommended for web), and SSE (legacy) transports.

ID: 68c10f1e
Path: FastMCP Framework > Core Server > FastMCP Server Class
Updated: 2026-01-10T09:57:04