Skip to main content
Glama
JohanCodinha

nREPL MCP Server

by JohanCodinha

connect

Establish a connection to an nREPL server by specifying host and port parameters to enable Clojure code evaluation and namespace inspection.

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

  • Handler for the 'connect' tool: validates input arguments, closes existing connection if any, initializes a new NReplClient with the provided host and port, clones a 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 as string and port as number, both required.
    inputSchema: {
      type: 'object',
      properties: {
        host: { type: 'string', description: 'nREPL server host' },
        port: { type: 'number', description: 'nREPL server port' }
      },
      required: ['host', 'port']
  • src/index.ts:140-151 (registration)
    Registration of the 'connect' tool in the ListToolsRequestSchema response, 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']
      }
    },
Install Server

Other 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