Skip to content

Commit 6c47890

Browse files
committed
Merge branch 'main' into feature/call-futures
2 parents 79f3c4e + 959d4e3 commit 6c47890

Some content is hidden

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

69 files changed

+3934
-788
lines changed

.github/CODEOWNERS

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# CODEOWNERS for MCP Python SDK
2+
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
3+
4+
# Default maintainers for everything
5+
* @modelcontextprotocol/python-sdk
6+
7+
# Auth-related code requires additional review from auth team
8+
/src/mcp/client/auth.py @modelcontextprotocol/python-sdk-auth
9+
/src/mcp/server/auth/ @modelcontextprotocol/python-sdk-auth
10+
/src/mcp/server/transport_security.py @modelcontextprotocol/python-sdk-auth
11+
/src/mcp/shared/auth*.py @modelcontextprotocol/python-sdk-auth
12+
13+
# Auth-related tests
14+
/tests/client/test_auth.py @modelcontextprotocol/python-sdk-auth
15+
/tests/server/auth/ @modelcontextprotocol/python-sdk-auth
16+
/tests/server/test_*security.py @modelcontextprotocol/python-sdk-auth
17+
/tests/server/fastmcp/auth/ @modelcontextprotocol/python-sdk-auth
18+
/tests/shared/test_auth*.py @modelcontextprotocol/python-sdk-auth
19+
20+
# Auth-related examples
21+
/examples/clients/simple-auth-client/ @modelcontextprotocol/python-sdk-auth
22+
/examples/snippets/clients/oauth_client.py @modelcontextprotocol/python-sdk-auth
23+
/examples/snippets/servers/oauth_server.py @modelcontextprotocol/python-sdk-auth

.github/ISSUE_TEMPLATE/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
blank_issues_enabled: true
1+
blank_issues_enabled: false

.pre-commit-config.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ repos:
77
- id: prettier
88
types_or: [yaml, json5]
99

10+
- repo: https://github.com/igorshubovych/markdownlint-cli
11+
rev: v0.45.0
12+
hooks:
13+
- id: markdownlint
14+
args:
15+
[
16+
"--fix",
17+
"--config",
18+
"pyproject.toml",
19+
"--configPointer",
20+
"/tool/markdown/lint",
21+
]
22+
types: [markdown]
23+
1024
- repo: local
1125
hooks:
1226
- id: ruff-format
@@ -27,7 +41,6 @@ repos:
2741
- id: pyright
2842
name: pyright
2943
entry: uv run pyright
30-
args: [src]
3144
language: system
3245
types: [python]
3346
pass_filenames: false

CLAUDE.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This document contains critical information about working with this codebase. Fo
1616
- Public APIs must have docstrings
1717
- Functions must be focused and small
1818
- Follow existing patterns exactly
19-
- Line length: 88 chars maximum
19+
- Line length: 120 chars maximum
2020

2121
3. Testing Requirements
2222
- Framework: `uv run --frozen pytest`
@@ -26,15 +26,19 @@ This document contains critical information about working with this codebase. Fo
2626
- Bug fixes require regression tests
2727

2828
- For commits fixing bugs or adding features based on user reports add:
29+
2930
```bash
3031
git commit --trailer "Reported-by:<name>"
3132
```
33+
3234
Where `<name>` is the name of the user.
3335

3436
- For commits related to a Github issue, add
37+
3538
```bash
3639
git commit --trailer "Github-Issue:#<number>"
3740
```
41+
3842
- NEVER ever mention a `co-authored-by` or similar aspects. In particular, never
3943
mention the tool used to create the commit message or PR.
4044

@@ -116,3 +120,15 @@ This document contains critical information about working with this codebase. Fo
116120
- Follow existing patterns
117121
- Document public APIs
118122
- Test thoroughly
123+
124+
## Exception Handling
125+
126+
- **Always use `logger.exception()` instead of `logger.error()` when catching exceptions**
127+
- Don't include the exception in the message: `logger.exception("Failed")` not `logger.exception(f"Failed: {e}")`
128+
- **Catch specific exceptions** where possible:
129+
- File ops: `except (OSError, PermissionError):`
130+
- JSON: `except json.JSONDecodeError:`
131+
- Network: `except (ConnectionError, TimeoutError):`
132+
- **Only catch `Exception` for**:
133+
- Top-level handlers that must not crash
134+
- Cleanup blocks (log at debug level)

CODE_OF_CONDUCT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
63+
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the
@@ -116,13 +116,13 @@ the community.
116116

117117
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118118
version 2.0, available at
119-
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119+
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
120120

121121
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122122
enforcement ladder](https://github.com/mozilla/diversity).
123123

124124
[homepage]: https://www.contributor-covenant.org
125125

126126
For answers to common questions about this code of conduct, see the FAQ at
127-
https://www.contributor-covenant.org/faq. Translations are available at
128-
https://www.contributor-covenant.org/translations.
127+
<https://www.contributor-covenant.org/faq>. Translations are available at
128+
<https://www.contributor-covenant.org/translations>.

CONTRIBUTING.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ Thank you for your interest in contributing to the MCP Python SDK! This document
99
3. Fork the repository
1010
4. Clone your fork: `git clone https://github.com/YOUR-USERNAME/python-sdk.git`
1111
5. Install dependencies:
12+
1213
```bash
1314
uv sync --frozen --all-extras --dev
1415
```
1516

17+
6. Set up pre-commit hooks:
18+
19+
```bash
20+
uv tool install pre-commit --with pre-commit-uv --force-reinstall
21+
```
22+
1623
## Development Workflow
1724

1825
1. Choose the correct branch for your changes:
@@ -25,27 +32,37 @@ uv sync --frozen --all-extras --dev
2532
3. Make your changes
2633

2734
4. Ensure tests pass:
28-
```bash
35+
36+
```bash
2937
uv run pytest
3038
```
3139

3240
5. Run type checking:
41+
3342
```bash
3443
uv run pyright
3544
```
3645

3746
6. Run linting:
47+
3848
```bash
3949
uv run ruff check .
4050
uv run ruff format .
4151
```
4252

4353
7. Update README snippets if you modified example code:
54+
4455
```bash
4556
uv run scripts/update_readme_snippets.py
4657
```
4758

48-
8. Submit a pull request to the same branch you branched from
59+
8. (Optional) Run pre-commit hooks on all files:
60+
61+
```bash
62+
pre-commit run --all-files
63+
```
64+
65+
9. Submit a pull request to the same branch you branched from
4966

5067
## Code Style
5168

0 commit comments

Comments
 (0)