Debian Codegraph @

debian/go/src/github.com/modelcontextprotocol/go-sdk/internal/readme/contributing.src.md

raw symbols SCIP
1 # Contributing to the Go MCP SDK
2
3 Thank you for your interest in contributing! The Go SDK needs active
4 contributions to keep up with changes in the MCP spec, fix bugs, and accommodate
5 new and emerging use-cases. We welcome all forms of contribution, from filing
6 and reviewing issues, to contributing fixes, to proposing and implementing new
7 features.
8
9 As described in the [design document](https://github.com/modelcontextprotocol/go-sdk/blob/main/design/design.md), it is important for
10 the MCP SDK to remain idiomatic, future-proof, and extensible. The process
11 described here is intended to ensure that the SDK evolves safely and
12 transparently, while adhering to these goals.
13
14 %toc
15
16
17 ## Development setup
18
19 This module can be built and tested using the standard Go toolchain. Run `go
20 test ./...` to run all its tests.
21
22 To test changes to this module against another module that uses the SDK, we
23 recommend using a [`go.work` file](https://go.dev/doc/tutorial/workspaces) to
24 define a multi-module workspace. For example, if your directory contains a
25 `project` directory containing your project, and a `go-sdk` directory
26 containing the SDK, run:
27
28 ```sh
29 go work init ./project ./go-sdk
30 ```
31
32 ### Conformance tests
33
34 The SDK includes a script to run the official MCP conformance tests against the
35 SDK's conformance server:
36
37 ```sh
38 ./scripts/conformance.sh
39 ```
40
41 By default, results are cleaned up after the script runs. To save results to a
42 specific directory:
43
44 ```sh
45 ./scripts/conformance.sh --result_dir ./conformance-results
46 ```
47
48 To run against a local checkout of the
49 [conformance repo](https://github.com/modelcontextprotocol/conformance) instead
50 of the latest npm release:
51
52 ```sh
53 ./scripts/conformance.sh --conformance_repo ~/src/conformance
54 ```
55
56 Note: you must run `npm install` in the conformance repo first.
57
58 Run `./scripts/conformance.sh --help` for more options.
59
60 ## Filing issues
61
62 This project uses the [GitHub issue
63 tracker](https://github.com/modelcontextprotocol/go-sdk/issues) for issues. The
64 process for filing bugs and proposals is described below.
65
66 TODO(rfindley): describe a process for asking general questions in the public
67 MCP discord server.
68
69 ### Bugs
70
71 Please [report
72 bugs](https://github.com/modelcontextprotocol/go-sdk/issues/new). If the SDK is
73 not working as you expected, it is likely due to a bug or inadequate
74 documentation, and reporting an issue will help us address this shortcoming.
75
76 When reporting a bug, make sure to answer these five questions:
77
78 1. What did you do?
79 2. What did you see?
80 3. What did you expect to see?
81 4. What version of the Go MCP SDK are you using?
82 5. What version of Go are you using (`go version`)?
83
84 ### Proposals
85
86 A proposal is an issue that proposes a new API for the SDK, or a change to the
87 signature or behavior of an existing API. Proposals should be labeled with the
88 'proposal' label, and require an explicit approval from a maintainer before
89 being accepted (indicated by the 'proposal-accepted' label). Proposals must
90 remain open for at least a week to allow discussion before being accepted or
91 declined by a maintainer.
92
93 Proposals that are straightforward and uncontroversial may be approved based on
94 discussion on the issue tracker or in a GitHub Discussion. However, proposals
95 that are deemed to be sufficiently unclear or complicated may be deferred to a
96 regular Working Group meeting (see 'Governance' below).
97
98 This process is similar to the [Go proposal
99 process](https://github.com/golang/proposal), but is necessarily lighter weight
100 to accommodate the greater rate of change expected for the SDK.
101
102 ### Design discussion
103
104 For open ended design discussion (anything that doesn't fall into the issue
105 categories above), use [GitHub
106 Discussions](https://github.com/modelcontextprotocol/go-sdk/discussions).
107 Ideally, each discussion should be focused on one aspect of the design. For
108 example: Tool Binding and Session APIs would be two separate discussions.
109 When discussions reach a consensus, they should be promoted into proposals.
110
111 ## Contributing code
112
113 The project uses GitHub pull requests (PRs) to review changes.
114
115 Any significant change should be associated with a GitHub issue. Issues that
116 are deemed to be good opportunities for contribution are be labeled ['Help
117 Wanted'](https://github.com/modelcontextprotocol/go-sdk/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22).
118 If you want to work on such an issue, please first comment on the issue to say
119 that you're interested in contributing. For issues _not_ labeled 'Help Wanted',
120 it is recommended that you ask (and wait for confirmation) on the issue before
121 contributing, to avoid duplication of effort or wasted work. For nontrivial
122 changes that _don't_ relate to an existing issue, please file an issue first.
123
124 Changes should be high quality and well tested, and should generally follow the
125 [Google Go style guide](https://google.github.io/styleguide/go/). Commit
126 messages should follow the [format used by the Go
127 project](https://go.dev/wiki/CommitMessage).
128
129 Unless otherwise noted, the Go source files are distributed under the license
130 found in the LICENSE file. New contributions are licensed under Apache 2.0. All
131 Go files in the SDK should have a copyright header following the format below:
132
133 ```go
134 // Copyright 2025 The Go MCP SDK Authors. All rights reserved.
135 // Use of this source code is governed by the license
136 // that can be found in the LICENSE file.
137 ```
138
139 ### Adding and updating dependencies
140
141 In general, the SDK tries to use as few dependencies as possible. Each new
142 dependency is a potential source for bugs, churn, and conflicts for our users.
143 Therefore, we require a [proposal](#proposals) for any new module dependency,
144 including upgrading an existing module to a new major version. New dependencies
145 should be evaluated for their stability and security, and should be
146 well-established in the Go ecosystem.
147
148 In general, dependencies should be for internal use by the SDK implementation,
149 or for testing. Do not include types from dependencies in the SDK API.
150
151 On the other hand, updating existing dependencies can be done at any time
152 without a proposal, as long as their major version does not change. Prefer to
153 update dependencies immediately following a release of the SDK, to allow as
154 much time as possible to find issues with the new version.
155
156 After any change to dependencies, run govulncheck to check them for
157 vulnerabilities.
158
159 ```
160 go run golang.org/x/vuln/cmd/govulncheck@latest
161 ```
162
163 ### Updating the README
164
165 The top-level `README.md` file is generated from `internal/readme/README.src.md`
166 and should not be edited directly. To update the README:
167
168 1. Make your changes to `internal/readme/README.src.md`
169 2. Run `go generate ./internal/readme` from the repository root to regenerate `README.md`
170 3. Commit both files together
171
172 The CI system will automatically check that the README is up-to-date by running
173 `go generate ./internal/readme` and verifying no changes result. If you see a CI failure about the
174 README being out of sync, follow the steps above to regenerate it.
175
176 ## Timeouts
177
178 If a contributor hasn't responded to issue questions or PR comments in two weeks,
179 the issue or PR may be closed. It can be reopened when the contributor can resume
180 work.
181
182 ## Code of conduct
183
184 This project follows the [Go Community Code of Conduct](https://go.dev/conduct).
185 If you encounter a conduct-related issue, please mail [email protected].
186
187 ## Governance
188
189 Initially, the Go SDK repository will be administered by the Go team and
190 Anthropic, and they will be the approvers (the set of people able to merge PRs
191 to the SDK), also referred to as the 'Working Group'. The policies here are
192 also intended to satisfy necessary constraints of the Go team's participation
193 in the project. This may change in the future: see 'Ongoing Evaluation' below.
194
195 ### Working Group meetings
196
197 On a regular basis, the Working Group will host a virtual meeting to discuss
198 outstanding proposals and other changes to the SDK. These meetings and their
199 agendas will be announced in advance, and open to all. The meetings will be
200 recorded, and recordings and meeting notes will be made available afterward.
201 (TODO: decide on a mechanism for tracking these meetings--likely a GitHub
202 issue.)
203
204 This process is similar to the [Go Tools
205 call](https://go.dev/wiki/golang-tools), though it is expected that meetings
206 will at least initially occur on a more frequent basis.
207
208 ### Discord
209
210 Discord (either the public or private Anthropic discord servers) should only be
211 used for logistical coordination or answering questions. For transparency and
212 durability, design discussion and decisions should occur in GitHub issues,
213 GitHub discussions, or public steering meetings.
214
215 ### Antitrust considerations
216
217 The goal of this repository is to provide a robust and complete Go
218 implementation of the model context protocol, in an open and transparent
219 manner, without bias toward specific integration paths or providers. To that
220 end, the model context protocol organization's [antitrust
221 policy](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/ANTITRUST.md)
222 applies to all participation in this project.