MCP server for running AL tests in Business Central
npm install al-test-runner-mcp-server.altestrunner/config.json and launch.json
.altestrunner.json with credentials
bash
npm install al-test-runner-mcp-server
`
$3
Add to your MCP client configuration (e.g., Claude Desktop):
`json
{
"mcpServers": {
"al-test-runner": {
"command": "npx",
"args": ["al-test-runner-mcp-server@1.0.0"]
}
}
}
`
Available Tools
$3
Discovers all AL test codeunits and methods in a workspace.
Parameters:
- workspacePath (string, required): Absolute path to the AL workspace directory
Example Request:
`json
{
"name": "discover_al_tests",
"arguments": {
"workspacePath": "C:\\Projects\\MyBCApp"
}
}
`
Example Response:
`json
{
"success": true,
"testCodeunitsFound": 5,
"totalTestMethods": 42,
"testCodeunits": [
{
"id": 50100,
"name": "Sales Invoice Tests",
"filePath": "C:\\Projects\\MyBCApp\\test\\SalesInvoiceTests.al",
"methods": [
{
"name": "TestCreateSalesInvoice",
"lineNumber": 15
},
{
"name": "TestPostSalesInvoice",
"lineNumber": 28
}
]
}
]
}
`
$3
Executes AL tests in Business Central and returns results.
Parameters:
- workspacePath (string, required): Absolute path to the AL workspace directory
- codeunitId (number, optional): ID of specific test codeunit to run
- methodName (string, optional): Name of specific test method (requires codeunitId)
- containerName (string, optional): Name of the Docker container to run tests against
- userName (string, optional): Username for BC authentication
- companyName (string, optional): Company name to run tests against
Example Request (Run All Tests):
`json
{
"name": "run_al_tests",
"arguments": {
"workspacePath": "C:\\Projects\\MyBCApp"
}
}
`
Example Request (Run Specific Test):
`json
{
"name": "run_al_tests",
"arguments": {
"workspacePath": "C:\\Projects\\MyBCApp",
"codeunitId": 50100,
"methodName": "TestCreateSalesInvoice"
}
}
`
Example Response:
`json
{
"success": true,
"exitCode": 0,
"stdout": "Running tests...\nTests completed.",
"stderr": "",
"results": {
"total": 2,
"passed": 2,
"failed": 0,
"skipped": 0,
"duration": 1.234,
"results": [
{
"codeunitId": 50100,
"codeunitName": "Sales Invoice Tests",
"methodName": "TestCreateSalesInvoice",
"result": "Pass",
"duration": 0.567
},
{
"codeunitId": 50100,
"codeunitName": "Sales Invoice Tests",
"methodName": "TestPostSalesInvoice",
"result": "Pass",
"duration": 0.667
}
]
}
}
`
$3
Retrieves the current test configuration from workspace files.
Parameters:
- workspacePath (string, required): Absolute path to the AL workspace directory
Example Request:
`json
{
"name": "get_test_configuration",
"arguments": {
"workspacePath": "C:\\Projects\\MyBCApp"
}
}
`
Example Response:
`json
{
"success": true,
"alTestRunnerConfig": {
"containerName": "bcserver",
"userName": "admin",
"password": "password"
"companyName": "CRONUS International Ltd.",
},
"appJson": {
"id": "12345678-1234-1234-1234-123456789012",
"name": "My BC App",
"version": "1.0.0.0"
}
}
`
Configuration Files
$3
Required configuration file in your AL workspace:
`json
{
"containerName": "bcserver",
"userName": "admin",
"password": "password for NavUserPassword auth",
"companyName": "Company Name to run tests in"
}
``