feat(agent): add MCP integration (#50)

* feat(agent): add MCP integration

Signed-off-by: mudler <mudler@localai.io>

* Update core/agent/mcp.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Hook MCP Server configuration to creation and setting mask

* Allow to specify a bearer token

* Small fixups

---------

Signed-off-by: mudler <mudler@localai.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Ettore Di Giacinto
2025-03-15 23:25:03 +01:00
committed by GitHub
parent dc2570c90b
commit 33b5b8c8f4
10 changed files with 422 additions and 14 deletions

View File

@@ -31,6 +31,7 @@ type AgentConfig struct {
Connector []ConnectorConfig `json:"connectors" form:"connectors" `
Actions []ActionsConfig `json:"actions" form:"actions"`
PromptBlocks []PromptBlocksConfig `json:"promptblocks" form:"promptblocks"`
MCPServers []agent.MCPServer `json:"mcp_servers" form:"mcp_servers"`
// This is what needs to be part of ActionsConfig
Model string `json:"model" form:"model"`

View File

@@ -212,6 +212,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
WithModel(model),
WithLLMAPIURL(a.apiURL),
WithContext(ctx),
WithMCPServers(config.MCPServers...),
WithPeriodicRuns(config.PeriodicRuns),
WithPermanentGoal(config.PermanentGoal),
WithPrompts(promptBlocks...),