This commit is contained in:
2025-05-04 08:19:47 +03:00
parent d8a59d0726
commit 46e1c6706c
177 changed files with 5708 additions and 5512 deletions

View File

@@ -16,32 +16,29 @@ pub:
// new_server creates a new MCP server
pub fn new_server(backend Backend, params ServerParams) !&Server {
mut server := &Server{
ServerConfiguration: params.config,
backend: backend,
ServerConfiguration: params.config
backend: backend
}
// Create a handler with the core MCP procedures registered
handler := jsonrpc.new_handler(jsonrpc.Handler{
procedures: {
...params.handlers,
// ...params.handlers,
// Core handlers
'initialize': server.initialize_handler,
'notifications/initialized': initialized_notification_handler,
'initialize': server.initialize_handler
'notifications/initialized': initialized_notification_handler
// Resource handlers
'resources/list': server.resources_list_handler,
'resources/read': server.resources_read_handler,
'resources/templates/list': server.resources_templates_list_handler,
'resources/subscribe': server.resources_subscribe_handler,
'resources/list': server.resources_list_handler
'resources/read': server.resources_read_handler
'resources/templates/list': server.resources_templates_list_handler
'resources/subscribe': server.resources_subscribe_handler
// Prompt handlers
'prompts/list': server.prompts_list_handler,
'prompts/get': server.prompts_get_handler,
'completion/complete': server.prompts_get_handler,
'prompts/list': server.prompts_list_handler
'prompts/get': server.prompts_get_handler
'completion/complete': server.prompts_get_handler
// Tool handlers
'tools/list': server.tools_list_handler,
'tools/call': server.tools_call_handler
'tools/list': server.tools_list_handler
'tools/call': server.tools_call_handler
}
})!