feat: mcp server sdk (#4794)

Signed-off-by: kevin <wanjunfeng@gmail.com>
This commit is contained in:
Kevin Wan
2025-04-27 23:06:37 +08:00
committed by GitHub
parent 812140ba36
commit b251ce346e
12 changed files with 5935 additions and 0 deletions

15
mcp/util.go Normal file
View File

@@ -0,0 +1,15 @@
package mcp
import (
"fmt"
)
// ptr is a helper function to get a pointer to a value
func ptr[T any](v T) *T {
return &v
}
// formatSSEMessage formats a Server-Sent Event message with proper CRLF line endings
func formatSSEMessage(event string, data []byte) string {
return fmt.Sprintf("event: %s\r\ndata: %s\r\n\r\n", event, string(data))
}