go-mcp

This repository provides code adapted from Kotlin and TypeScript SDKs for the Model Context Protocol (MCP), offering client and server implementations for interacting with tools and handling JSON RPC communication.

2
0

Model Context Protocol

This code is adapted from the kotlin-sdk and typescript-sdk. More information is available at https://modelcontextprotocol.io/introduction.

MCP Client

To create an MCP Client, define its capabilities. Then, client.Connect(transport) establishes a connection to the Transport via the Protocol (which the Client extends), initiating the initialize process. After initialization, methods like client.ListTools() and CallTool() can be used.

MCP Server

Creating an MCP Server mirrors the client creation process: define its capabilities and call server.Connect(transport). This starts the server, enabling it to listen for incoming messages through the specified Transport.

JSON RPC

The Transport classes and Protocol are independent of MCP and can be used for other JSON-based RPC systems like LSP.

JSON RCP Transport

The Transport interface and its client/server implementations (stdio, sse, in_memory) handle the sending and receiving of JSON RPC messages. The Transport interface does not handle message formatting or parsing.

JSON RPC Protocol

The Protocol class formats and parses JSON into Request/Response/Notification/Error messages, delegating the actual sending and receiving to the Transport.

Repository

NA
nalbion

nalbion/go-mcp

Created

February 8, 2025

Updated

March 20, 2025

Language

Go

Category

Communication