Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
find-matching-projects.ts1.29 kB
import type { ProjectGraphProjectNode } from 'nx/src/devkit-exports'; import { join } from 'path'; import { importWorkspaceDependency, workspaceDependencyPath, } from '../workspace-dependencies'; export async function findMatchingProjects( projectsToRun: string | string[], projects: Record<string, ProjectGraphProjectNode>, workspacePath: string, ): Promise<string[]> { const nxPath = await workspaceDependencyPath(workspacePath, 'nx'); if (!nxPath) { throw 'local nx dependency not found'; } const importPath = join(nxPath, 'src/utils/find-matching-projects'); const { findMatchingProjects } = await importWorkspaceDependency< typeof import('nx/src/utils/find-matching-projects') >(importPath); const projectsArray = Array.isArray(projectsToRun) ? projectsToRun : [projectsToRun]; return findMatchingProjects(projectsArray, projects); } export async function findMatchingProject( projectName: string, projects: Record<string, ProjectGraphProjectNode>, workspacePath: string, ): Promise<ProjectGraphProjectNode | undefined> { const matchingProjects = await findMatchingProjects( projectName, projects, workspacePath, ); return matchingProjects.length > 0 ? projects[matchingProjects[0]] : 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