McpServerController class abstract
Abstract base for MCPP-compatible controllers in the Finch framework.
Extend this class and implement configure to declaratively register all MCPP capabilities using McpBuilder. The controller handles all standard MCPP JSON-RPC routing automatically.
class MyMcpController extends McpController {
@override
void configure(McpBuilder mcp) {
mcp.tool(
name: 'hello',
description: 'Says hello',
handler: (req) async =>
CallToolResult(content: [TextContent(text: 'Hello!')]),
);
mcp.resource(
name: 'readme',
uri: rq.url(''),
handler: (req) async => ReadResourceResult(contents: [...]),
);
// Override or extend built-in method routing:
mcp.method('notifications/initialized', (p) async =>
JSONRPCNotification(method: 'notifications/initialized'));
}
}
- Inheritance
-
- Object
- Controller
- McpServerController
Constructors
Properties
Methods
-
configure(
McpBuilder mcp) → void - Register all MCPP capabilities for this server.
-
index(
) → Future< String> -
Provides an asynchronous method for rendering the index page of the controller.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
{bool short = false}) → String -
Returns a string representation of the controller.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited