Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
workspace-configuration-store.ts1.34 kB
import { Store } from '@nx-console/shared-schema'; import { ExtensionContext, Memento } from 'vscode'; import { WorkspaceConfigKeys } from './configuration-keys'; let CONFIG_STORE: WorkspaceConfigurationStore; /** * Configuration store that has config related to the opened workspace in vscode */ export class WorkspaceConfigurationStore implements Store { static fromContext(context: ExtensionContext): WorkspaceConfigurationStore { CONFIG_STORE = new WorkspaceConfigurationStore(context.workspaceState); return CONFIG_STORE; } /** * Returns the instance of WorkspaceConfigurationStore */ static get instance() { if (!CONFIG_STORE) { throw Error( 'Please create a configuration store with `fromContext` first' ); } return CONFIG_STORE; } constructor(private readonly state: Memento) {} delete(key: WorkspaceConfigKeys): void { this.state.update(key, undefined); } get<T>(key: WorkspaceConfigKeys, defaultValue: T) { const config = this.state.get(key, defaultValue); return typeof config === 'undefined' ? defaultValue : config; } set<T>(key: WorkspaceConfigKeys, value: T): void { this.state.update(key, value); } } export function getNxWorkspacePath(): string { return WorkspaceConfigurationStore.instance.get('nxWorkspacePath', ''); }

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