Skip to content

Commit d16ce9c

Browse files
mcp/examples: moves middleware examples into example folder (#356)
For better organization.
1 parent b891d95 commit d16ce9c

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

mcp/example_progress_test.go renamed to examples/client/middleware/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by an MIT-style
33
// license that can be found in the LICENSE file.
44

5-
package mcp_test
5+
package main
66

77
import (
88
"context"
@@ -15,10 +15,9 @@ var nextProgressToken atomic.Int64
1515

1616
// This middleware function adds a progress token to every outgoing request
1717
// from the client.
18-
func Example_progressMiddleware() {
19-
c := mcp.NewClient(testImpl, nil)
18+
func main() {
19+
c := mcp.NewClient(&mcp.Implementation{Name: "test"}, nil)
2020
c.AddSendingMiddleware(addProgressToken[*mcp.ClientSession])
21-
_ = c
2221
}
2322

2423
func addProgressToken[S mcp.Session](h mcp.MethodHandler) mcp.MethodHandler {

mcp/example_middleware_test.go renamed to examples/server/middleware/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by an MIT-style
33
// license that can be found in the LICENSE file.
44

5-
package mcp_test
5+
package main
66

77
import (
88
"context"
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
// This example demonstrates server side logging using the mcp.Middleware system.
19-
func Example_loggingMiddleware() {
19+
func main() {
2020
// Create a logger for demonstration purposes.
2121
logger := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
2222
Level: slog.LevelInfo,

mcp/mcp-repo-replace.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)