ServerInterface class abstract

Interface for server to expose key functionality for testing

Constructors

ServerInterface()

Properties

capabilities ServerCapabilities
Server capabilities configuration
no setter
hashCode int
The hash code for this object.
no setterinherited
name String
Name of the MCP server
no setter
onConnect Stream<ClientSession>
Stream of session connection events
no setter
onDisconnect Stream<ClientSession>
Stream of session disconnection events
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version String
Version of the MCP server implementation
no setter

Methods

addPrompt({required String name, required String description, required List<PromptArgument> arguments, required PromptHandler handler, String? title, List<Map<String, dynamic>>? icons, Map<String, dynamic>? meta}) → void
Add a prompt to the server. Spec 2025-06-18+ optional title. Spec 2025-11-25+: icons. meta is the spec _meta map.
addResource({required String uri, required String name, required String description, required String mimeType, Map<String, dynamic>? uriTemplate, required ResourceHandler handler, String? title, List<Map<String, dynamic>>? icons, Map<String, dynamic>? meta}) → void
Add a resource to the server. Spec 2025-06-18+ optional fields: title. Spec 2025-11-25+: icons. meta is the spec _meta map.
addTool({required String name, required String description, required Map<String, dynamic> inputSchema, required ToolHandler handler, String? title, Map<String, dynamic>? outputSchema, List<Map<String, dynamic>>? icons, Map<String, dynamic>? meta}) → void
Add a tool to the server. Spec 2025-06-18+ optional fields: title (display name), outputSchema (structured result schema). Spec 2025-11-25+: icons. meta is the spec _meta map.
getHealth() ServerHealth
Get server health information
getPrompts() List<Prompt>
Get all registered prompts
getResources() List<Resource>
Get all registered resources
getSessions() List<ClientSession>
Get all active sessions
getTools() List<Tool>
Get all registered tools
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removePrompt(String name) → void
Remove a prompt from the server
removeResource(String uri) → void
Remove a resource from the server
removeTool(String name) → void
Remove a tool from the server
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited