Skip to content

Commit dfa31e2

Browse files
committed
Merge upstream/main and resolve conflicts
2 parents 5e5caa3 + 384311b commit dfa31e2

File tree

202 files changed

+73417
-42689
lines changed

Some content is hidden

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

202 files changed

+73417
-42689
lines changed

.github/workflows/main.yml

Lines changed: 84 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,89 @@
11
on:
2-
push:
3-
branches:
4-
- main
5-
pull_request:
6-
release:
7-
types: [published]
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
workflow_dispatch:
7+
release:
8+
types: [published]
89

910
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
1213

1314
jobs:
14-
build:
15-
runs-on: ubuntu-latest
16-
17-
steps:
18-
- uses: actions/checkout@v4
19-
- uses: actions/setup-node@v4
20-
with:
21-
node-version: 18
22-
cache: npm
23-
24-
- run: npm ci
25-
- run: npm run build
26-
- run: npm test
27-
- run: npm run lint
28-
29-
publish:
30-
runs-on: ubuntu-latest
31-
if: github.event_name == 'release'
32-
environment: release
33-
needs: build
34-
35-
permissions:
36-
contents: read
37-
id-token: write
38-
39-
steps:
40-
- uses: actions/checkout@v4
41-
- uses: actions/setup-node@v4
42-
with:
43-
node-version: 18
44-
cache: npm
45-
registry-url: 'https://registry.npmjs.org'
46-
47-
- run: npm ci
48-
49-
- run: npm publish --provenance --access public
50-
env:
51-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 24
23+
cache: npm
24+
25+
- run: npm ci
26+
- run: npm run check
27+
- run: npm run build
28+
29+
test:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
node-version: [18, 24]
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
cache: npm
42+
43+
- run: npm ci
44+
- run: npm test
45+
46+
publish:
47+
runs-on: ubuntu-latest
48+
if: github.event_name == 'release'
49+
environment: release
50+
needs: [build, test]
51+
52+
permissions:
53+
contents: read
54+
id-token: write
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/setup-node@v4
59+
with:
60+
node-version: 24
61+
cache: npm
62+
registry-url: 'https://registry.npmjs.org'
63+
64+
- run: npm ci
65+
66+
- name: Determine npm tag
67+
id: npm-tag
68+
run: |
69+
VERSION=$(node -p "require('./package.json').version")
70+
# Check if this is a beta release
71+
if [[ "$VERSION" == *"-beta"* ]]; then
72+
echo "tag=--tag beta" >> $GITHUB_OUTPUT
73+
# Check if this release is from a non-main branch (patch/maintenance release)
74+
elif [[ "${{ github.event.release.target_commitish }}" != "main" ]]; then
75+
# Use "release-X.Y" as tag for old branch releases (e.g., "release-1.23" for 1.23.x)
76+
# npm tags are mutable pointers to versions (like "latest" pointing to 1.24.3).
77+
# Using "release-1.23" means users can `npm install @modelcontextprotocol/sdk@release-1.23`
78+
# to get the latest patch on that minor version, and the tag updates if we
79+
# release 1.23.2, 1.23.3, etc.
80+
# Note: Can't use "v1.23" because npm rejects tags that look like semver ranges.
81+
MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
82+
echo "tag=--tag release-${MAJOR_MINOR}" >> $GITHUB_OUTPUT
83+
else
84+
echo "tag=" >> $GITHUB_OUTPUT
85+
fi
86+
87+
- run: npm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }}
88+
env:
89+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Any Commit
2+
permissions:
3+
contents: read
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- '**'
9+
tags:
10+
- '!**'
11+
12+
jobs:
13+
pkg-publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 24
21+
cache: npm
22+
23+
- run: npm ci
24+
- name: Build
25+
run: npm run build
26+
- name: Publish
27+
run: npx pkg-pr-new publish
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Update Spec Types
2+
3+
on:
4+
schedule:
5+
# Run nightly at 4 AM UTC
6+
- cron: '0 4 * * *'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
update-spec-types:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '24'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Fetch latest spec types
29+
run: npm run fetch:spec-types
30+
31+
- name: Check for changes
32+
id: check_changes
33+
run: |
34+
if git diff --quiet src/spec.types.ts; then
35+
echo "has_changes=false" >> $GITHUB_OUTPUT
36+
else
37+
echo "has_changes=true" >> $GITHUB_OUTPUT
38+
LATEST_SHA=$(grep "Last updated from commit:" src/spec.types.ts | cut -d: -f2 | tr -d ' ')
39+
echo "sha=$LATEST_SHA" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Create Pull Request
43+
if: steps.check_changes.outputs.has_changes == 'true'
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
50+
git checkout -B update-spec-types
51+
git add src/spec.types.ts
52+
git commit -m "chore: update spec.types.ts from upstream"
53+
git push -f origin update-spec-types
54+
55+
# Create PR if it doesn't exist, or update if it does
56+
PR_BODY="This PR updates \`src/spec.types.ts\` from the Model Context Protocol specification.
57+
58+
Source file: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/${{ steps.check_changes.outputs.sha }}/schema/draft/schema.ts
59+
60+
This is an automated update triggered by the nightly cron job."
61+
62+
if gh pr view update-spec-types &>/dev/null; then
63+
echo "PR already exists, updating description..."
64+
gh pr edit update-spec-types --body "$PR_BODY"
65+
else
66+
gh pr create \
67+
--title "chore: update spec.types.ts from upstream" \
68+
--body "$PR_BODY" \
69+
--base main \
70+
--head update-spec-types
71+
fi

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ web_modules/
6969
# Output of 'npm pack'
7070
*.tgz
7171

72-
# Output of 'npm run fetch:spec-types'
73-
spec.types.ts
74-
7572
# Yarn Integrity file
7673
.yarn-integrity
7774

@@ -133,3 +130,6 @@ out
133130

134131
.DS_Store
135132
dist/
133+
134+
# IDE
135+
.idea/

.prettierignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Ignore artifacts:
2+
build
3+
dist
4+
coverage
5+
*-lock.*
6+
node_modules
7+
**/build
8+
**/dist
9+
.github/CODEOWNERS
10+
pnpm-lock.yaml
11+
12+
# Ignore generated files
13+
src/spec.types.ts

.prettierrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"printWidth": 140,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": true,
9+
"bracketSameLine": false,
10+
"proseWrap": "always",
11+
"arrowParens": "avoid",
12+
"overrides": [
13+
{
14+
"files": "**/*.md",
15+
"options": {
16+
"printWidth": 280
17+
}
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)