π The fast, Pythonic way to build MCP servers and clients.
Update README.md
Ryan Malloy9788fabe19a1
diff --git a/src/fastmcp/contrib/mcp_mixin/README.md b/src/fastmcp/contrib/mcp_mixin/README.mdindex 6dce9c9e3..5e0af966f 100644--- a/src/fastmcp/contrib/mcp_mixin/README.md+++ b/src/fastmcp/contrib/mcp_mixin/README.md@@ -4,6 +4,18 @@ This module provides the `MCPMixin` base class and associated decorators (`@mcp_It allows developers to easily define classes whose methods can be registered as tools, resources, or prompts with a `FastMCP` server instance using the `register_all()`, `register_tools()`, `register_resources()`, or `register_prompts()` methods provided by the mixin.+Includes support for+Tools:+* [enable/disable](https://gofastmcp.com/servers/tools#disabling-tools)+* [annotations](https://gofastmcp.com/servers/tools#annotations-2)+* [excluded arguments](https://gofastmcp.com/servers/tools#excluding-arguments)++Prompts:+* [enable/disable](https://gofastmcp.com/servers/prompts#disabling-prompts)++Resources:+* [enable/disabe](https://gofastmcp.com/servers/resources#disabling-resources)+## UsageInherit from `MCPMixin` and use the decorators on the methods you want to register.@@ -17,10 +29,33 @@ class MyComponent(MCPMixin):def tool_method(self):return "Tool executed!"+ # example of disabled tool+ @mcp_tool(name="my_tool", description="Does something cool.", enabled=False)+ def disabled_tool_method(self):+ # This function can't be called by client because it's disabled+ return "You'll never get here!"++ @mcp_tool(+ name="my_tool", description="Does something cool.",+ annotations={+ "title": "Attn LLM, use this tool first!",+ "readOnlyHint": False,+ "destructiveHint": False,+ "idempotentHint": False+ }+ )+ def tool_method(self):+ return "Tool executed!"+@mcp_resource(uri="component://data")def resource_method(self):return {"data": "some data"}+ # Disabled resource+ @mcp_resource(uri="component://data", enabled=False)+ def resource_method(self):+ return {"data": "some data"}+mcp_server = FastMCP()component = MyComponent()@@ -36,4 +71,4 @@ component.register_all(mcp_server, prefix="my_comp")# Or 'my_tool' and 'component://data' are registered (if no prefix used)```-The `prefix` argument in registration methods is optional. If omitted, methods are registered with their original decorated names/URIs. Individual separators (`tools_separator`, `resources_separator`, `prompts_separator`) can also be provided to `register_all` to change the separator for specific types.\ No newline at end of file+The `prefix` argument in registration methods is optional. If omitted, methods are registered with their original decorated names/URIs. Individual separators (`tools_separator`, `resources_separator`, `prompts_separator`) can also be provided to `register_all` to change the separator for specific types.