This guide explains how to test the MCP server without real Unanet credentials.
First, install dependencies and build:
npm install
npm run buildThen run the test with mock credentials:
cp .env.test .env
npm run test:serverDrives the full expense + receipt-attachment workflow through the compiled
server binary over JSON-RPC stdio (write tools enabled) against the mock,
including edge cases (real PDF upload, detailId association, read-back
verification, nonexistent file, >25 MB guard, missing confirm, non-editable
report):
npm run e2e:attachmentsExpect ==== E2E RESULT: PASS ====.
This will:
- Start the MCP server with test credentials
- Send test requests to list tools and resources
- Show the server's responses
- Exit after 5 seconds
Expected output shows:
- "Authentication configured successfully"
- "Server started successfully"
- List of 15 tools (projects, timesheets, contacts, financials)
- List of 2 resources (active projects, timesheet templates)
You can test the MCP protocol with Claude Desktop using test credentials:
- Configure Claude Desktop with test credentials:
{
"mcpServers": {
"unanet-test": {
"command": "node",
"args": ["C:\\path\\to\\unanet-mcp-server\\dist\\index.js"],
"env": {
"UNANET_USERNAME": "test-user",
"UNANET_PASSWORD": "test-pass",
"UNANET_API_KEY": "test-api-key",
"UNANET_FIRM_CODE": "TEST001",
"UNANET_BASE_URL": "https://test.unanet.com"
}
}
}
}-
Restart Claude Desktop
-
Test commands (these will fail with network errors but prove the integration works):
- "Can you connect to Unanet?"
- "List Unanet tools"
- "Show me projects" (will fail but shows the tool is called)
For more realistic testing, use the mock API server:
# Terminal 1: Start mock API server
npm run mock-serverThis starts a mock Unanet API on http://localhost:3000 with:
- Test endpoints for projects, timesheets, etc.
- Basic authentication (test-user/test-pass)
- API key validation (test-api-key)
# Terminal 2: Run MCP server against mock API
cp .env.test .env
npm run devThe .env.test file points to http://localhost:3000 (the mock server).
With both servers running, in Claude Desktop you can actually test real commands:
- "Show me all projects" - Returns mock project data
- "Get details for project PRJ-001" - Returns mock project details
- "Show my timesheets" - Returns mock timesheet data
-
Server startup and configuration
- Authentication validation
- Environment variable loading
- Server initialization
-
MCP Protocol
- Tool listing and registration
- Resource listing
- Request/response format
- Error handling structure
-
Claude Desktop Integration
- Configuration format
- Connection establishment
- Tool discovery
-
Build Process
- TypeScript compilation
- Package structure
- Dependencies
- Real API calls (need valid credentials)
- Actual data operations (need Unanet access)
- Authentication errors (need real API)
- Rate limiting (need real API)
The server logs to stderr (not stdout which is reserved for MCP protocol):
npm run dev 2> server.log# Test TypeScript compilation
npm run build
# Test with explicit test env
UNANET_USERNAME=test npm run dev- "Authentication failed" - Normal without real credentials
- "Network error" - Expected when not using mock server
- "Cannot find module" - Run
npm installfirst - "Command not found" - Run
npm run buildfirst
You can test:
- The MCP server starts and validates configuration ✅
- Tools and resources are registered correctly ✅
- Claude Desktop can discover and list tools ✅
- The build and setup process works ✅
You cannot test:
- Actual Unanet API calls without credentials ❌
- Real data operations ❌
This is sufficient to verify the MCP server structure and integration work correctly!