feat: import agents_and_robots platform as unibots (Matrix-out, unibus transport)
Reemplaza el scaffold del echobot por la plataforma completa de bots traida desde ~/DataProyects/Github/agents_and_robots tras la operacion Matrix-out: los bots ya no hablan por Matrix sino por el bus unibus (modelo todo-rooms + E2E via shell/transportunibus sobre github.com/enmanuel/unibus/pkg/client). - go.mod: replace de unibus -> ../unibus y de fn-registry -> ../../../.. (paths relativos reajustados a la nueva ubicacion dentro de fn_registry). - app.md: bump a 0.2.0, descripcion + arquitectura + comandos + gotchas reales. - modulo Go conservado como github.com/enmanuel/agents (sin reescribir imports). agents_and_robots queda archivado como museo de la era Matrix.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// Package mcp provides MCP client and server implementations.
|
||||
package mcp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/mark3labs/mcp-go/mcp"
|
||||
"github.com/mark3labs/mcp-go/server"
|
||||
|
||||
"github.com/enmanuel/agents/pkg/tools"
|
||||
)
|
||||
|
||||
// MCPServer exposes agent tools as an MCP server.
|
||||
type MCPServer struct {
|
||||
srv *server.MCPServer
|
||||
logger *slog.Logger
|
||||
}
|
||||
|
||||
// NewMCPServer creates an MCP server exposing the given tool specs.
|
||||
func NewMCPServer(name, version string, specs []tools.ToolSpec, logger *slog.Logger) *MCPServer {
|
||||
srv := server.NewMCPServer(name, version)
|
||||
|
||||
for _, spec := range specs {
|
||||
spec := spec // capture
|
||||
tool := mcp.NewTool(spec.Name,
|
||||
mcp.WithDescription(spec.Description),
|
||||
)
|
||||
srv.AddTool(tool, func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
||||
// Placeholder handler — wire real execution here
|
||||
return mcp.NewToolResultText(fmt.Sprintf("tool %s called", spec.Name)), nil
|
||||
})
|
||||
}
|
||||
|
||||
return &MCPServer{srv: srv, logger: logger}
|
||||
}
|
||||
|
||||
// ServeStdio runs the MCP server over stdin/stdout (for Claude Desktop / CLI integration).
|
||||
func (m *MCPServer) ServeStdio(ctx context.Context) error {
|
||||
m.logger.Info("mcp server starting on stdio")
|
||||
return server.ServeStdio(m.srv)
|
||||
}
|
||||
Reference in New Issue
Block a user