Skip to content

Commit 1bf06a5

Browse files
committed
Sync open source content 🐝 (from 496b19b8e6be6961abff01f067690c1b01d47f5f)
1 parent 936cb7d commit 1bf06a5

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

docs/publish-sdk.mdx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ import { Table, Callout, Screenshot } from "@/mdx/components";
1919

2020
<Table
2121
data={[
22-
{ language: "TypeScript", manager: "npm", prerequisites: "[Access tokens](https://docs.npmjs.com/creating-and-viewing-access-tokens)", notes: "Create an access token of type `Automation`. Supports both SDKs and MCP servers." },
22+
{ language: "TypeScript", manager: "npm", prerequisites: "[Granular access tokens](https://docs.npmjs.com/creating-and-viewing-access-tokens)", notes: "Use granular access tokens with read and write permissions. Classic tokens are deprecated. Supports both SDKs and MCP servers." },
2323
{ language: "Python", manager: "PyPI", prerequisites: "[API tokens](https://pypi.org/help/#apitoken)", notes: "" },
2424
{ language: "Go", manager: "GitHub", prerequisites: "[Repo visibility](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/setting-repository-visibility)", notes: "For private repos, add the [Speakeasy app](https://github.com/marketplace/speakeasy-api)." },
2525
{ language: "Java", manager: "Maven", prerequisites: "[Get started with Maven Central](https://central.sonatype.org/publish-ea/publish-ea-guide/) and [verify domain ownership](https://central.sonatype.org/faq/verify-ownership/)", notes: "" },
2626
{ language: "PHP", manager: "Packagist", prerequisites: "[See publishing packages](https://packagist.org/)", notes: "Monorepo setups not permitted. Package must be initially created manually in Packagist." },
2727
{ language: "C#", manager: "NuGet", prerequisites: "[API key](https://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package#create-an-api-key)", notes: "" },
2828
{ language: "Terraform", manager: "Terraform", prerequisites: "[GPG Key](https://developer.hashicorp.com/terraform/registry/providers/publishing#preparing-and-adding-a-signing-key)", notes: "" },
29-
{ language: "MCP Server (TypeScript)", manager: "npm", prerequisites: "[Access tokens](https://docs.npmjs.com/creating-and-viewing-access-tokens)", notes: "MCP servers are published as npm packages. Create an access token of type `Automation`." }
29+
{ language: "MCP Server (TypeScript)", manager: "npm", prerequisites: "[Granular access tokens](https://docs.npmjs.com/creating-and-viewing-access-tokens)", notes: "MCP servers are published as npm packages. Use granular access tokens with read and write permissions." }
3030
]}
3131
columns={[
3232
{ key: "language", header: "Language/Type" },
@@ -227,6 +227,27 @@ This configuration generates a `package.json` that looks like:
227227
For more details on `additionalPackageJSON` configuration options, see the [TypeScript configuration reference](/docs/speakeasy-reference/generation/ts-config#additional-json-package).
228228
</Callout>
229229

230+
#### TypeScript: npm granular access tokens
231+
232+
The npm registry requires granular access tokens for publishing packages. Classic tokens are deprecated; use granular tokens instead.
233+
234+
**Generating a granular access token:**
235+
236+
1. Log in to your [npm account](https://www.npmjs.com/)
237+
2. Navigate to **Access Tokens** in your account settings
238+
3. Click **Generate New Token** and select **Granular Access Token**
239+
4. Configure the token with the following settings:
240+
- **Token name**: Choose a descriptive name (e.g., `speakeasy-sdk-publishing`)
241+
- **Expiration**: Default is 7 days, but can be extended up to 1 year for automation workflows
242+
- **Packages and scopes**: Select **Read and write** permission for the packages you want to publish
243+
- For organization packages, ensure you have the appropriate organization permissions
244+
245+
5. Copy the generated token and store it securely as the `NPM_TOKEN` secret in your GitHub repository
246+
247+
<Callout title="Important">
248+
Granular tokens expire after the configured period (default 7 days). For CI/CD workflows, set a longer expiration period (up to 1 year) and establish a process to rotate tokens before they expire to avoid publishing failures.
249+
</Callout>
250+
230251
## Migrating from a monorepo to a dedicated repository
231252

232253
When moving a Speakeasy-generated SDK from within a monorepo to its own dedicated repository, follow these steps to ensure a smooth transition.

0 commit comments

Comments
 (0)