Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
get-cloud-onboarding-url.ts1.55 kB
import { detectPackageManager, getPackageManagerCommand, } from '@nx-console/shared-npm'; import { noProvenanceError, nxLatestProvenanceCheck, } from '@nx-console/shared-utils'; import { getNxWorkspacePath } from '@nx-console/vscode-configuration'; import { vscodeLogger } from '@nx-console/vscode-output-channels'; import { getTelemetry } from '@nx-console/vscode-telemetry'; import { execSync } from 'child_process'; export async function getCloudOnboardingUrl() { const workspacePath = getNxWorkspacePath(); const packageManager = await detectPackageManager( workspacePath, vscodeLogger, ); const packageManagerCommand = await getPackageManagerCommand(workspacePath); const provenanceResult = await nxLatestProvenanceCheck(workspacePath); if (provenanceResult !== true) { getTelemetry().logUsage('misc.nx-latest-no-provenance'); vscodeLogger.log(provenanceResult); throw new Error(noProvenanceError); } // newer versions of nx will add `--ignore-scripts` by default, but older versions may not // yarn is not compatible with `--ignore-scripts` so we skip it for yarn let command = `${packageManagerCommand.dlx} ${packageManagerCommand.dlx === 'npx' ? '-y' : ''} nx@latest connect --ignore-scripts`; if (!command.includes('--ignore-scripts') && packageManager !== 'yarn') { command += ' --ignore-scripts'; } const nxConnectOutput = execSync(command, { cwd: workspacePath, }); const match = nxConnectOutput.toString().match(/(https:\/\/\S+)/); return match ? match[1] : undefined; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nrwl/nx-console'

If you have feedback or need assistance with the MCP directory API, please join our Discord server