This example demonstrates how to use the HTTP transport in MCP. It consists of a server that provides a simple time tool and a client that connects to it.
Running the Example
First, start the server:
go run server/main.go
This will start an HTTP server on port 8080.
In another terminal, run the client:
go run client/main.go
The client will:
Connect to the server
List available tools
Call the time tool with different time formats
Display the results
Understanding the Code
server/main.go: Shows how to create an MCP server using HTTP transport and register a tool
client/main.go: Shows how to create an MCP client that connects to an HTTP server and calls tools