Skip to content

Commit 82e5473

Browse files
committed
Merge remote kotlin-sdk (resolve CI conflict)
2 parents fb35baf + 185b468 commit 82e5473

File tree

3,119 files changed

+48699
-2907
lines changed

Some content is hidden

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

3,119 files changed

+48699
-2907
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
# Force LF line endings for all text files (for consistent prettier formatting)
2+
* text=auto eol=lf
3+
14
package-lock.json linguist-generated=true
5+
src/generated/** linguist-generated=true

.github/workflows/ci.yml

Lines changed: 87 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,43 @@ permissions:
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
name: Linux x64
20+
- os: ubuntu-24.04-arm
21+
name: Linux ARM64
22+
- os: windows-latest
23+
name: Windows x64
24+
- os: windows-11-arm
25+
name: Windows ARM64
26+
- os: macos-latest
27+
name: macOS ARM64
28+
29+
name: Build (${{ matrix.name }})
30+
runs-on: ${{ matrix.os }}
31+
1532
steps:
1633
- uses: actions/checkout@v4
1734

1835
- name: Verify no private URLs in package-lock.json
36+
shell: bash
1937
run: '! grep -E "\"resolved\": \"https?://" package-lock.json | grep -v registry.npmjs.org'
2038

21-
- uses: oven-sh/setup-bun@v2
22-
with:
23-
bun-version: latest
24-
2539
- uses: actions/setup-node@v4
2640
with:
2741
node-version: "20"
2842

2943
- run: npm install
3044

31-
- run: npm run build:all
45+
- run: npm run build
46+
47+
- run: npm run examples:build
3248

3349
- name: Verify generated schemas are up-to-date
50+
shell: bash
3451
run: |
3552
npm run generate:schemas
3653
git diff --exit-code src/generated/ || (echo "Generated schemas are out of date. Run 'npm run generate:schemas' and commit." && exit 1)
@@ -101,3 +118,67 @@ jobs:
101118
name: test-results
102119
path: test-results/
103120
retention-days: 7
121+
122+
# Test build in Windows WSL (Ubuntu)
123+
build-wsl:
124+
name: Build (Windows WSL)
125+
runs-on: windows-latest
126+
127+
steps:
128+
- uses: actions/checkout@v4
129+
130+
- uses: Vampire/setup-wsl@v5
131+
with:
132+
distribution: Ubuntu-24.04
133+
134+
- name: Install Node.js in WSL
135+
shell: wsl-bash {0}
136+
run: |
137+
sudo apt-get update
138+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
139+
sudo apt-get install -y nodejs
140+
141+
- name: Build and test in WSL
142+
shell: wsl-bash {0}
143+
run: |
144+
npm install
145+
npm run build
146+
npm run examples:build
147+
npm test
148+
npm run prettier
149+
150+
# Test that the package can be installed from git (triggers prepare script)
151+
test-git-install:
152+
strategy:
153+
fail-fast: false
154+
matrix:
155+
include:
156+
- os: ubuntu-latest
157+
name: Linux x64
158+
- os: ubuntu-24.04-arm
159+
name: Linux ARM64
160+
- os: windows-latest
161+
name: Windows x64
162+
- os: windows-11-arm
163+
name: Windows ARM64
164+
- os: macos-latest
165+
name: macOS ARM64
166+
167+
name: Test git install (${{ matrix.name }})
168+
runs-on: ${{ matrix.os }}
169+
170+
steps:
171+
- uses: actions/setup-node@v4
172+
with:
173+
node-version: "20"
174+
175+
- name: Create test project and install from git
176+
shell: bash
177+
run: |
178+
mkdir test-project
179+
cd test-project
180+
npm init -y
181+
# Install from the PR branch
182+
npm install "git+https://github.com/${{ github.repository }}#${{ github.head_ref || github.ref_name }}"
183+
# Verify the package is usable (ESM import)
184+
node --input-type=module -e "import { App } from '@modelcontextprotocol/ext-apps'; console.log('Import successful:', typeof App)"

.husky/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Verify no private registry URLs in package-lock.json
2+
if grep -E '"resolved": "https?://' package-lock.json | grep -v registry.npmjs.org > /dev/null; then
3+
echo "ERROR: package-lock.json contains non-npmjs.org URLs"
4+
echo "Run: docker run --rm -i -v \$PWD:/src -w /src node:latest npm i --registry=https://registry.npmjs.org/"
5+
exit 1
6+
fi
7+
18
npm run build:all
29
npm run prettier:fix
310

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ Start with these foundational examples to learn the SDK:
4949

5050
- [`examples/basic-server-vanillajs`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vanillajs) — Example MCP server with tools that return UI Apps (vanilla JS)
5151
- [`examples/basic-server-react`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) — Example MCP server with tools that return UI Apps (React)
52-
- [`examples/basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) — Bare-bones example of hosting MCP Apps
52+
- [`examples/basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) — Bare-bones example of hosting MCP Apps (TypeScript/React)
53+
- [`examples/basic-host-kotlin`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host-kotlin) — Android example of hosting MCP Apps (Kotlin/Jetpack Compose)
5354

5455
The [`examples/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples) directory contains additional demo apps showcasing real-world use cases.
5556

5657
To run all examples together:
5758

58-
```
59+
```bash
5960
npm install
6061
npm run examples:start
6162
```

examples/basic-host-kotlin/README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,39 @@ examples/basic-host-kotlin/
5858
- **Android SDK**: API 26+ (Android 8.0+)
5959
- **MCP Server**: A running MCP server with UI resources
6060

61+
<details>
62+
<summary>Installing Android SDK and emulator on Mac</summary>
63+
64+
```bash
65+
brew install --cask android-commandlinetools
66+
67+
# Accept licenses
68+
yes | sdkmanager --licenses
69+
70+
# Install required components
71+
sdkmanager "platform-tools" "emulator" "platforms;android-34" "system-images;android-34;google_apis;arm64-v8a"
72+
73+
# Create an AVD (Android Virtual Device)
74+
avdmanager create avd -n Pixel_8 -k "system-images;android-34;google_apis;arm64-v8a" -d pixel_8
75+
76+
# Add to PATH (add to ~/.zshrc)
77+
export ANDROID_HOME=/opt/homebrew/share/android-commandlinetools
78+
export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$PATH
79+
80+
# Start emulator
81+
emulator -avd Pixel_8
82+
```
83+
84+
</details>
85+
6186
## Setup Instructions
6287

6388
### 1. Open Project
6489

6590
Open Android Studio and select "Open an Existing Project". Navigate to this directory:
6691

6792
```
68-
/path/to/ext-apps2/examples/basic-host-kotlin
93+
/path/to/ext-apps/examples/basic-host-kotlin
6994
```
7095

7196
### 2. Sync Gradle
@@ -89,7 +114,7 @@ You need a running MCP server with UI resources. For testing, you can use the QR
89114

90115
```bash
91116
# In a terminal, navigate to the examples directory
92-
cd /path/to/ext-apps2/examples/qr-code
117+
cd /path/to/ext-apps/examples/qr-code
93118

94119
# Install dependencies
95120
npm install

examples/basic-host-kotlin/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ dependencies {
8787

8888
// Testing
8989
testImplementation("junit:junit:4.13.2")
90+
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
9091
androidTestImplementation("androidx.test.ext:junit:1.1.5")
9192
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
9293
androidTestImplementation(platform("androidx.compose:compose-bom:2024.02.00"))

0 commit comments

Comments
 (0)