### MCP Server Configuration Example Source: https://github.com/lubyruffy/einomcphost/blob/main/README.md Define your MCP servers in a JSON file. Supports 'stdio' and 'sse' transports with specific configurations for each. ```json { "mcpServers": { "fofa_mcp": { "transport": "stdio", "command": "python", "args": [ "-m", "fofa_mcp" ], "disabled": false }, "another_sse_server": { "transport": "sse", "url": "http://localhost:8080/events", "disabled": false } } } ``` -------------------------------- ### Initialize MCP Hub and Get Eino Tools in Go Source: https://github.com/lubyruffy/einomcphost/blob/main/README.md Initialize the MCPHub from a configuration file and retrieve specific Eino tools. Ensure the context is managed and servers are closed upon completion. ```go package main import ( "context" "fmt" "log" "github.com/LubyRuffy/einomcphost" "github.com/cloudwego/eino-ext/components/model/openai" "github.com/cloudwego/eino/flow/agent" "github.com/cloudwego/eino/flow/agent/react" "github.com/cloudwego/eino/schema" ) func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() // 1. Create a new MCPHub from the configuration file hub, err := einomcphost.NewMCPHub(ctx, `mcpservers.json`) if err != nil { log.Fatal(err) } defer hub.CloseServers() // 2. Get the list of Eino tools you want to use // The tool names are prefixed with the server name from the config, e.g., "fofa_mcp_web_search" tools, err := hub.GetEinoTools(ctx, []string{"fofa_mcp_web_search"}) if err != nil { log.Fatal(err) } log.Printf("Successfully loaded %d tools", len(tools)) // 3. (Optional) You can also get a map of all available tools allTools, err := hub.GetToolsMap(ctx) if err != nil { log.Fatal(err) } fmt.Println("Available tools:") for toolName := range allTools { fmt.Println("- ", toolName) } // 4. Use the tools with an Eino agent // (This is a simplified example, see examples/tools/main.go for a complete implementation) /* openaiClient, _ := openai.NewChatModel(ctx, &openai.ChatModelConfig{ ... }) reactAgent, _ := react.NewAgent(ctx, &react.AgentConfig{ ToolCallingModel: openaiClient, ToolsConfig: compose.ToolsNodeConfig{ Tools: tools, }, }) s, _ := reactAgent.Stream(ctx, []*schema.Message{ { Role: "user", Content: "Search for the founding year of Google", }, }) // ... process stream ... */ } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.