diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..74b01ba --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,30 @@ +FROM debian:bookworm-slim + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + curl \ + wget \ + pkg-config \ + libssl-dev \ + ca-certificates \ + git \ + sudo \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Create non-root user — use --force to avoid failure if GID already exists +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +RUN groupadd --force --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash || true \ + && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +# Ensure feature-installed tools are on PATH for non-root user +ENV PATH="/usr/local/cargo/bin:/usr/local/share/nvm/current/bin:${PATH}" +ENV CARGO_HOME="/usr/local/cargo" +ENV RUSTUP_HOME="/usr/local/rustup" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..f42b4c6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "devpod-mcp", + "build": { + "dockerfile": "Dockerfile" + }, + "remoteUser": "vscode", + "features": { + "ghcr.io/devcontainers/features/rust:1": { + "profile": "default" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "moby": true, + "dockerDashComposeVersion": "v2" + } + }, + "postCreateCommand": ". /usr/local/cargo/env && cargo fetch", + "customizations": { + "vscode": { + "extensions": [ + "rust-lang.rust-analyzer", + "ms-azuretools.vscode-containers" + ] + } + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..151d2eb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: Check & Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo check -p devpod-mcp-core -p devpod-mcp + - run: cargo test -p devpod-mcp-core -p devpod-mcp + - run: cargo clippy -p devpod-mcp-core -p devpod-mcp -- -D warnings + - run: cargo fmt --all -- --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..617c7a2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Release + +on: + release: + types: [created] + +env: + CARGO_TERM_COLOR: always + +permissions: + contents: write + +jobs: + build: + name: Build ${{ matrix.artifact }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + artifact: devpod-mcp-linux-x64 + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + artifact: devpod-mcp-linux-arm64 + cross: true + - target: x86_64-apple-darwin + os: macos-latest + artifact: devpod-mcp-darwin-x64 + - target: aarch64-apple-darwin + os: macos-latest + artifact: devpod-mcp-darwin-arm64 + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + + - name: Install cross-compilation deps + if: matrix.cross + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml + echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml + + - name: Build + run: cargo build --release --target ${{ matrix.target }} -p devpod-mcp + + - name: Package binary + run: | + cp target/${{ matrix.target }}/release/devpod-mcp ${{ matrix.artifact }} + chmod +x ${{ matrix.artifact }} + + - name: Upload release asset + uses: softprops/action-gh-release@v2 + with: + files: ${{ matrix.artifact }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..124f353 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Rust +/target +**/*.rs.bk +*.pdb + +# DevPod / DevContainer internals +.devcontainer/.devpod-internal/ +.devcontainer/devcontainer-lock.json + +# IDE +.idea/ +*.swp +*.swo +*~ + +# OS +.DS_Store +Thumbs.db \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..74a5238 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,31 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build", + "type": "cargo", + "command": "build", + "args": [ + "--release", + "-p", + "devpod-mcp" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": ["$rustc"] + }, + { + "label": "Build All Platforms", + "type": "shell", + "command": "bash", + "args": [ + "-c", + "set -e && targets=(x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu x86_64-apple-darwin aarch64-apple-darwin) && for t in \"${targets[@]}\"; do echo \"\\n==> Building $t\" && rustup target add \"$t\" 2>/dev/null && cargo build --release --target \"$t\" -p devpod-mcp && echo \" ✓ target/$t/release/devpod-mcp\"; done" + ], + "group": "build", + "problemMatcher": ["$rustc"] + } + ] +} diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f478ce2 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1679 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "bollard" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ccca1260af6a459d75994ad5acc1651bcabcbdbc41467cc9786519ab854c30" +dependencies = [ + "base64 0.22.1", + "bollard-stubs", + "bytes", + "futures-core", + "futures-util", + "hex", + "http", + "http-body-util", + "hyper", + "hyper-named-pipe", + "hyper-util", + "hyperlocal", + "log", + "pin-project-lite", + "serde", + "serde_derive", + "serde_json", + "serde_repr", + "serde_urlencoded", + "thiserror", + "tokio", + "tokio-util", + "tower-service", + "url", + "winapi", +] + +[[package]] +name = "bollard-stubs" +version = "1.47.1-rc.27.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f179cfbddb6e77a5472703d4b30436bff32929c0aa8a9008ecf23d1d3cdd0da" +dependencies = [ + "serde", + "serde_repr", + "serde_with", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cc" +version = "1.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "devpod-mcp" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "devpod-mcp-core", + "rmcp", + "serde", + "serde_json", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "devpod-mcp-core" +version = "0.1.0" +dependencies = [ + "bollard", + "futures-util", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-named-pipe" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" +dependencies = [ + "hex", + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", + "winapi", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "hyperlocal" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7" +dependencies = [ + "hex", + "http-body-util", + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", + "serde", + "serde_core", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.185" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "num-conv" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "rmcp" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a0110d28bd076f39e14bfd5b0340216dd18effeb5d02b43215944cc3e5c751" +dependencies = [ + "base64 0.21.7", + "chrono", + "futures", + "paste", + "pin-project-lite", + "rmcp-macros", + "schemars 0.8.22", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "rmcp-macros" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e2b2fd7497540489fa2db285edd43b7ed14c49157157438664278da6e42a7a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5414fad8e6907dbdd5bc441a50ae8d6e26151a03b1de04d89a5576de61d01f" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.0", + "schemars 0.9.0", + "schemars 1.2.1", + "serde_core", + "serde_json", + "time", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.52.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..6e3d1f7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,23 @@ +[workspace] +resolver = "2" +members = [ + "crates/devpod-mcp-core", + "crates/devpod-mcp", +] + +[workspace.package] +edition = "2021" +license = "MIT" +repository = "https://github.com/aniongithub/devpod-mcp" + +[workspace.dependencies] +tokio = { version = "1", features = ["full"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +thiserror = "2" +anyhow = "1" +bollard = "0.18" +clap = { version = "4", features = ["derive"] } +rmcp = { version = "0.1", features = ["server", "transport-io"] } +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/README.md b/README.md index 8318434..238a0d8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,144 @@ -# devcontainer-mcp -An MCP + Tauri app that helps manage devcontainers so that AI agents can work in actual development environments instead of approximated host environments +# devpod-mcp + +An MCP server that wraps the [DevPod](https://devpod.sh/) CLI to give AI coding agents full control over isolated development environments — so work happens inside the right container, not on the host. + + +## Quick Install + +```bash +# Install MCP server + DevPod CLI (auto-detects OS/arch, installs DevPod if missing) +curl -fsSL https://raw.githubusercontent.com/aniongithub/devpod-mcp/main/install.sh | bash +``` + +Binaries are available for **linux-x64**, **linux-arm64**, **darwin-x64**, and **darwin-arm64**. + +## Why? + +AI coding agents suffer from **Host Contamination** and **Context Drift**. They install packages on the host, assume local dependencies exist, and produce code that works "on my machine" but fails in production. + +[DevPod](https://github.com/loft-sh/devpod) solves the hard container management problem — supporting Docker, Kubernetes, cloud VMs, compose, and more. **This project** bridges the gap by exposing every DevPod capability as MCP tools that AI agents can call directly. + +## Architecture + +```mermaid +graph TD + A[AI Agent / MCP Client] -->|stdio JSON-RPC| B[devpod-mcp binary] + + subgraph "devpod-mcp" + B --> C[15 MCP Tools] + C --> D[devpod-mcp-core lib] + end + + D -->|subprocess| E[DevPod CLI] + D -->|bollard API| F[Docker Engine] + + E --> G[DevPod Workspace Container] + F --> G +``` + +## MCP Tools + +### Workspace Lifecycle +| Tool | Description | +|------|-------------| +| `devpod_up` | Create and start a workspace from a git URL, local path, or image. Returns full build output for self-healing. | +| `devpod_stop` | Stop a running workspace | +| `devpod_delete` | Delete a workspace and its resources | +| `devpod_build` | Build a workspace image without starting it | +| `devpod_status` | Get workspace state (`Running`, `Stopped`, `Busy`, `NotFound`) as JSON | +| `devpod_list` | List all workspaces with IDs, sources, providers, and status | + +### Command Execution +| Tool | Description | +|------|-------------| +| `devpod_ssh` | Execute a command inside a workspace via SSH. Returns stdout, stderr, and exit code. | + +### Provider Management +| Tool | Description | +|------|-------------| +| `devpod_provider_list` | List all configured providers | +| `devpod_provider_add` | Add a new provider | +| `devpod_provider_delete` | Remove a provider | + +### Context Management +| Tool | Description | +|------|-------------| +| `devpod_context_list` | List all contexts | +| `devpod_context_use` | Switch to a different context | + +### Logs & Docker +| Tool | Description | +|------|-------------| +| `devpod_logs` | Get workspace logs (useful for diagnosing build failures) | +| `devpod_container_inspect` | Direct Docker inspect for labels, ports, mounts | +| `devpod_container_logs` | Stream container logs via Docker API (bollard) | + +## MCP Server Configuration + +### Claude Desktop + +```json +{ + "mcpServers": { + "devpod-mcp": { + "command": "devpod-mcp", + "args": ["serve"] + } + } +} +``` + +### Cursor + +Add to your MCP settings: +```json +{ + "devpod-mcp": { + "command": "devpod-mcp", + "args": ["serve"] + } +} +``` + +## Prerequisites + +- [DevPod](https://devpod.sh/docs/getting-started/install) CLI installed (or use `--with-devpod` in the install script) +- [Docker](https://docs.docker.com/get-docker/) (or another DevPod provider like Kubernetes) + +## Self-Healing Loop + +When `devpod_up` fails (bad Dockerfile, missing dependency, etc.), the full build output — including error messages — is returned to the AI agent. The agent can then: + +1. Read the error from `stderr` +2. Fix the `Dockerfile` or `devcontainer.json` +3. Call `devpod_up` again with `--recreate` +4. Repeat until the environment builds successfully + +This makes the dev environment a **dynamic, agent-managed asset** rather than a static prerequisite. + +## Development + +This project eats its own dogfood — development happens inside a DevPod workspace. + +```bash +# Create and start the dev workspace +devpod up . --id devpod-mcp --provider docker --open-ide=false + +# Build inside the workspace +devpod ssh devpod-mcp --command "cd /workspaces/devpod-mcp && cargo build --workspace" + +# Run tests +devpod ssh devpod-mcp --command "cd /workspaces/devpod-mcp && cargo test --workspace" + +# Build release binary +devpod ssh devpod-mcp --command "cd /workspaces/devpod-mcp && cargo build --release -p devpod-mcp" +``` + +### CI/CD + +- **Pull Requests** — `cargo check`, `cargo test`, `cargo clippy`, `cargo fmt` run automatically +- **Releases** — Creating a GitHub release builds binaries for all 4 platforms and uploads them as release assets + +## License + +[MIT](LICENSE) diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..e3a8cff --- /dev/null +++ b/SKILL.md @@ -0,0 +1,86 @@ +--- +name: devpod-mcp +description: Manage isolated DevPod development environments via MCP tools +tools: + - devpod_up + - devpod_stop + - devpod_delete + - devpod_build + - devpod_status + - devpod_list + - devpod_ssh + - devpod_logs + - devpod_provider_list + - devpod_provider_add + - devpod_provider_delete + - devpod_context_list + - devpod_context_use + - devpod_container_inspect + - devpod_container_logs +--- + +# DevPod MCP Skill + +You have access to `devpod-mcp`, an MCP server that manages isolated development environments via [DevPod](https://devpod.sh/). + +## Core Rule + +**If a project has `.devcontainer/devcontainer.json`, ALL work MUST happen inside a DevPod workspace — never install dependencies, run builds, or execute code directly on the host.** + +## Workflow + +### 1. Check for devcontainer config +Before doing any work on a project, check if `.devcontainer/devcontainer.json` exists. + +### 2. Create or start the workspace +``` +devpod_up(args: "/path/to/project --id my-project --provider docker") +``` +- Always use `--provider docker` unless the user specifies otherwise. +- The workspace ID should be a short, descriptive kebab-case name. + +### 3. Verify the workspace is running +``` +devpod_status(workspace: "my-project") +``` +Expect `"state": "Running"`. + +### 4. Execute all commands inside the workspace +``` +devpod_ssh(workspace: "my-project", command: "cargo build") +devpod_ssh(workspace: "my-project", command: "npm install && npm test") +``` +- Use `devpod_ssh` for ALL commands: builds, tests, linting, package installs, etc. +- Never run these on the host. + +### 5. Handle build failures (self-healing) +If `devpod_up` returns errors in stderr: +1. Read the error output carefully +2. Fix the `Dockerfile` or `devcontainer.json` in the project +3. Call `devpod_up` again — DevPod will rebuild with the fix +4. Repeat until successful + +If `devpod_ssh` commands fail, check `devpod_logs` for container-level issues. + +### 6. Stop when done +``` +devpod_stop(workspace: "my-project") +``` + +## What NOT to do + +- ❌ Do NOT install packages on the host (npm install, pip install, apt install, etc.) +- ❌ Do NOT run builds on the host +- ❌ Do NOT modify the host's global config (PATH, env vars, etc.) +- ❌ Do NOT assume host tools match what the project needs +- ✅ DO use `devpod_ssh` for everything +- ✅ DO check `.devcontainer/devcontainer.json` first +- ✅ DO return build errors to the user for devcontainer config issues + +## Inspecting containers + +Use `devpod_container_inspect` and `devpod_container_logs` when you need low-level Docker details (ports, labels, mounts, raw container logs) that `devpod_status` and `devpod_logs` don't cover. + +## Managing multiple workspaces + +Use `devpod_list` to see all workspaces. Each workspace is independent — you can run multiple projects simultaneously in separate containers. diff --git a/crates/devpod-mcp-core/Cargo.toml b/crates/devpod-mcp-core/Cargo.toml new file mode 100644 index 0000000..ac50007 --- /dev/null +++ b/crates/devpod-mcp-core/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "devpod-mcp-core" +version = "0.1.0" +description = "Core library for devpod-mcp: DevPod CLI wrapper and Docker queries" +edition.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +tokio = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +thiserror = { workspace = true } +bollard = { workspace = true } +tracing = { workspace = true } +futures-util = "0.3" diff --git a/crates/devpod-mcp-core/src/devpod.rs b/crates/devpod-mcp-core/src/devpod.rs new file mode 100644 index 0000000..24d55b6 --- /dev/null +++ b/crates/devpod-mcp-core/src/devpod.rs @@ -0,0 +1,205 @@ +use serde::{Deserialize, Serialize}; +use std::process::Stdio; +use tokio::process::Command; + +use crate::error::{Error, Result}; + +/// Raw output from a DevPod CLI invocation. +#[derive(Debug, Clone, Serialize)] +pub struct DevPodOutput { + pub exit_code: i32, + pub stdout: String, + pub stderr: String, + /// Parsed JSON from stdout, if the command was invoked with --output json. + pub json: Option, +} + +/// Run a devpod CLI command with the given args. +/// If `parse_json` is true, attempts to parse stdout as JSON. +async fn run_devpod(args: &[&str], parse_json: bool) -> Result { + let output = Command::new("devpod") + .args(args) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .await + .map_err(|e| { + if e.kind() == std::io::ErrorKind::NotFound { + Error::DevPodNotFound + } else { + Error::Io(e) + } + })?; + + let stdout = String::from_utf8_lossy(&output.stdout).to_string(); + let stderr = String::from_utf8_lossy(&output.stderr).to_string(); + let exit_code = output.status.code().unwrap_or(-1); + + let json = if parse_json { + serde_json::from_str(&stdout).ok() + } else { + None + }; + + Ok(DevPodOutput { + exit_code, + stdout, + stderr, + json, + }) +} + +/// Check that the `devpod` CLI is available on PATH. +pub async fn check_cli() -> Result { + let output = run_devpod(&["version"], false).await?; + if output.exit_code == 0 { + Ok(output.stdout.trim().to_string()) + } else { + Err(Error::DevPodNotFound) + } +} + +// --------------------------------------------------------------------------- +// Workspace lifecycle +// --------------------------------------------------------------------------- + +/// `devpod up` — create and start a workspace. +pub async fn up(args: &[&str]) -> Result { + let mut cmd_args = vec!["up", "--open-ide=false"]; + cmd_args.extend_from_slice(args); + run_devpod(&cmd_args, false).await +} + +/// `devpod stop` — stop a workspace. +pub async fn stop(workspace: &str) -> Result { + run_devpod(&["stop", workspace], false).await +} + +/// `devpod delete` — delete a workspace. +pub async fn delete(workspace: &str, force: bool) -> Result { + let mut args = vec!["delete", workspace]; + if force { + args.push("--force"); + } + run_devpod(&args, false).await +} + +/// `devpod build` — build a workspace image. +pub async fn build(args: &[&str]) -> Result { + let mut cmd_args = vec!["build"]; + cmd_args.extend_from_slice(args); + run_devpod(&cmd_args, false).await +} + +// --------------------------------------------------------------------------- +// Workspace queries +// --------------------------------------------------------------------------- + +/// Workspace status from `devpod status --output json`. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct WorkspaceStatus { + pub id: Option, + pub context: Option, + pub provider: Option, + pub state: Option, +} + +/// `devpod status` — get workspace status as JSON. +pub async fn status(workspace: &str, timeout: Option<&str>) -> Result { + let mut args = vec!["status", workspace, "--output", "json"]; + if let Some(t) = timeout { + args.push("--timeout"); + args.push(t); + } + run_devpod(&args, true).await +} + +/// Workspace list entry from `devpod list --output json`. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct WorkspaceListEntry { + #[serde(flatten)] + pub data: serde_json::Value, +} + +/// `devpod list` — list all workspaces as JSON. +pub async fn list() -> Result { + run_devpod(&["list", "--output", "json"], true).await +} + +// --------------------------------------------------------------------------- +// Command execution +// --------------------------------------------------------------------------- + +/// `devpod ssh --command` — execute a command in a workspace. +pub async fn ssh_exec(workspace: &str, command: &str, user: Option<&str>, workdir: Option<&str>) -> Result { + let mut args = vec!["ssh", workspace, "--command", command]; + if let Some(u) = user { + args.push("--user"); + args.push(u); + } + if let Some(w) = workdir { + args.push("--workdir"); + args.push(w); + } + run_devpod(&args, false).await +} + +// --------------------------------------------------------------------------- +// Logs +// --------------------------------------------------------------------------- + +/// `devpod logs` — get workspace logs. +pub async fn logs(workspace: &str) -> Result { + run_devpod(&["logs", workspace], false).await +} + +// --------------------------------------------------------------------------- +// Provider management +// --------------------------------------------------------------------------- + +/// `devpod provider list` — list providers. +pub async fn provider_list() -> Result { + run_devpod(&["provider", "list", "--output", "json"], true).await +} + +/// `devpod provider add` — add a provider. +pub async fn provider_add(provider: &str, options: &[&str]) -> Result { + let mut args = vec!["provider", "add", provider]; + args.extend_from_slice(options); + run_devpod(&args, false).await +} + +/// `devpod provider delete` — delete a provider. +pub async fn provider_delete(provider: &str) -> Result { + run_devpod(&["provider", "delete", provider], false).await +} + +// --------------------------------------------------------------------------- +// Context management +// --------------------------------------------------------------------------- + +/// `devpod context list` — list contexts. +pub async fn context_list() -> Result { + run_devpod(&["context", "list", "--output", "json"], true).await +} + +/// `devpod context use` — switch context. +pub async fn context_use(context: &str) -> Result { + run_devpod(&["context", "use", context], false).await +} + +// --------------------------------------------------------------------------- +// Import / Export +// --------------------------------------------------------------------------- + +/// `devpod import` — import a workspace. +pub async fn import(args: &[&str]) -> Result { + let mut cmd_args = vec!["import"]; + cmd_args.extend_from_slice(args); + run_devpod(&cmd_args, false).await +} + +/// `devpod export` — export a workspace. +pub async fn export(workspace: &str) -> Result { + run_devpod(&["export", workspace], false).await +} diff --git a/crates/devpod-mcp-core/src/docker.rs b/crates/devpod-mcp-core/src/docker.rs new file mode 100644 index 0000000..85939b1 --- /dev/null +++ b/crates/devpod-mcp-core/src/docker.rs @@ -0,0 +1,126 @@ +use bollard::container::{ListContainersOptions, LogsOptions}; +use bollard::Docker; +use futures_util::StreamExt; +use serde::Serialize; +use std::collections::HashMap; + +use crate::error::Result; + +/// Summary of a container's state. +#[derive(Debug, Clone, Serialize)] +pub struct ContainerInfo { + pub id: String, + pub name: String, + pub image: String, + pub state: String, + pub labels: HashMap, +} + +/// Create a Docker client connected to the local socket. +pub fn connect() -> Result { + Ok(Docker::connect_with_local_defaults()?) +} + +/// Find a container by the standard `devcontainer.local_folder` label. +pub async fn find_container_by_local_folder( + docker: &Docker, + local_folder: &str, +) -> Result> { + let mut filters = HashMap::new(); + filters.insert( + "label".to_string(), + vec![format!("devcontainer.local_folder={local_folder}")], + ); + + let options = ListContainersOptions { + all: true, + filters, + ..Default::default() + }; + + let containers = docker.list_containers(Some(options)).await?; + + Ok(containers.into_iter().next().map(|c| { + let labels = c.labels.unwrap_or_default(); + ContainerInfo { + id: c.id.unwrap_or_default(), + name: c + .names + .and_then(|n| n.first().cloned()) + .unwrap_or_default() + .trim_start_matches('/') + .to_string(), + image: c.image.unwrap_or_default(), + state: c.state.unwrap_or_default(), + labels, + } + })) +} + +/// Inspect a container by name or ID. +pub async fn inspect_container(docker: &Docker, name_or_id: &str) -> Result { + let detail = docker.inspect_container(name_or_id, None).await?; + + let labels = detail + .config + .as_ref() + .and_then(|c| c.labels.clone()) + .unwrap_or_default(); + + let image = detail + .config + .as_ref() + .and_then(|c| c.image.clone()) + .unwrap_or_default(); + + let state_str = detail + .state + .as_ref() + .and_then(|s| s.status.as_ref()) + .map(|s| format!("{s:?}").to_lowercase()) + .unwrap_or_else(|| "unknown".to_string()); + + Ok(ContainerInfo { + id: detail.id.unwrap_or_default(), + name: detail + .name + .unwrap_or_default() + .trim_start_matches('/') + .to_string(), + image, + state: state_str, + labels, + }) +} + +/// Stream container logs, returning them as a single string. +/// `tail` limits to the last N lines (0 = all). +pub async fn container_logs( + docker: &Docker, + container_id: &str, + tail: usize, +) -> Result { + let options = LogsOptions:: { + stdout: true, + stderr: true, + tail: if tail > 0 { + tail.to_string() + } else { + "all".to_string() + }, + ..Default::default() + }; + + let mut stream = docker.logs(container_id, Some(options)); + let mut output = String::new(); + + while let Some(msg) = stream.next().await { + match msg { + Ok(log) => output.push_str(&log.to_string()), + Err(e) => return Err(e.into()), + } + } + + Ok(output) +} + diff --git a/crates/devpod-mcp-core/src/error.rs b/crates/devpod-mcp-core/src/error.rs new file mode 100644 index 0000000..975e0ae --- /dev/null +++ b/crates/devpod-mcp-core/src/error.rs @@ -0,0 +1,25 @@ +use thiserror::Error; + +/// Unified error type for devpod-mcp-core. +#[derive(Debug, Error)] +pub enum Error { + #[error("Docker error: {0}")] + Docker(#[from] bollard::errors::Error), + + #[error("DevPod CLI not found. Install from: https://devpod.sh/docs/getting-started/install")] + DevPodNotFound, + + #[error("DevPod command failed (exit code {exit_code}): {stderr}")] + DevPodCommand { + exit_code: i32, + stderr: String, + }, + + #[error("IO error: {0}")] + Io(#[from] std::io::Error), + + #[error("JSON error: {0}")] + Json(#[from] serde_json::Error), +} + +pub type Result = std::result::Result; diff --git a/crates/devpod-mcp-core/src/lib.rs b/crates/devpod-mcp-core/src/lib.rs new file mode 100644 index 0000000..e7155e7 --- /dev/null +++ b/crates/devpod-mcp-core/src/lib.rs @@ -0,0 +1,3 @@ +pub mod devpod; +pub mod docker; +pub mod error; diff --git a/crates/devpod-mcp/Cargo.toml b/crates/devpod-mcp/Cargo.toml new file mode 100644 index 0000000..a734ab9 --- /dev/null +++ b/crates/devpod-mcp/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "devpod-mcp" +version = "0.1.0" +description = "MCP server and CLI for managing DevContainers" +edition.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +devpod-mcp-core = { path = "../devpod-mcp-core" } +tokio = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +anyhow = { workspace = true } +clap = { workspace = true } +rmcp = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } diff --git a/crates/devpod-mcp/src/main.rs b/crates/devpod-mcp/src/main.rs new file mode 100644 index 0000000..d834b20 --- /dev/null +++ b/crates/devpod-mcp/src/main.rs @@ -0,0 +1,41 @@ +mod tools; + +use clap::{Parser, Subcommand}; +use rmcp::ServiceExt; +use tokio::io::{stdin, stdout}; + +#[derive(Parser)] +#[command(name = "devpod-mcp")] +#[command(about = "MCP server and CLI for managing DevContainers")] +#[command(version)] +struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + /// Start the MCP server over stdio + Serve, +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .with_writer(std::io::stderr) + .init(); + + let cli = Cli::parse(); + + match cli.command { + Commands::Serve => { + tracing::info!("Starting devpod-mcp MCP server over stdio"); + let service = tools::DevContainerMcp::new(); + let server = service.serve((stdin(), stdout())).await?; + server.waiting().await?; + } + } + + Ok(()) +} diff --git a/crates/devpod-mcp/src/tools.rs b/crates/devpod-mcp/src/tools.rs new file mode 100644 index 0000000..8d77332 --- /dev/null +++ b/crates/devpod-mcp/src/tools.rs @@ -0,0 +1,289 @@ +use rmcp::model::ServerInfo; +use rmcp::{tool, ServerHandler}; + +use devpod_mcp_core::{devpod, docker}; + +#[derive(Debug, Clone)] +pub struct DevContainerMcp; + +impl DevContainerMcp { + pub fn new() -> Self { + Self + } +} + +/// Helper: format a DevPodOutput as a JSON string for MCP responses. +fn format_output(output: &devpod::DevPodOutput) -> String { + serde_json::json!({ + "exit_code": output.exit_code, + "stdout": output.stdout, + "stderr": output.stderr, + "json": output.json, + }) + .to_string() +} + +#[tool(tool_box)] +impl DevContainerMcp { + // ----------------------------------------------------------------------- + // Workspace lifecycle + // ----------------------------------------------------------------------- + + #[tool(name = "devpod_up", description = "Create and start a DevPod workspace. Pass the source (git URL, local path, or image) and any flags as space-separated args. Returns full build output for self-healing.")] + async fn up( + &self, + #[tool(param)] + #[schemars(description = "All arguments for 'devpod up', e.g. 'https://github.com/org/repo --provider docker --id my-ws'")] + args: String, + ) -> String { + let parts: Vec<&str> = args.split_whitespace().collect(); + match devpod::up(&parts).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_stop", description = "Stop a running DevPod workspace.")] + async fn stop( + &self, + #[tool(param)] + #[schemars(description = "Workspace name or ID")] + workspace: String, + ) -> String { + match devpod::stop(&workspace).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_delete", description = "Delete a DevPod workspace. Stops and removes all associated resources.")] + async fn delete( + &self, + #[tool(param)] + #[schemars(description = "Workspace name or ID")] + workspace: String, + #[tool(param)] + #[schemars(description = "Force delete even if workspace is not found remotely")] + force: Option, + ) -> String { + match devpod::delete(&workspace, force.unwrap_or(false)).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_build", description = "Build a DevPod workspace image without starting it.")] + async fn build( + &self, + #[tool(param)] + #[schemars(description = "All arguments for 'devpod build', e.g. 'my-workspace --provider docker'")] + args: String, + ) -> String { + let parts: Vec<&str> = args.split_whitespace().collect(); + match devpod::build(&parts).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + // ----------------------------------------------------------------------- + // Workspace queries + // ----------------------------------------------------------------------- + + #[tool(name = "devpod_status", description = "Get the status of a DevPod workspace. Returns structured JSON with state (Running, Stopped, Busy, NotFound).")] + async fn status( + &self, + #[tool(param)] + #[schemars(description = "Workspace name or ID")] + workspace: String, + #[tool(param)] + #[schemars(description = "Timeout for status check, e.g. '30s'")] + timeout: Option, + ) -> String { + match devpod::status(&workspace, timeout.as_deref()).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_list", description = "List all DevPod workspaces. Returns JSON array with workspace IDs, sources, providers, and status.")] + async fn list(&self) -> String { + match devpod::list().await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + // ----------------------------------------------------------------------- + // Command execution + // ----------------------------------------------------------------------- + + #[tool(name = "devpod_ssh", description = "Execute a command inside a DevPod workspace via SSH. Returns stdout, stderr, and exit code.")] + async fn ssh( + &self, + #[tool(param)] + #[schemars(description = "Workspace name or ID")] + workspace: String, + #[tool(param)] + #[schemars(description = "Command to execute inside the workspace")] + command: String, + #[tool(param)] + #[schemars(description = "User to run the command as")] + user: Option, + #[tool(param)] + #[schemars(description = "Working directory inside the workspace")] + workdir: Option, + ) -> String { + match devpod::ssh_exec(&workspace, &command, user.as_deref(), workdir.as_deref()).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + // ----------------------------------------------------------------------- + // Logs + // ----------------------------------------------------------------------- + + #[tool(name = "devpod_logs", description = "Get logs from a DevPod workspace.")] + async fn logs( + &self, + #[tool(param)] + #[schemars(description = "Workspace name or ID")] + workspace: String, + ) -> String { + match devpod::logs(&workspace).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + // ----------------------------------------------------------------------- + // Provider management + // ----------------------------------------------------------------------- + + #[tool(name = "devpod_provider_list", description = "List all configured DevPod providers.")] + async fn provider_list(&self) -> String { + match devpod::provider_list().await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_provider_add", description = "Add a DevPod provider.")] + async fn provider_add( + &self, + #[tool(param)] + #[schemars(description = "Provider name or URL to add")] + provider: String, + #[tool(param)] + #[schemars(description = "Additional options as space-separated KEY=VALUE pairs")] + options: Option, + ) -> String { + let opt_parts: Vec<&str> = options + .as_deref() + .map(|o| o.split_whitespace().collect()) + .unwrap_or_default(); + match devpod::provider_add(&provider, &opt_parts).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_provider_delete", description = "Delete a DevPod provider.")] + async fn provider_delete( + &self, + #[tool(param)] + #[schemars(description = "Provider name to delete")] + provider: String, + ) -> String { + match devpod::provider_delete(&provider).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + // ----------------------------------------------------------------------- + // Context management + // ----------------------------------------------------------------------- + + #[tool(name = "devpod_context_list", description = "List all DevPod contexts.")] + async fn context_list(&self) -> String { + match devpod::context_list().await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_context_use", description = "Switch to a different DevPod context.")] + async fn context_use( + &self, + #[tool(param)] + #[schemars(description = "Context name to switch to")] + context: String, + ) -> String { + match devpod::context_use(&context).await { + Ok(output) => format_output(&output), + Err(e) => format!("Error: {e}"), + } + } + + // ----------------------------------------------------------------------- + // Direct Docker (via bollard) + // ----------------------------------------------------------------------- + + #[tool(name = "devpod_container_inspect", description = "Inspect a Docker container directly — returns labels, ports, mounts, and state. Useful for details DevPod CLI doesn't expose.")] + async fn container_inspect( + &self, + #[tool(param)] + #[schemars(description = "Container name or ID")] + container: String, + ) -> String { + let client = match docker::connect() { + Ok(c) => c, + Err(e) => return format!("Error connecting to Docker: {e}"), + }; + match docker::inspect_container(&client, &container).await { + Ok(info) => serde_json::to_string(&info).unwrap_or_else(|e| format!("Error: {e}")), + Err(e) => format!("Error: {e}"), + } + } + + #[tool(name = "devpod_container_logs", description = "Get Docker container logs directly via the Docker API. Supports tail parameter for last N lines.")] + async fn container_logs( + &self, + #[tool(param)] + #[schemars(description = "Container name or ID")] + container: String, + #[tool(param)] + #[schemars(description = "Number of lines from the end to return (0 = all)")] + tail: Option, + ) -> String { + let client = match docker::connect() { + Ok(c) => c, + Err(e) => return format!("Error connecting to Docker: {e}"), + }; + match docker::container_logs(&client, &container, tail.unwrap_or(100)).await { + Ok(logs) => logs, + Err(e) => format!("Error: {e}"), + } + } +} + +#[tool(tool_box)] +impl ServerHandler for DevContainerMcp { + fn get_info(&self) -> ServerInfo { + ServerInfo { + instructions: Some( + "DevContainer MCP — wraps the DevPod CLI to give AI agents full control over \ + isolated development environments. Use devpod_list to see workspaces, devpod_up \ + to create one, devpod_ssh to run commands, devpod_stop/devpod_delete for lifecycle." + .into(), + ), + server_info: rmcp::model::Implementation { + name: "devpod-mcp".into(), + version: env!("CARGO_PKG_VERSION").into(), + }, + ..Default::default() + } + } +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..43c130d --- /dev/null +++ b/install.sh @@ -0,0 +1,147 @@ +#!/usr/bin/env bash +set -euo pipefail + +# devpod-mcp installer +# Downloads the latest release binary and installs DevPod CLI if not present. +# +# Usage: +# curl -fsSL https://raw.githubusercontent.com/aniongithub/devpod-mcp/main/install.sh | bash +# curl -fsSL ... | bash -s -- --install-dir /usr/local/bin +# curl -fsSL ... | bash -s -- --skip-devpod + +REPO="aniongithub/devpod-mcp" +INSTALL_DIR="${HOME}/.local/bin" +SKIP_DEVPOD=false + +# Parse args +while [[ $# -gt 0 ]]; do + case "$1" in + --skip-devpod) SKIP_DEVPOD=true; shift ;; + --install-dir) INSTALL_DIR="$2"; shift 2 ;; + --help|-h) + echo "Usage: install.sh [--skip-devpod] [--install-dir DIR]" + echo " --skip-devpod Skip automatic DevPod CLI installation" + echo " --install-dir Installation directory (default: ~/.local/bin)" + exit 0 + ;; + *) echo "Unknown option: $1"; exit 1 ;; + esac +done + +# Detect OS and architecture +detect_platform() { + local os arch + os="$(uname -s)" + arch="$(uname -m)" + + case "$os" in + Linux) os="linux" ;; + Darwin) os="darwin" ;; + *) echo "Error: Unsupported OS: $os"; exit 1 ;; + esac + + case "$arch" in + x86_64|amd64) arch="x64" ;; + aarch64|arm64) arch="arm64" ;; + *) echo "Error: Unsupported architecture: $arch"; exit 1 ;; + esac + + echo "${os}-${arch}" +} + +# Get latest release tag from GitHub +get_latest_version() { + curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \ + | grep '"tag_name"' \ + | sed -E 's/.*"tag_name": *"([^"]+)".*/\1/' +} + +PLATFORM="$(detect_platform)" +echo "==> Detected platform: ${PLATFORM}" + +VERSION="$(get_latest_version)" +if [[ -z "$VERSION" ]]; then + echo "Error: Could not determine latest release version." + echo "Check: https://github.com/${REPO}/releases" + exit 1 +fi +echo "==> Latest version: ${VERSION}" + +BINARY_NAME="devpod-mcp-${PLATFORM}" +DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${BINARY_NAME}" + +# Create install directory +mkdir -p "$INSTALL_DIR" + +echo "==> Downloading ${BINARY_NAME}..." +curl -fsSL -o "${INSTALL_DIR}/devpod-mcp" "$DOWNLOAD_URL" +chmod +x "${INSTALL_DIR}/devpod-mcp" +echo "==> Installed devpod-mcp to ${INSTALL_DIR}/devpod-mcp" + +# Verify +if "${INSTALL_DIR}/devpod-mcp" --version >/dev/null 2>&1; then + echo "==> $(${INSTALL_DIR}/devpod-mcp --version)" +else + echo "Warning: Binary downloaded but failed to run. Check platform compatibility." +fi + +# Check PATH +if ! echo "$PATH" | tr ':' '\n' | grep -qx "$INSTALL_DIR"; then + echo "" + echo "Note: ${INSTALL_DIR} is not in your PATH. Add it with:" + echo " export PATH=\"${INSTALL_DIR}:\$PATH\"" +fi + +# Ensure DevPod CLI is available +if command -v devpod >/dev/null 2>&1; then + echo "" + echo "==> DevPod CLI already installed: $(devpod version)" +elif ! $SKIP_DEVPOD; then + echo "" + echo "==> DevPod CLI not found — installing..." + DEVPOD_OS="$(uname -s | tr '[:upper:]' '[:lower:]')" + DEVPOD_ARCH="$(uname -m)" + + case "$DEVPOD_ARCH" in + x86_64|amd64) DEVPOD_ARCH="amd64" ;; + aarch64|arm64) DEVPOD_ARCH="arm64" ;; + esac + + DEVPOD_URL="https://github.com/loft-sh/devpod/releases/latest/download/devpod-${DEVPOD_OS}-${DEVPOD_ARCH}" + curl -fsSL -o "${INSTALL_DIR}/devpod" "$DEVPOD_URL" + chmod +x "${INSTALL_DIR}/devpod" + echo "==> Installed DevPod CLI to ${INSTALL_DIR}/devpod" + echo "==> $(${INSTALL_DIR}/devpod version)" +else + echo "" + echo "Warning: DevPod CLI not found and --skip-devpod was set." + echo "The MCP server requires DevPod to function. Install it from:" + echo " https://devpod.sh/docs/getting-started/install" +fi + +# Install SKILL.md for agent discovery +SKILL_URL="https://raw.githubusercontent.com/${REPO}/main/SKILL.md" +SKILL_DIRS=( + "${HOME}/.copilot/skills/devpod-mcp" + "${HOME}/.claude/skills/devpod-mcp" + "${HOME}/.agents/skills/devpod-mcp" +) + +echo "" +echo "==> Installing SKILL.md for agent discovery..." +for dir in "${SKILL_DIRS[@]}"; do + mkdir -p "$dir" + curl -fsSL -o "${dir}/SKILL.md" "$SKILL_URL" 2>/dev/null && \ + echo " ${dir}/SKILL.md" || true +done + +echo "" +echo "Done! Configure your MCP client:" +echo ' {' +echo ' "mcpServers": {' +echo ' "devpod-mcp": {' +echo " \"command\": \"${INSTALL_DIR}/devpod-mcp\"," +echo ' "args": ["serve"]' +echo ' }' +echo ' }' +echo ' }'