This page details the process for thoroughly testing the awaBerry MCP server across its two primary transport mechanisms: JSON/HTTP and Standard I/O (Stdio). Both testing flows involve configuring necessary environment variables such as mcpServerUrl, projectKey, projectSecret, and deviceName. For the JSON/HTTP version, tests validate session initialization, tool listing, device connection, and terminal command execution against an HTTP endpoint. The Stdio version performs similar validations by communicating directly over standard input/output, mimicking client interactions from applications like Claude Desktop. The tests ensure the server's core functionalities are operational and correctly configured.
This guide explains how to test the different transport versions of the awaBerry MCP server.
Before you begin, please follow the instructions in the ../httpservertest folder to ensure the underlying API methods are working correctly with your project setup.
This test runs the MCP server over an HTTP endpoint that communicates via JSON.
In the .env file located in the root directory of this project, add the following line:
Note: if your server is deployed on another environment already (e.g. Cloudflare), there is no need to start the local server.
mcpServerUrl="http://localhost:3000/mcp"
Ensure the .env file also contains the following required environment variables, which are used by the test script:
projectKey: Your project's unique key.projectSecret: Your project's secret for authentication.deviceName: The name of the device to connect to.In your first terminal, from the project's root folder, execute:
npm run start:mcp:json
You should see output similar to this, indicating the server is running:
> mcp_server_awaberry@1.0.0 start:mcp
> node mcpserver/awaBerryAgenticMcpServerHttpJson.js
awaberry-mcp-server running on http://localhost:3000/mcp
In a second terminal, from the project's root folder, execute:
npm run test:mcp:json
This command runs the testMcpServerJson.js script, which interacts with the running JSON server by sending JSON-RPC 2.0 requests. The test performs the following steps:
initialize request with protocol version and client information.tools/list request to retrieve a list of available tools from the server.connect_to_device tool with projectKey, projectSecret, and deviceName to establish a device connection and obtain a sessionToken and deviceuuid.execute_terminal_command tool, using the obtained sessionToken and deviceuuid, to run a sample command (e.g., date) on the connected device.This test runs the MCP server over standard input/output (stdio), which is the mode used by clients like Claude Desktop.
Ensure your .env file contains the following required environment variables, similar to the JSON/HTTP test, as they are crucial for device connection:
projectKey: Your project's unique key.projectSecret: Your project's secret for authentication.deviceName: The name of the device to connect to.In your first terminal, from the project's root folder, execute:
npm run start:mcp:stdio
You should see output similar to this:
> mcp_server_awaberry@1.0.0 start:mcp:stdio
> node mcpserver/awaBerryAgenticMcpServerStdio.js
awaberry-mcp-server running on stdio
In a second terminal, from the project's root folder, execute:
npm run test:mcp:stdio
This command runs the testMcpServerLocalStdio.js script. This script spawns the stdio MCP server as a child process and communicates with it by writing JSON-RPC 2.0 requests to its standard input and reading responses from its standard output. The test performs the following steps:
initialize request to establish a session.connect_to_device tool, providing projectKey, projectSecret, and deviceName to establish a device connection and obtain the necessary sessionToken and deviceuuid.execute_terminal_command tool with the acquired sessionToken and deviceuuid to run a test command (e.g., date).