Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
get-local-workspace-plugins.ts1.25 kB
import { join } from 'path'; import { importWorkspaceDependency, workspaceDependencyPath, } from '../workspace-dependencies'; import { NxWorkspace } from '@nx-console/shared-types'; import type { ProjectsConfigurations } from 'nx/src/devkit-exports'; import type { PluginCapabilities } from 'nx/src/utils/plugins/plugin-capabilities'; export async function getLocalWorkspacePlugins( workspacePath: string, workspace: NxWorkspace, ): Promise<Map<string, PluginCapabilities>> { const nxPath = await workspaceDependencyPath(workspacePath, 'nx'); if (!nxPath) { throw 'local nx dependency not found'; } const importPath = join(nxPath, 'src/utils/plugins/local-plugins'); const { getLocalWorkspacePlugins } = await importWorkspaceDependency< typeof import('nx/src/utils/plugins/local-plugins') >(importPath); const projectsConfiguration: ProjectsConfigurations = { // placeholder, doesn't actually matter version: 1, projects: {}, }; for (const [projectName, project] of Object.entries( workspace.projectGraph.nodes, )) { projectsConfiguration.projects[projectName] = project.data; } return await getLocalWorkspacePlugins( projectsConfiguration, workspace.nxJson, ); }

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