example

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package example contains self-contained snippets and integration tests that demonstrate how to use the MCP client/server libraries.

The code under the sub-directories can be executed with `go test` and covers scenarios such as custom tool registration, filesystem resources and OAuth protected interactions.

Directories

Path Synopsis
auth
experimental
Package term shows an experimental end-to-end flow that exercises the MCP authorization stack using a browser-based OAuth 2.1 flow.
Package term shows an experimental end-to-end flow that exercises the MCP authorization stack using a browser-based OAuth 2.1 flow.
percall
Package percall demonstrates per-call token usage.
Package percall demonstrates per-call token usage.
term
Package term demonstrates how to integrate terminal-based user interaction with an MCP server secured by OAuth2/OIDC.
Package term demonstrates how to integrate terminal-based user interaction with an MCP server secured by OAuth2/OIDC.
Package custom shows how to implement a fully custom MCP tool and register it with a server.
Package custom shows how to implement a fully custom MCP tool and register it with a server.
Package fs contains examples that treat a local filesystem subtree as an MCP resource provider.
Package fs contains examples that treat a local filesystem subtree as an MCP resource provider.
Package resource contains helper types used by other examples to model simple resources exposed over MCP.
Package resource contains helper types used by other examples to model simple resources exposed over MCP.
Package tool implements a very small sample tool that can be registered with an MCP server for demonstration purposes (see tests in the parent example packages).
Package tool implements a very small sample tool that can be registered with an MCP server for demonstration purposes (see tests in the parent example packages).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL