Files
herolib/lib/mcp/server.v
Mahmoud-Emad 914cba5388 feat: add HTTP/REST transport for MCP servers
- Refactor server to use a generic transport interface
- Add HttpTransport for JSON-RPC and REST over HTTP
- Move existing STDIO logic into a StdioTransport
- Enable dual-mode (STDIO/HTTP) via command-line flags
- Add new examples and docs for HTTP server usage
2025-07-28 13:32:01 +03:00

28 lines
653 B
V

module mcp
import log
import freeflowuniverse.herolib.schemas.jsonrpc
import freeflowuniverse.herolib.mcp.transport
// Server is the main MCP server struct
@[heap]
pub struct Server {
ServerConfiguration
pub mut:
client_config ClientConfiguration
handler jsonrpc.Handler
backend Backend
transport transport.Transport
}
// start starts the MCP server using the configured transport
pub fn (mut s Server) start() ! {
log.info('Starting MCP server')
s.transport.start(&s.handler)!
}
// send sends a response to the client using the configured transport
pub fn (mut s Server) send(response string) {
s.transport.send(response)
}