Skip to content

Commit 97a2543

Browse files
authored
Merge branch 'main' into add_root_notification
2 parents 58fd39d + 3863f20 commit 97a2543

File tree

172 files changed

+23290
-686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+23290
-686
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Comment on PRs in Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
pull-requests: write
9+
contents: read
10+
11+
jobs:
12+
comment-on-prs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Get previous release
21+
id: previous_release
22+
uses: actions/github-script@v7
23+
with:
24+
script: |
25+
const currentTag = '${{ github.event.release.tag_name }}';
26+
27+
// Get all releases
28+
const { data: releases } = await github.rest.repos.listReleases({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
per_page: 100
32+
});
33+
34+
// Find current release index
35+
const currentIndex = releases.findIndex(r => r.tag_name === currentTag);
36+
37+
if (currentIndex === -1) {
38+
console.log('Current release not found in list');
39+
return null;
40+
}
41+
42+
// Get previous release (next in the list since they're sorted by date desc)
43+
const previousRelease = releases[currentIndex + 1];
44+
45+
if (!previousRelease) {
46+
console.log('No previous release found, this might be the first release');
47+
return null;
48+
}
49+
50+
console.log(`Found previous release: ${previousRelease.tag_name}`);
51+
52+
return previousRelease.tag_name;
53+
54+
- name: Get merged PRs between releases
55+
id: get_prs
56+
uses: actions/github-script@v7
57+
with:
58+
script: |
59+
const currentTag = '${{ github.event.release.tag_name }}';
60+
const previousTag = ${{ steps.previous_release.outputs.result }};
61+
62+
if (!previousTag) {
63+
console.log('No previous release found, skipping');
64+
return [];
65+
}
66+
67+
console.log(`Finding PRs between ${previousTag} and ${currentTag}`);
68+
69+
// Get commits between previous and current release
70+
const comparison = await github.rest.repos.compareCommits({
71+
owner: context.repo.owner,
72+
repo: context.repo.repo,
73+
base: previousTag,
74+
head: currentTag
75+
});
76+
77+
const commits = comparison.data.commits;
78+
console.log(`Found ${commits.length} commits`);
79+
80+
// Get PRs associated with each commit using GitHub API
81+
const prNumbers = new Set();
82+
83+
for (const commit of commits) {
84+
try {
85+
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
86+
owner: context.repo.owner,
87+
repo: context.repo.repo,
88+
commit_sha: commit.sha
89+
});
90+
91+
for (const pr of prs) {
92+
if (pr.merged_at) {
93+
prNumbers.add(pr.number);
94+
console.log(`Found merged PR: #${pr.number}`);
95+
}
96+
}
97+
} catch (error) {
98+
console.log(`Failed to get PRs for commit ${commit.sha}: ${error.message}`);
99+
}
100+
}
101+
102+
console.log(`Found ${prNumbers.size} merged PRs`);
103+
return Array.from(prNumbers);
104+
105+
- name: Comment on PRs
106+
uses: actions/github-script@v7
107+
with:
108+
script: |
109+
const prNumbers = ${{ steps.get_prs.outputs.result }};
110+
const releaseTag = '${{ github.event.release.tag_name }}';
111+
const releaseUrl = '${{ github.event.release.html_url }}';
112+
113+
const comment = `This pull request is included in [${releaseTag}](${releaseUrl})`;
114+
115+
let commentedCount = 0;
116+
117+
for (const prNumber of prNumbers) {
118+
try {
119+
// Check if we've already commented on this PR for this release
120+
const { data: comments } = await github.rest.issues.listComments({
121+
owner: context.repo.owner,
122+
repo: context.repo.repo,
123+
issue_number: prNumber,
124+
per_page: 100
125+
});
126+
127+
const alreadyCommented = comments.some(c =>
128+
c.user.type === 'Bot' && c.body.includes(releaseTag)
129+
);
130+
131+
if (alreadyCommented) {
132+
console.log(`Skipping PR #${prNumber} - already commented for ${releaseTag}`);
133+
continue;
134+
}
135+
136+
await github.rest.issues.createComment({
137+
owner: context.repo.owner,
138+
repo: context.repo.repo,
139+
issue_number: prNumber,
140+
body: comment
141+
});
142+
commentedCount++;
143+
console.log(`Successfully commented on PR #${prNumber}`);
144+
} catch (error) {
145+
console.error(`Failed to comment on PR #${prNumber}:`, error.message);
146+
}
147+
}
148+
149+
console.log(`Commented on ${commentedCount} of ${prNumbers.length} PRs`);

.github/workflows/main-checks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- main
77
- "v*.*.*"
8+
- "v1.x"
89
tags:
910
- "v*.*.*"
1011

CONTRIBUTING.md

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@
22

33
Thank you for your interest in contributing to the MCP Python SDK! This document provides guidelines and instructions for contributing.
44

5+
## Before You Start
6+
7+
We welcome contributions! These guidelines exist to save everyone time, yours included. Following them means your work is more likely to be accepted.
8+
9+
**All pull requests require a corresponding issue.** Unless your change is trivial (typo, docs tweak, broken link), create an issue first. Every merged feature becomes ongoing maintenance, so we need to agree something is worth doing before reviewing code. PRs without a linked issue will be closed.
10+
11+
Having an issue doesn't guarantee acceptance. Wait for maintainer feedback or a `ready for work` label before starting. PRs for issues without buy-in may also be closed.
12+
13+
Use issues to validate your idea before investing time in code. PRs are for execution, not exploration.
14+
15+
### The SDK is Opinionated
16+
17+
Not every contribution will be accepted, even with a working implementation. We prioritize maintainability and consistency over adding capabilities. This is at maintainers' discretion.
18+
19+
### What Needs Discussion
20+
21+
These always require an issue first:
22+
23+
- New public APIs or decorators
24+
- Architectural changes or refactoring
25+
- Changes that touch multiple modules
26+
- Features that might require spec changes (these need a [SEP](https://github.com/modelcontextprotocol/modelcontextprotocol) first)
27+
28+
Bug fixes for clear, reproducible issues are welcome—but still create an issue to track the fix.
29+
30+
### Finding Issues to Work On
31+
32+
| Label | For | Description |
33+
|-------|-----|-------------|
34+
| [`good first issue`](https://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) | Newcomers | Can tackle without deep codebase knowledge |
35+
| [`help wanted`](https://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) | Experienced contributors | Maintainers probably won't get to this |
36+
| [`ready for work`](https://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aopen+is%3Aissue+label%3A%22ready+for+work%22) | Maintainers | Triaged and ready for a maintainer to pick up |
37+
38+
Issues labeled `needs confirmation` or `needs maintainer action` are **not** ready for work—wait for maintainer input first.
39+
40+
Before starting, comment on the issue so we can assign it to you. This prevents duplicate effort.
41+
542
## Development Setup
643

744
1. Make sure you have Python 3.10+ installed
@@ -23,9 +60,14 @@ uv tool install pre-commit --with pre-commit-uv --force-reinstall
2360
## Development Workflow
2461

2562
1. Choose the correct branch for your changes:
26-
- For bug fixes to a released version: use the latest release branch (e.g. v1.1.x for 1.1.3)
27-
- For new features: use the main branch (which will become the next minor/major version)
28-
- If unsure, ask in an issue first
63+
64+
| Change Type | Target Branch | Example |
65+
|-------------|---------------|---------|
66+
| New features, breaking changes | `main` | New APIs, refactors |
67+
| Security fixes for v1 | `v1.x` | Critical patches |
68+
| Bug fixes for v1 | `v1.x` | Non-breaking fixes |
69+
70+
> **Note:** `main` is the v2 development branch. Breaking changes are welcome on `main`. The `v1.x` branch receives only security and critical bug fixes.
2971
3072
2. Create a new branch from your chosen base branch
3173

@@ -71,13 +113,29 @@ pre-commit run --all-files
71113
- Add type hints to all functions
72114
- Include docstrings for public APIs
73115

74-
## Pull Request Process
116+
## Pull Requests
117+
118+
By the time you open a PR, the "what" and "why" should already be settled in an issue. This keeps reviews focused on implementation.
119+
120+
### Scope
121+
122+
Small PRs get reviewed fast. Large PRs sit in the queue.
123+
124+
A few dozen lines can be reviewed in minutes. Hundreds of lines across many files takes real effort and things slip through. If your change is big, break it into smaller PRs or get alignment from a maintainer first.
125+
126+
### What Gets Rejected
127+
128+
- **No prior discussion**: Features or significant changes without an approved issue
129+
- **Scope creep**: Changes that go beyond what was discussed
130+
- **Misalignment**: Even well-implemented features may be rejected if they don't fit the SDK's direction
131+
- **Overengineering**: Unnecessary complexity for simple problems
132+
133+
### Checklist
75134

76135
1. Update documentation as needed
77136
2. Add tests for new functionality
78137
3. Ensure CI passes
79-
4. Maintainers will review your code
80-
5. Address review feedback
138+
4. Address review feedback
81139

82140
## Code of Conduct
83141

0 commit comments

Comments
 (0)