feat(mcp): add embedded MCP server with dual transport support (#67)

This commit is contained in:
João Salavisa
2026-01-21 12:03:46 +00:00
committed by GitHub
parent fa8364307f
commit c57a82f81d
33 changed files with 1549 additions and 71 deletions
@@ -41,6 +41,15 @@ type Instance struct {
server *http.Server
}
// McpServerConfig holds configuration for an MCP server.
type McpServerConfig struct {
Name string `json:"name"`
URL string `json:"url,omitempty"`
Type string `json:"type,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
}
// CreateRequest contains the parameters for creating a new agent instance.
type CreateRequest struct {
// ID is an optional identifier for the instance. If empty, one will be generated.
@@ -64,6 +73,9 @@ type CreateRequest struct {
// AutoStart indicates whether to start the agent automatically after creation.
AutoStart bool `json:"auto_start,omitempty"`
// McpServers is a list of MCP servers to configure for the agent.
McpServers []McpServerConfig `json:"mcp_servers,omitempty"`
}
// CreateResponse contains the result of creating a new agent instance.
@@ -83,12 +83,26 @@ func (m *Manager) CreateInstance(ctx context.Context, req *CreateRequest) (*Crea
// Build overrides from request
autoStart := req.AutoStart
// Convert MCP server configs
var mcpServers []config.McpServerConfig
for _, mcp := range req.McpServers {
mcpServers = append(mcpServers, config.McpServerConfig{
Name: mcp.Name,
URL: mcp.URL,
Type: mcp.Type,
Command: mcp.Command,
Args: mcp.Args,
})
}
overrides := &config.InstanceOverrides{
Protocol: agent.Protocol(req.Protocol),
AgentCommand: agentCmd,
WorkDir: req.WorkspacePath,
AutoStart: &autoStart,
Env: config.CollectAgentEnv(req.Env),
McpServers: mcpServers,
}
// Create instance config using the unified method