|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +This repository contains the official Go SDK for the Model Context Protocol (MCP). |
| 6 | +The SDK is designed to be idiomatic, future-proof, and extensible. |
| 7 | + |
| 8 | +### Key Packages |
| 9 | + |
| 10 | +- `mcp`: The core package defining the primary APIs for constructing and using MCP clients and servers. This is where most logic resides. |
| 11 | +- `jsonrpc`: Provides the JSON-RPC 2.0 transport layer. Use this if implementing custom transports. |
| 12 | +- `auth`: Primitives for supporting OAuth. |
| 13 | +- `oauthex`: Extensions to the OAuth protocol, such as Protected Resource Metadata. |
| 14 | +- `internal`: Internal implementation details not exposed to users. |
| 15 | +- `examples`: Example clients and servers. Use these as references for usage patterns. |
| 16 | + |
| 17 | +## Development Setup |
| 18 | + |
| 19 | +The project uses the standard Go toolchain. |
| 20 | + |
| 21 | +- **Build**: `go build ./...` |
| 22 | +- **Test**: `go test ./...` |
| 23 | + |
| 24 | +## Testing |
| 25 | + |
| 26 | +- **Unit Tests**: Run `go test ./...` to run all unit tests. |
| 27 | +- **Conformance Tests**: Use the following scripts to run the official MCP conformance tests against the SDK. |
| 28 | + - `./scripts/server-conformance.sh` for server tests. |
| 29 | + - `./scripts/client-conformance.sh` for client tests. |
| 30 | + - The scripts download the latest conformance suite from npm by default. |
| 31 | + - To get possible options pass the `--help` flag to the script. |
| 32 | + |
| 33 | +## Development Guidelines |
| 34 | + |
| 35 | +### Code Style |
| 36 | + |
| 37 | +- Follow standard Go conventions (Effective Go). |
| 38 | +- Use `gofmt` to format code. |
| 39 | +- Add copyright headers to all new Go files: |
| 40 | + ```go |
| 41 | + // Copyright 2025 The Go MCP SDK Authors. All rights reserved. |
| 42 | + // Use of this source code is governed by the license |
| 43 | + // that can be found in the LICENSE file. |
| 44 | + ``` |
| 45 | +- Do not add comments to the code unless they are really necessary: |
| 46 | + - Prefer self-documenting code. |
| 47 | + - Focus on the "why" not the "what" in comments. |
| 48 | + |
| 49 | +### Documentation |
| 50 | + |
| 51 | +- **README.md**: Do NOT edit `README.md` directly. It is generated from `internal/readme/README.src.md`. |
| 52 | + - Edit `internal/readme/README.src.md`. |
| 53 | + - Run `go generate ./internal/readme` to regenerate. |
| 54 | + - Commit both files. |
| 55 | +- **docs/**: Do NOT edit `docs/` directory directly. It is generated from files in `internal/docs`. |
| 56 | + - Edit `internal/docs/*.src.md`. |
| 57 | + - Run `go generate ./internal/docs` to regenerate. |
| 58 | + - Commit files from both directories. |
0 commit comments