Change CONTRIBUTING.md and README.md to reflect that the MCP SDK is being moved to github.com/modelcontextprotocol/go-sdk, and to include content from the 'Governance' section of the design doc. Also, include the antitrust policy as a section in CONTRIBUTING.md. Change-Id: I46784d8e57b2a2cab8895593f633d20a2e15c8ba Reviewed-on: https://go-review.googlesource.com/c/tools/+/682976 Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Auto-Submit: Robert Findley <rfindley@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
35 lines
916 B
Go
35 lines
916 B
Go
// Copyright 2025 The Go MCP SDK Authors. All rights reserved.
|
|
// Use of this source code is governed by an MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// !+
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"github.com/modelcontextprotocol/go-sdk/mcp"
|
|
)
|
|
|
|
type HiParams struct {
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParamsFor[HiParams]) (*mcp.CallToolResultFor[any], error) {
|
|
return &mcp.CallToolResultFor[any]{
|
|
Content: []*mcp.Content{mcp.NewTextContent("Hi " + params.Name)},
|
|
}, nil
|
|
}
|
|
|
|
func main() {
|
|
// Create a server with a single tool.
|
|
server := mcp.NewServer("greeter", "v1.0.0", nil)
|
|
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
|
|
// Run the server over stdin/stdout, until the client disconnects
|
|
if err := server.Run(context.Background(), mcp.NewStdIOTransport()); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
|
|
// !-
|