Skip to main content
Glama
arjshiv

Local Utilities MCP Server

by arjshiv

get_node_version

Check the Node.js version of your local environment to verify runtime compatibility and ensure proper execution of Node-based applications.

Instructions

Returns the Node.js version information of the environment running the MCP server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The anonymous async handler function for the 'get_node_version' tool. It invokes getNodeVersionInfo(), formats the result as JSON, and returns it in the MCP response format.
    async () => {
      // Error handling simplified, process.version/versions are generally safe
      const versionInfo = getNodeVersionInfo();
      return {
        content: [{
          type: "text",
          text: JSON.stringify(versionInfo, null, 2) // Keep JSON for structured data
        }]
      };
    }
  • The registration function that defines and registers the 'get_node_version' tool with the MCP server, including name, description, and handler.
    export function registerNodeVersionTool(server: McpServer): void {
      server.tool(
        "get_node_version",
        "Returns the Node.js version information of the environment running the MCP server.",
        async () => {
          // Error handling simplified, process.version/versions are generally safe
          const versionInfo = getNodeVersionInfo();
          return {
            content: [{
              type: "text",
              text: JSON.stringify(versionInfo, null, 2) // Keep JSON for structured data
            }]
          };
        }
      );
    } 
  • TypeScript interface defining the shape of the Node.js version information returned by the helper function.
    interface INodeVersionInfo {
      nodeVersion: string;
      details: NodeJS.ProcessVersions;
    }
  • Helper function that retrieves the current Node.js version string and detailed versions object from the process object.
    export function getNodeVersionInfo(): INodeVersionInfo { // Export for testing
      return {
        nodeVersion: process.version,
        details: process.versions,
      };
    }
  • src/index.ts:22-22 (registration)
    Invocation of the registerNodeVersionTool function in the main server initialization, effectively registering the tool.
    registerNodeVersionTool(server);

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/arjshiv/localutils-mcp-server'

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