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 serverList 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. Also controls DNS rebinding protection:Default port for server binding (default: 8000). Can be overridden in run().
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.