-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
64 lines (63 loc) · 2.07 KB
/
doc.go
File metadata and controls
64 lines (63 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2025 John Wang. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
// Package mcpkit provides a toolkit for building MCP (Model Context Protocol)
// applications in Go.
//
// MCPKit is organized into focused subpackages:
//
// - runtime: Core MCP server runtime with tools, prompts, resources, and
// multiple transport options (stdio, HTTP, SSE)
// - oauth2: OAuth 2.1 Authorization Server with PKCE support for
// MCP authentication
//
// # Quick Start
//
// For building MCP servers, import the runtime package:
//
// import "github.com/plexusone/mcpkit/runtime"
//
// rt := runtime.New(&mcp.Implementation{
// Name: "my-server",
// Version: "1.0.0",
// }, nil)
//
// // Add tools, prompts, resources
// runtime.AddTool(rt, tool, handler)
//
// // Library mode: call directly
// result, err := rt.CallTool(ctx, "add", map[string]any{"a": 1, "b": 2})
//
// // Server mode: serve via HTTP
// rt.ServeHTTP(ctx, &runtime.HTTPServerOptions{
// Addr: ":8080",
// })
//
// For OAuth 2.1 authentication with PKCE (required by ChatGPT.com and other
// MCP clients):
//
// import "github.com/plexusone/mcpkit/oauth2"
//
// srv, err := oauth2.New(&oauth2.Config{
// Issuer: "https://example.com",
// Users: map[string]string{"admin": "password"},
// })
//
// See the individual package documentation for detailed usage.
//
// # Design Philosophy
//
// MCP (Model Context Protocol) is fundamentally a client-server protocol based
// on JSON-RPC. However, many use cases benefit from invoking MCP capabilities
// directly in-process without the overhead of transport serialization:
//
// - Unit testing tools without mocking transports
// - Embedding agent capabilities in applications
// - Building local pipelines
// - Serverless runtimes
//
// mcpkit treats MCP as an "edge protocol" while providing a library-first
// internal API. Tools registered with mcpkit use the exact same handler
// signatures as the MCP SDK, ensuring behavior is identical regardless of
// execution mode.
package mcpkit