Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tool/mcptool/mcp.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (c) Microsoft. All rights reserved.

// Package mcp provides integration with the Model Context Protocol (MCP).
// It allows agents to connect to external MCP servers via stdio, HTTP, or WebSocket
// and expose their tools and prompts as agent.Tool instances.
// It allows agents to connect to external MCP servers via stdio (subprocess)
// or HTTP (SSE / streamable HTTP) and expose their tools as
// tool.Tool / tool.FuncTool instances.
package mcptool

import (
Expand Down
26 changes: 26 additions & 0 deletions tool/mcptool/mcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"encoding/base64"
"encoding/json"
"errors"
"os"
"path/filepath"
"strings"
"testing"

Expand Down Expand Up @@ -1026,3 +1028,27 @@ func TestAddToolTypedNilContentDoesNotPanic(t *testing.T) {
t.Fatalf("content = %#v, want a TextContent containing \"null\"", contents[0])
}
}

// TestPackageDocNoWebSocket guards against re-introducing the inaccurate
// claim that mcptool supports a WebSocket transport. Connect only wraps an
// mcp.Transport supplied by the pinned go-sdk, which offers stdio and HTTP
// (SSE / streamable HTTP) transports but no WebSocket transport.
func TestPackageDocNoWebSocket(t *testing.T) {
entries, err := os.ReadDir(".")
if err != nil {
t.Fatalf("ReadDir(.) error = %v", err)
}
for _, e := range entries {
name := e.Name()
if e.IsDir() || !strings.HasSuffix(name, ".go") || strings.HasSuffix(name, "_test.go") {
continue
}
data, err := os.ReadFile(filepath.Join(".", name))
if err != nil {
t.Fatalf("ReadFile(%s) error = %v", name, err)
}
if strings.Contains(strings.ToLower(string(data)), "websocket") {
t.Errorf("%s mentions WebSocket, but the go-sdk provides no WebSocket transport", name)
}
}
}
Loading