|
| 1 | +--- |
| 2 | +name: package-mcp-server |
| 3 | +description: Creates spec.yaml configurations for packaging MCP servers as containers. Use when adding a new MCP server to Dockyard, creating a spec.yaml file, or packaging npm/PyPI/Go MCP servers. |
| 4 | +--- |
| 5 | + |
| 6 | +# Package MCP Server for Dockyard |
| 7 | + |
| 8 | +This skill helps you package MCP servers for distribution via Dockyard containers. |
| 9 | + |
| 10 | +## When to Use This Skill |
| 11 | + |
| 12 | +Use this skill when: |
| 13 | +- Adding a new MCP server to Dockyard |
| 14 | +- Creating a spec.yaml configuration file |
| 15 | +- Packaging an npm (npx), PyPI (uvx), or Go MCP server |
| 16 | +- The user mentions "package", "add server", "spec.yaml", or "dockyard" |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +- The MCP server must be published to npm, PyPI, or as a Go module |
| 21 | +- Know the exact package name and version |
| 22 | + |
| 23 | +## Workflow |
| 24 | + |
| 25 | +### Step 1: Gather Information |
| 26 | + |
| 27 | +Ask the user for: |
| 28 | +1. **Package name** - The exact registry name (e.g., `@upstash/context7-mcp`, `mcp-clickhouse`) |
| 29 | +2. **Package type** - npm (npx), PyPI (uvx), or Go |
| 30 | +3. **Version** - Specific version to package (not "latest") |
| 31 | +4. **Source repository** - GitHub URL for the source code |
| 32 | + |
| 33 | +If not provided, look up the package: |
| 34 | + |
| 35 | +```bash |
| 36 | +# For npm packages |
| 37 | +npm view {package-name} version |
| 38 | +npm view {package-name} repository.url |
| 39 | + |
| 40 | +# For PyPI packages |
| 41 | +curl -s https://pypi.org/pypi/{package-name}/json | jq -r '.info.version, .info.project_urls.Homepage' |
| 42 | +``` |
| 43 | + |
| 44 | +### Step 2: Determine Protocol Directory |
| 45 | + |
| 46 | +| Package Type | Directory | Registry | |
| 47 | +|--------------|-----------|----------| |
| 48 | +| Node.js/npm | `npx/` | npm | |
| 49 | +| Python/PyPI | `uvx/` | PyPI | |
| 50 | +| Go module | `go/` | Go modules | |
| 51 | + |
| 52 | +### Step 3: Create Directory Structure |
| 53 | + |
| 54 | +```bash |
| 55 | +mkdir -p {protocol}/{server-name} |
| 56 | +``` |
| 57 | + |
| 58 | +The server name should be: |
| 59 | +- Lowercase with hyphens |
| 60 | +- Based on the package name (without scope) |
| 61 | +- Example: `@upstash/context7-mcp` becomes `context7` |
| 62 | + |
| 63 | +### Step 4: Create spec.yaml |
| 64 | + |
| 65 | +Write the configuration file to `{protocol}/{server-name}/spec.yaml`: |
| 66 | + |
| 67 | +```yaml |
| 68 | +# {Server Name} MCP Server Configuration |
| 69 | +# Package: {package-registry-url} |
| 70 | +# Repository: {source-repository-url} |
| 71 | +# Will build as: ghcr.io/stacklok/dockyard/{protocol}/{name}:{version} |
| 72 | + |
| 73 | +metadata: |
| 74 | + name: {server-name} |
| 75 | + description: "{brief-description}" |
| 76 | + version: "{version}" |
| 77 | + protocol: {npx|uvx|go} |
| 78 | + |
| 79 | +spec: |
| 80 | + package: "{full-package-name}" |
| 81 | + version: "{exact-version}" |
| 82 | + # args: # Optional: CLI arguments |
| 83 | + # - "start" # Some packages need specific commands |
| 84 | + |
| 85 | +provenance: |
| 86 | + repository_uri: "{github-repo-url}" |
| 87 | + repository_ref: "refs/tags/v{version}" |
| 88 | + |
| 89 | + # Optional: Document attestations if available |
| 90 | + # attestations: |
| 91 | + # available: true |
| 92 | + # verified: true |
| 93 | + # publisher: |
| 94 | + # kind: "GitHub" |
| 95 | + # repository: "{owner/repo}" |
| 96 | +``` |
| 97 | + |
| 98 | +### Step 5: Build dockhand CLI (First Time Only) |
| 99 | + |
| 100 | +```bash |
| 101 | +# Build the dockhand CLI tool |
| 102 | +task build-setup |
| 103 | +``` |
| 104 | + |
| 105 | +### Step 6: Verify Provenance (Recommended) |
| 106 | + |
| 107 | +Check if the package has provenance attestations: |
| 108 | + |
| 109 | +```bash |
| 110 | +# Check provenance |
| 111 | +./build/dockhand verify-provenance -c {protocol}/{server-name}/spec.yaml -v |
| 112 | +``` |
| 113 | + |
| 114 | +If provenance exists, update the spec.yaml with attestation information. |
| 115 | + |
| 116 | +### Step 7: Test Locally |
| 117 | + |
| 118 | +```bash |
| 119 | +# Setup scanner (first time only) |
| 120 | +task scan-setup |
| 121 | + |
| 122 | +# Validate spec and generate Dockerfile |
| 123 | +task build -- {protocol}/{server-name} |
| 124 | + |
| 125 | +# Run security scan |
| 126 | +task scan -- {protocol}/{server-name} |
| 127 | + |
| 128 | +# Optional: Full build test |
| 129 | +task test-build -- {protocol}/{server-name} |
| 130 | +``` |
| 131 | + |
| 132 | +### Step 8: Commit |
| 133 | + |
| 134 | +```bash |
| 135 | +git add {protocol}/{server-name}/spec.yaml |
| 136 | +git commit -m "feat: add {server-name} MCP server |
| 137 | +
|
| 138 | +Add packaging for {server-name} v{version}. |
| 139 | +Package: {package-url} |
| 140 | +Repository: {repo-url}" |
| 141 | +``` |
| 142 | + |
| 143 | +## Protocol-Specific Notes |
| 144 | + |
| 145 | +### npm (npx) |
| 146 | + |
| 147 | +- Package name may include scope: `@org/package-name` |
| 148 | +- Some packages require CLI args (e.g., `args: ["start"]`) |
| 149 | +- Check if package has npm provenance signatures |
| 150 | + |
| 151 | +### PyPI (uvx) |
| 152 | + |
| 153 | +- Package name is usually lowercase with hyphens |
| 154 | +- Check for PEP 740 attestations |
| 155 | +- AWS Labs packages have verified attestations |
| 156 | + |
| 157 | +### Go |
| 158 | + |
| 159 | +- Package is the full module path: `github.com/org/repo` |
| 160 | +- Version must include `v` prefix: `v0.3.1` |
| 161 | + |
| 162 | +## Common Issues |
| 163 | + |
| 164 | +| Issue | Solution | |
| 165 | +|-------|----------| |
| 166 | +| Package not found | Verify exact name in registry | |
| 167 | +| Version doesn't exist | Check available versions with `npm view` or PyPI API | |
| 168 | +| Security scan fails | Review issues, add allowlist if false positive | |
| 169 | +| Build fails | Check Dockerfile output with `dockhand build -c spec.yaml` | |
| 170 | + |
| 171 | +## See Also |
| 172 | + |
| 173 | +- [SPEC-YAML-REFERENCE.md](references/SPEC-YAML-REFERENCE.md) - Full spec.yaml reference |
| 174 | +- [docs/adding-servers.md](../../../docs/adding-servers.md) - Complete contribution guide |
| 175 | +- [docs/provenance.md](../../../docs/provenance.md) - Provenance verification details |
0 commit comments