Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
mcp-test-client.ts987 B
import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; export class TestMCPClient { private client: Client; private transport: StreamableHTTPClientTransport | null = null; constructor( private serverUrl: string, clientName: string, ) { this.client = new Client({ name: clientName, version: '1.0.0', }); } async connect(): Promise<void> { this.transport = new StreamableHTTPClientTransport(new URL(this.serverUrl)); await this.client.connect(this.transport); } async listTools(): Promise<any[]> { const result = await this.client.listTools(); return result.tools; } async callTool(name: string, args: Record<string, any> = {}): Promise<any> { return await this.client.callTool({ name, arguments: args, }); } async disconnect(): Promise<void> { await this.client.close(); } }

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