Skip to main content
Glama

connect

Establish a connection to an nREPL server by specifying host and port to evaluate Clojure code, inspect namespaces, and check connection statuses.

Instructions

Connect to an nREPL server. Example: (connect {:host "localhost" :port 1234})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYesnREPL server host
portYesnREPL server port

Implementation Reference

  • The handler function for the 'connect' MCP tool. It validates the input arguments (host and port), closes any existing nREPL connection, stores the host/port, creates a new NReplClient instance, clones an initial session, and returns a success message.
    case 'connect': { const args = request.params.arguments; if (!args || typeof args.host !== 'string' || typeof args.port !== 'number') { throw new McpError( ErrorCode.InvalidParams, 'host and port parameters are required' ); } // Close existing connection if any if (this.nreplClient) { await this.nreplClient.close(); this.nreplClient = null; } this.host = args.host; this.port = args.port; this.nreplClient = new NReplClient(this.port); await this.nreplClient.clone(); // Create initial session return { content: [{ type: 'text', text: `Connected to nREPL server at ${this.host}:${this.port}` }], }; }
  • Input schema definition for the 'connect' tool, specifying host (string) and port (number) as required properties.
    inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'nREPL server host' }, port: { type: 'number', description: 'nREPL server port' } }, required: ['host', 'port'] }
  • src/index.ts:139-151 (registration)
    Registration of the 'connect' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    { name: 'connect', description: 'Connect to an nREPL server.\n' + 'Example: (connect {:host "localhost" :port 1234})', inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'nREPL server host' }, port: { type: 'number', description: 'nREPL server port' } }, required: ['host', 'port'] } },

Other Tools

Related Tools

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/JohanCodinha/nrepl-mcp-server'

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