pmcp 2.18.0

High-quality Rust SDK for Model Context Protocol (MCP) with full TypeScript SDK compatibility
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
name: Release

on:
  push:
    tags:
      - 'v*'
  # Allow manual re-runs (e.g., after a workflow fix when a publish step
  # failed and we want to re-fire against an existing tag). All publish
  # steps already skip gracefully when the version is already on crates.io.
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: never

jobs:
  create-release:
    name: Create Release
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.get_version.outputs.VERSION }}
    steps:
    - uses: actions/checkout@v7

    - name: Get version from tag
      id: get_version
      run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

    - name: Read changelog
      id: changelog
      run: |
        # Extract the latest version's changelog
        VERSION="${{ steps.get_version.outputs.VERSION }}"
        VERSION_NO_V="${VERSION#v}"
        CHANGELOG=$(awk -v ver="## \\[$VERSION_NO_V\\]" '
          $0 ~ ver {p=1; next}
          /^## \[/ && p {exit}
          p {print}
        ' CHANGELOG.md)
        echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
        echo "$CHANGELOG" >> $GITHUB_OUTPUT
        echo "EOF" >> $GITHUB_OUTPUT

    - name: Create Release
      id: create_release
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        VERSION: ${{ steps.get_version.outputs.VERSION }}
        RELEASE_NOTES: ${{ steps.changelog.outputs.CHANGELOG }}
      run: |
        # Check if release already exists
        if gh release view "$VERSION" &>/dev/null; then
          echo "Release $VERSION already exists, skipping creation"
          echo "RELEASE_EXISTS=true" >> $GITHUB_OUTPUT
        else
          gh release create "$VERSION" \
            --title "$VERSION" \
            --notes "$RELEASE_NOTES" \
            --verify-tag
          echo "RELEASE_EXISTS=false" >> $GITHUB_OUTPUT
        fi

  publish-crates:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    needs: create-release
    steps:
    - uses: actions/checkout@v7

    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable

    - name: Cache cargo
      uses: actions/cache@v6
      with:
        path: |
          ~/.cargo/bin/
          ~/.cargo/registry/index/
          ~/.cargo/registry/cache/
          ~/.cargo/git/db/
          target/
        key: ${{ runner.os }}-cargo-publish-${{ hashFiles('**/Cargo.lock') }}

    # Publish order: leaf dependencies first, then dependents.
    # pmcp-widget-utils (no internal deps)
    # -> pmcp-macros-support (no internal deps; consumed by pmcp-macros)
    # -> pmcp-macros (depends on pmcp-macros-support)
    # -> pmcp-code-mode (depends on pmcp)
    # -> pmcp-code-mode-derive (depends on pmcp-code-mode)
    # -> pmcp (depends on widget-utils + macros)
    # -> pmcp-server-toolkit (depends on pmcp + pmcp-code-mode)
    # -> pmcp-toolkit-postgres / -mysql / -athena (depend on the toolkit)
    # -> pmcp-sql-server (depends on toolkit + the three connectors)
    # -> pmcp-openapi-server (depends on the toolkit)
    # -> mcp-tester (depends on pmcp)
    # -> mcp-preview (depends on widget-utils)
    # -> cargo-pmcp (depends on pmcp, mcp-tester, mcp-preview)
    # -> pmcp-server (depends on pmcp, mcp-tester)
    # -> pmcp-package (standalone workspace-EXCLUDED leaf, published via
    #    --manifest-path, NOT -p; has NO in-repo consumers yet, so it publishes
    #    LAST — a failure in this experimental 0.x crate must not gate the core
    #    SDK release. Move it earlier only once a shipped crate actually pins it.)

    - name: Publish pmcp-widget-utils
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-widget-utils..."
        OUTPUT=$(cargo publish -p pmcp-widget-utils 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-widget-utils already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-widget-utils"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-widget-utils
      run: sleep 30

    - name: Publish pmcp-macros-support
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-macros-support..."
        OUTPUT=$(cargo publish -p pmcp-macros-support 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-macros-support already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-macros-support"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-macros-support
      run: sleep 30

    - name: Publish pmcp-macros
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-macros..."
        OUTPUT=$(cargo publish -p pmcp-macros 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-macros already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-macros"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-macros
      run: sleep 30

    - name: Publish pmcp-code-mode
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-code-mode..."
        OUTPUT=$(cargo publish -p pmcp-code-mode 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-code-mode already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-code-mode"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-code-mode
      run: sleep 30

    - name: Publish pmcp-code-mode-derive
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-code-mode-derive..."
        OUTPUT=$(cargo publish -p pmcp-code-mode-derive 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-code-mode-derive already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-code-mode-derive"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-code-mode-derive
      run: sleep 30

    - name: Publish pmcp (core SDK)
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp..."
        OUTPUT=$(cargo publish -p pmcp 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp already published, continuing..."
          else
            echo "::error::Failed to publish pmcp"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp
      run: sleep 30

    # --- v2.2 config-driven server toolkit (first published in v2.9.0) ---
    # pmcp-server-toolkit depends on pmcp + pmcp-code-mode (both published above);
    # the three per-backend connectors depend on the toolkit; pmcp-sql-server
    # depends on the toolkit + all three connectors; pmcp-openapi-server depends
    # on the toolkit. (mcp-tester is only a dev-dependency of the servers and is
    # already on crates.io, so it does not gate this tier.)
    # --- v2.3 workbook leaves — MUST precede pmcp-server-toolkit, which has an
    # OPTIONAL dependency on pmcp-workbook-runtime; crates.io rejects a publish whose
    # dependencies (even optional) are not yet on the index.
    # Internal order matters: pmcp-workbook-runtime is the only true leaf;
    # pmcp-workbook-dialect depends on it, so runtime must publish AND index first.
    - name: Publish pmcp-workbook-runtime
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-workbook-runtime..."
        OUTPUT=$(cargo publish -p pmcp-workbook-runtime 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-workbook-runtime already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-workbook-runtime"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-workbook-runtime
      run: sleep 30

    - name: Publish pmcp-workbook-dialect
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-workbook-dialect..."
        OUTPUT=$(cargo publish -p pmcp-workbook-dialect 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-workbook-dialect already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-workbook-dialect"
            exit 1
          fi
        }

    - name: Wait for crates.io to index the workbook leaves
      run: sleep 30

    - name: Publish pmcp-server-toolkit
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-server-toolkit..."
        OUTPUT=$(cargo publish -p pmcp-server-toolkit 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-server-toolkit already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-server-toolkit"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-server-toolkit
      run: sleep 30

    - name: Publish pmcp-toolkit-postgres
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-toolkit-postgres..."
        OUTPUT=$(cargo publish -p pmcp-toolkit-postgres 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-toolkit-postgres already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-toolkit-postgres"
            exit 1
          fi
        }

    - name: Publish pmcp-toolkit-mysql
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-toolkit-mysql..."
        OUTPUT=$(cargo publish -p pmcp-toolkit-mysql 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-toolkit-mysql already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-toolkit-mysql"
            exit 1
          fi
        }

    - name: Publish pmcp-toolkit-athena
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-toolkit-athena..."
        OUTPUT=$(cargo publish -p pmcp-toolkit-athena 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-toolkit-athena already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-toolkit-athena"
            exit 1
          fi
        }

    - name: Wait for crates.io to index the toolkit connectors
      run: sleep 30

    - name: Publish pmcp-sql-server
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-sql-server..."
        OUTPUT=$(cargo publish -p pmcp-sql-server 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-sql-server already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-sql-server"
            exit 1
          fi
        }

    - name: Publish pmcp-openapi-server
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-openapi-server..."
        OUTPUT=$(cargo publish -p pmcp-openapi-server 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-openapi-server already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-openapi-server"
            exit 1
          fi
        }

    - name: Wait for crates.io to index the toolkit servers
      run: sleep 30

    # --- v2.3 workbook compiler + server (after the toolkit they depend on) ---
    # pmcp-workbook-dialect + pmcp-workbook-runtime were published earlier (BEFORE
    # pmcp-server-toolkit, which optionally depends on the runtime). The compiler
    # depends on dialect + runtime + pmcp-server-toolkit[workbook] (a dev-dependency);
    # pmcp-workbook-server depends on the toolkit[workbook,http]. cargo-pmcp (below)
    # depends on the compiler, so both must publish before it.
    - name: Publish pmcp-workbook-compiler
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-workbook-compiler..."
        OUTPUT=$(cargo publish -p pmcp-workbook-compiler 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-workbook-compiler already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-workbook-compiler"
            exit 1
          fi
        }

    - name: Publish pmcp-workbook-server
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-workbook-server..."
        OUTPUT=$(cargo publish -p pmcp-workbook-server 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-workbook-server already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-workbook-server"
            exit 1
          fi
        }

    - name: Wait for crates.io to index the workbook crates
      run: sleep 30

    - name: Publish mcp-tester
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing mcp-tester..."
        OUTPUT=$(cargo publish -p mcp-tester 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "mcp-tester already published, continuing..."
          else
            echo "::error::Failed to publish mcp-tester"
            exit 1
          fi
        }

    - name: Publish mcp-preview
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing mcp-preview..."
        OUTPUT=$(cargo publish -p mcp-preview 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "mcp-preview already published, continuing..."
          else
            echo "::error::Failed to publish mcp-preview"
            exit 1
          fi
        }

    # pmcp-package + pmcp-cfn-renderer + pmcp-agent + pmcp-team-servers publish
    # BEFORE cargo-pmcp: cargo-pmcp (as of the CFN-renderer extraction) pins
    # all four (`pmcp-package = "0.1"`, `pmcp-cfn-renderer = "0.1"`,
    # `pmcp-agent = "0.1"`, `pmcp-team-servers = "0.1"`), so they MUST already
    # exist on crates.io or `cargo publish -p cargo-pmcp` fails with
    # "no matching package named `...`". Dependency order among the four:
    # pmcp-package (leaf) -> pmcp-cfn-renderer (pins pmcp-package) ->
    # pmcp-agent (pins pmcp-package) -> pmcp-team-servers (pins pmcp-agent +
    # pmcp-package). All are experimental 0.x, so each keeps the same
    # "already exists"-tolerant guard — a failure here must not gate the
    # already-published core `pmcp` SDK.
    #
    # pmcp-package is workspace-EXCLUDED (own [workspace] table), so it publishes
    # via --manifest-path, NOT `-p pmcp-package`.
    - name: Publish pmcp-package
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-package..."
        OUTPUT=$(cargo publish --manifest-path crates/pmcp-package/Cargo.toml 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-package already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-package"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-package
      run: sleep 30

    # pmcp-cfn-renderer (CFN-renderer extraction) publishes right after
    # pmcp-package, its only dependency (`pmcp-package = "0.1"`, needs the
    # 0.1.1 [auth.cognito] promotion — see
    # crates/pmcp-cfn-renderer/tests/goldens/README.md's "Cross-crate publish
    # coupling" section), and BEFORE cargo-pmcp, which pins
    # `pmcp-cfn-renderer = "0.1"` (replaces `npx cdk synth`/`cdk deploy` for
    # unmodified scaffolds on the pmcp-run and aws-lambda deploy targets).
    # Experimental 0.x — a failure here must not gate the core SDK release.
    - name: Publish pmcp-cfn-renderer
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-cfn-renderer..."
        OUTPUT=$(cargo publish -p pmcp-cfn-renderer 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-cfn-renderer already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-cfn-renderer"
            exit 1
          fi
        }

    - name: Wait for crates.io to index pmcp-cfn-renderer
      run: sleep 30

    - name: Publish pmcp-agent
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-agent..."
        OUTPUT=$(cargo publish -p pmcp-agent 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-agent already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-agent"
            exit 1
          fi
        }

    - name: Publish pmcp-team-servers
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-team-servers..."
        OUTPUT=$(cargo publish -p pmcp-team-servers 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-team-servers already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-team-servers"
            exit 1
          fi
        }

    - name: Wait for crates.io to index the agent/team crates
      run: sleep 30

    # cargo-pmcp (the user-facing CLI) publishes AFTER its pmcp-agent/
    # pmcp-team-servers/pmcp-package deps (above) and BEFORE pmcp-server, so a
    # future pmcp-server packaging issue cannot block the main CLI from shipping.
    - name: Publish cargo-pmcp
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing cargo-pmcp..."
        OUTPUT=$(cargo publish -p cargo-pmcp 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "cargo-pmcp already published, continuing..."
          else
            echo "::error::Failed to publish cargo-pmcp"
            exit 1
          fi
        }

    - name: Wait for crates.io to index cargo-pmcp
      run: sleep 30

    - name: Publish pmcp-server
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-server..."
        OUTPUT=$(cargo publish -p pmcp-server 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-server already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-server"
            exit 1
          fi
        }

    # pmcp-package: standalone workspace-EXCLUDED leaf (has its own [workspace]
    # table, so `-p pmcp-package` does NOT resolve — it must be reached via
    # --manifest-path). It has NO in-repo consumers yet, so it is published LAST:
    # a failure in this experimental 0.x crate must not abort the job before the
    # core `pmcp` SDK and its dependents publish. Move it earlier (before its
    # consumer) only once a shipped crate actually pins `pmcp-package = "0.1"`.
    - name: Publish pmcp-package
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      run: |
        echo "Publishing pmcp-package..."
        OUTPUT=$(cargo publish --manifest-path crates/pmcp-package/Cargo.toml 2>&1) && echo "$OUTPUT" || {
          echo "$OUTPUT"
          if echo "$OUTPUT" | grep -q "already exists"; then
            echo "pmcp-package already published, continuing..."
          else
            echo "::error::Failed to publish pmcp-package"
            exit 1
          fi
        }

  publish-mcp:
    name: Publish to MCP Registry
    runs-on: ubuntu-latest
    needs: publish-crates
    permissions:
      id-token: write  # Required for OIDC authentication
      contents: read
    steps:
    - uses: actions/checkout@v7

    - name: Wait for crates.io availability
      run: |
        echo "Waiting 60 seconds for crates.io to index all packages..."
        sleep 60

    - name: Install MCP Publisher
      run: |
        PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
        ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
        curl -sL "https://github.com/modelcontextprotocol/registry/releases/download/v1.7.9/mcp-publisher_${PLATFORM}_${ARCH}.tar.gz" | tar xz
        chmod +x mcp-publisher

    - name: Login to MCP Registry
      run: ./mcp-publisher login github-oidc

    - name: Publish to MCP Registry
      run: ./mcp-publisher publish

  build-tester:
    name: Build Tester Binaries
    needs: create-release
    uses: ./.github/workflows/release-binary.yml
    with:
      tag_name: ${{ needs.create-release.outputs.version }}
      package_name: mcp-tester
    secrets: inherit

  build-pmcp-server:
    name: Build PMCP Server Binaries
    needs: create-release
    uses: ./.github/workflows/release-binary.yml
    with:
      tag_name: ${{ needs.create-release.outputs.version }}
      package_name: pmcp-server
    secrets: inherit

  # Shape A pure-config connector binaries (CFN-renderer extraction, Task 10):
  # `cargo pmcp deploy --target aws-lambda` on a `[metadata].server_type`
  # project (ServerShape::BuiltIn — see
  # cargo-pmcp/src/deployment/targets/aws_lambda/artifact.rs) fetches one of
  # these three as a bare `<name>-<target-triple>` GitHub Release asset (same
  # `.sha256` sidecar convention as mcp-tester/pmcp-server above). Before this
  # job existed, none of the three were ever built by this workflow, so a
  # real built-in deploy 404'd (T8/T10 gap, closed here).
  build-pmcp-sql-server:
    name: Build PMCP SQL Server Binaries
    needs: create-release
    uses: ./.github/workflows/release-binary.yml
    with:
      tag_name: ${{ needs.create-release.outputs.version }}
      package_name: pmcp-sql-server
    secrets: inherit

  build-pmcp-workbook-server:
    name: Build PMCP Workbook Server Binaries
    needs: create-release
    uses: ./.github/workflows/release-binary.yml
    with:
      tag_name: ${{ needs.create-release.outputs.version }}
      package_name: pmcp-workbook-server
    secrets: inherit

  build-pmcp-openapi-server:
    name: Build PMCP OpenAPI Server Binaries
    needs: create-release
    uses: ./.github/workflows/release-binary.yml
    with:
      tag_name: ${{ needs.create-release.outputs.version }}
      package_name: pmcp-openapi-server
    secrets: inherit