You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{ 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." },
{ 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: "" },
26
26
{ language: "PHP", manager: "Packagist", prerequisites: "[See publishing packages](https://packagist.org/)", notes: "Monorepo setups not permitted. Package must be initially created manually in Packagist." },
{ 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." }
30
30
]}
31
31
columns={[
32
32
{ key: "language", header: "Language/Type" },
@@ -227,6 +227,27 @@ This configuration generates a `package.json` that looks like:
227
227
For more details on `additionalPackageJSON` configuration options, see the [TypeScript configuration reference](/docs/speakeasy-reference/generation/ts-config#additional-json-package).
228
228
</Callout>
229
229
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
+
230
251
## Migrating from a monorepo to a dedicated repository
231
252
232
253
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