View the source code for this module on GitHub: https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/server/server.py
MCPServer
method init
Initialize an MCP server.ParametersSignatureServer name for identificationServer version stringInstructions for the AI model using this serverParameter valueList of middleware to apply to requestsEnable debug mode (adds /docs, /inspector, /openmcp.json endpoints)Path for MCP endpoint (default: “/mcp”)Path for documentation endpoint (default: “/docs”)Path for inspector UI (default: “/inspector”)Path for OpenMCP metadata (default: “/openmcp.json”)Show inspector-related logsPretty print JSON-RPC messages in logsDefault host for server binding (default: “0.0.0.0”). Can be overridden in run().Default port for server binding (default: 8000). Can be overridden in run().Enable DNS rebinding protection by validating Host/Origin
method include_router
Include a router’s tools, resources, and prompts into this server.Similar to FastAPI’s include_router, this allows you to organize your
MCP server into multiple files/modules.Example:SignatureThe MCPRouter instance to includeOptional prefix to add to all tool names (e.g., “math” -> “math_add”)Whether to enable this router (default True). Set to False to skip registration.
method notify_resource_updated
Notify all subscribed sessions that a resource has been updated.Broadcasts a notifications/resources/updated message to every session
that called resources/subscribe for this URI.Can be called from within a tool handler or from any async context.ParametersSignatureThe URI of the resource that was updated.