Hi. Thanks for awesome koog framework. I'm current...
# koog-agentic-framework
с
Hi. Thanks for awesome koog framework. I'm currently playing with it and trying to use SSE MCP Here is my code
Copy code
import ai.koog.agents.core.agent.AIAgent
import ai.koog.agents.mcp.McpToolRegistryProvider
import ai.koog.prompt.executor.llms.all.simpleOllamaAIExecutor
import ai.koog.prompt.llm.OllamaModels
import kotlinx.coroutines.runBlocking


fun main() {
  println("================")
  runBlocking {

    println("Init transport")
    val transport = McpToolRegistryProvider.defaultSseTransport("<http://127.0.0.1:8080>")

    val toolRegistry = McpToolRegistryProvider.fromTransport(
      transport = transport,
      name = "WikiSearch",
      version = "1.0.0"
    )

    println("Tool registry initialized with ${toolRegistry.tools.size} tools")


    val agent = AIAgent(
      executor = simpleOllamaAIExecutor(),
      llmModel = OllamaModels.Meta.LLAMA_3_2.copy(
        id = "qwen3:8b"
      ),
      toolRegistry = toolRegistry,
    )

    val result = agent.run("What is the capital of Germany?")
    println(result)
  }
}
and MCP server code in golang
Copy code
package main

import (
	"context"
	"errors"
	"flag"
	"fmt"
	"log"

	"<http://github.com/mark3labs/mcp-go/mcp|github.com/mark3labs/mcp-go/mcp>"
	"<http://github.com/mark3labs/mcp-go/server|github.com/mark3labs/mcp-go/server>"
	gowiki "<http://github.com/trietmn/go-wiki|github.com/trietmn/go-wiki>"
)

func main() {
	// Parse command line flags
	sseMode := true
	flag.Parse()
	// Create MCP server
	mcpServer := server.NewMCPServer(
		"WikiSearch",
		"1.0.0",
	)
	tool := mcp.NewTool("wiki_search",
		mcp.WithDescription("Search a subject on Wikipedia"),
		mcp.WithString("subject",
			mcp.Required(),
			mcp.Description("subject to search on Wikipedia"),
		),
	)

	// Add tool handler
	mcpServer.AddTool(tool, wikiSearchHandler)

	// Start the stdio server
	// Run server in appropriate mode
	if sseMode {
		// Create and start SSE server
		sseServer := server.NewSSEServer(mcpServer, server.WithBaseURL("<http://localhost:8080>"))
		log.Printf("Starting SSE server on localhost:8080")
		if err := sseServer.Start(":8080"); err != nil {
			log.Fatalf("Server error: %v", err)
		}
	} else {
		// Run as stdio server
		if err := server.ServeStdio(mcpServer); err != nil {
			log.Fatalf("Server error: %v", err)
		}
	}
}

func wikiSearchHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
	args, ok := request.Params.Arguments.(map[string]any)
	if !ok {
		return nil, errors.New("arguments must be an object")
	}

	subject, ok := args["subject"].(string)
	if !ok {
		return nil, errors.New("subject must be a string")
	}

	page, err := gowiki.GetPage(subject, -1, false, true)
	if err != nil {
		return nil, fmt.Errorf("get page error: %w", err)
	}

	content, err := page.GetContent()
	if err != nil {
		return nil, fmt.Errorf("get content error: %w", err)
	}

	return mcp.NewToolResultText(content), nil
}
When I start my app it gets stuck on init section
Copy code
================
Init transport
Can anybody help me what I'm doing wrong ?
As I understand koog is still using old legacy /sse endpoints instead of /mcp. Can anybody point what libs can I use to create custom /see server ?
m
Hi! Yea, the latest 0.3.0 version of koog is based on mcp kotlin-sdk with version 0.5.0, where /sse endpoint is hardcoded. In the following 0.4.0 koog release we migrated to 0.6.0 where this issue is resolved and you can customize endpoint both in client and server side. As for now the way to go is to provide /sse endpoint from server side (you can still use go). As alternative you can try mcp kotlin sdk, which will guarantee koog<->mcp server compatibility (having the same sdk version)
❤️ 1