Skip to content

Commit afed92c

Browse files
authored
Merge branch 'modelcontextprotocol:main' into main
2 parents e93aa1c + 2ea1495 commit afed92c

49 files changed

Lines changed: 1720 additions & 347 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish Docs manually
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
docs-publish:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Configure Git Credentials
14+
run: |
15+
git config user.name github-actions[bot]
16+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v3
20+
with:
21+
enable-cache: true
22+
23+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
24+
- uses: actions/cache@v4
25+
with:
26+
key: mkdocs-material-${{ env.cache_id }}
27+
path: .cache
28+
restore-keys: |
29+
mkdocs-material-
30+
31+
- run: uv sync --frozen --group docs
32+
- run: uv run --no-sync mkdocs gh-deploy --force

.github/workflows/publish-pypi.yml

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,24 @@ jobs:
1010
runs-on: ubuntu-latest
1111
needs: [checks]
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v4
1414

15-
- name: Install uv
16-
uses: astral-sh/setup-uv@v3
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v3
17+
with:
18+
enable-cache: true
1719

18-
- name: "Set up Python"
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version-file: ".python-version"
20+
- name: Set up Python 3.12
21+
run: uv python install 3.12
2222

23-
- name: Install the project
24-
run: uv sync --frozen --all-extras --dev
23+
- name: Build
24+
run: uv build
2525

26-
- name: Build
27-
run: uv build
28-
29-
- name: Upload artifacts
30-
uses: actions/upload-artifact@v4
31-
with:
32-
name: release-dists
33-
path: dist/
26+
- name: Upload artifacts
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: release-dists
30+
path: dist/
3431

3532
checks:
3633
uses: ./.github/workflows/shared.yml
@@ -42,14 +39,42 @@ jobs:
4239
needs:
4340
- release-build
4441
permissions:
45-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
42+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
4643

4744
steps:
48-
- name: Retrieve release distributions
49-
uses: actions/download-artifact@v4
50-
with:
51-
name: release-dists
52-
path: dist/
53-
54-
- name: Publish package distributions to PyPI
55-
uses: pypa/gh-action-pypi-publish@release/v1
45+
- name: Retrieve release distributions
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: release-dists
49+
path: dist/
50+
51+
- name: Publish package distributions to PyPI
52+
uses: pypa/gh-action-pypi-publish@release/v1
53+
54+
docs-publish:
55+
runs-on: ubuntu-latest
56+
needs: ["pypi-publish"]
57+
permissions:
58+
contents: write
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Configure Git Credentials
62+
run: |
63+
git config user.name github-actions[bot]
64+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
65+
66+
- name: Install uv
67+
uses: astral-sh/setup-uv@v3
68+
with:
69+
enable-cache: true
70+
71+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
72+
- uses: actions/cache@v4
73+
with:
74+
key: mkdocs-material-${{ env.cache_id }}
75+
path: .cache
76+
restore-keys: |
77+
mkdocs-material-
78+
79+
- run: uv sync --frozen --group docs
80+
- run: uv run --no-sync mkdocs gh-deploy --force

.github/workflows/shared.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,11 @@ jobs:
1414
with:
1515
enable-cache: true
1616

17-
- name: "Set up Python"
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version-file: ".python-version"
21-
2217
- name: Install the project
23-
run: uv sync --frozen --all-extras --dev
18+
run: uv sync --frozen --all-extras --dev --python 3.12
2419

2520
- name: Run ruff format check
26-
run: uv run --frozen ruff check .
21+
run: uv run --no-sync ruff check .
2722

2823
typecheck:
2924
runs-on: ubuntu-latest
@@ -35,19 +30,17 @@ jobs:
3530
with:
3631
enable-cache: true
3732

38-
- name: "Set up Python"
39-
uses: actions/setup-python@v5
40-
with:
41-
python-version-file: ".python-version"
42-
4333
- name: Install the project
44-
run: uv sync --frozen --all-extras --dev
34+
run: uv sync --frozen --all-extras --dev --python 3.12
4535

4636
- name: Run pyright
47-
run: uv run --frozen pyright
37+
run: uv run --no-sync pyright
4838

49-
build:
39+
test:
5040
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
python-version: ["3.10", "3.11", "3.12", "3.13"]
5144

5245
steps:
5346
- uses: actions/checkout@v4
@@ -57,13 +50,8 @@ jobs:
5750
with:
5851
enable-cache: true
5952

60-
- name: "Set up Python"
61-
uses: actions/setup-python@v5
62-
with:
63-
python-version-file: ".python-version"
64-
6553
- name: Install the project
66-
run: uv sync --frozen --all-extras --dev
54+
run: uv sync --frozen --all-extras --dev --python ${{ matrix.python-version }}
6755

6856
- name: Run pytest
69-
run: uv run --frozen pytest
57+
run: uv run --no-sync pytest

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,5 @@ cython_debug/
165165
#.idea/
166166

167167
# vscode
168-
.vscode/
168+
.vscode/
169+
**/CLAUDE.local.md

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,36 @@
1616
<!-- omit in toc -->
1717
## Table of Contents
1818

19-
- [Overview](#overview)
20-
- [Installation](#installation)
21-
- [Quickstart](#quickstart)
22-
- [What is MCP?](#what-is-mcp)
23-
- [Core Concepts](#core-concepts)
24-
- [Server](#server)
25-
- [Resources](#resources)
26-
- [Tools](#tools)
27-
- [Prompts](#prompts)
28-
- [Images](#images)
29-
- [Context](#context)
30-
- [Running Your Server](#running-your-server)
31-
- [Development Mode](#development-mode)
32-
- [Claude Desktop Integration](#claude-desktop-integration)
33-
- [Direct Execution](#direct-execution)
34-
- [Mounting to an Existing ASGI Server](#mounting-to-an-existing-asgi-server)
35-
- [Examples](#examples)
36-
- [Echo Server](#echo-server)
37-
- [SQLite Explorer](#sqlite-explorer)
38-
- [Advanced Usage](#advanced-usage)
39-
- [Low-Level Server](#low-level-server)
40-
- [Writing MCP Clients](#writing-mcp-clients)
41-
- [MCP Primitives](#mcp-primitives)
42-
- [Server Capabilities](#server-capabilities)
43-
- [Documentation](#documentation)
44-
- [Contributing](#contributing)
45-
- [License](#license)
19+
- [MCP Python SDK](#mcp-python-sdk)
20+
- [Overview](#overview)
21+
- [Installation](#installation)
22+
- [Adding MCP to your python project](#adding-mcp-to-your-python-project)
23+
- [Running the standalone MCP development tools](#running-the-standalone-mcp-development-tools)
24+
- [Quickstart](#quickstart)
25+
- [What is MCP?](#what-is-mcp)
26+
- [Core Concepts](#core-concepts)
27+
- [Server](#server)
28+
- [Resources](#resources)
29+
- [Tools](#tools)
30+
- [Prompts](#prompts)
31+
- [Images](#images)
32+
- [Context](#context)
33+
- [Running Your Server](#running-your-server)
34+
- [Development Mode](#development-mode)
35+
- [Claude Desktop Integration](#claude-desktop-integration)
36+
- [Direct Execution](#direct-execution)
37+
- [Mounting to an Existing ASGI Server](#mounting-to-an-existing-asgi-server)
38+
- [Examples](#examples)
39+
- [Echo Server](#echo-server)
40+
- [SQLite Explorer](#sqlite-explorer)
41+
- [Advanced Usage](#advanced-usage)
42+
- [Low-Level Server](#low-level-server)
43+
- [Writing MCP Clients](#writing-mcp-clients)
44+
- [MCP Primitives](#mcp-primitives)
45+
- [Server Capabilities](#server-capabilities)
46+
- [Documentation](#documentation)
47+
- [Contributing](#contributing)
48+
- [License](#license)
4649

4750
[pypi-badge]: https://img.shields.io/pypi/v/mcp.svg
4851
[pypi-url]: https://pypi.org/project/mcp/
@@ -143,8 +146,8 @@ The FastMCP server is your core interface to the MCP protocol. It handles connec
143146
```python
144147
# Add lifespan support for startup/shutdown with strong typing
145148
from contextlib import asynccontextmanager
149+
from collections.abc import AsyncIterator
146150
from dataclasses import dataclass
147-
from typing import AsyncIterator
148151

149152
from fake_database import Database # Replace with your actual DB type
150153

@@ -354,7 +357,7 @@ You can mount the SSE server to an existing ASGI server using the `sse_app` meth
354357

355358
```python
356359
from starlette.applications import Starlette
357-
from starlette.routes import Mount, Host
360+
from starlette.routing import Mount, Host
358361
from mcp.server.fastmcp import FastMCP
359362

360363

@@ -442,7 +445,7 @@ For more control, you can use the low-level server implementation directly. This
442445

443446
```python
444447
from contextlib import asynccontextmanager
445-
from typing import AsyncIterator
448+
from collections.abc import AsyncIterator
446449

447450
from fake_database import Database # Replace with your actual DB type
448451

docs/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: mcp

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# MCP Server
2+
3+
This is the MCP Server implementation in Python.
4+
5+
It only contains the [API Reference](api.md) for the time being.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
GROQ_API_KEY=gsk_1234567890
1+
LLM_API_KEY=gsk_1234567890

0 commit comments

Comments
 (0)