diff --git a/README.md b/README.md
index b1fe8ef..a6f7578 100644
--- a/README.md
+++ b/README.md
@@ -25,10 +25,13 @@
       <img src="assets/thumbnail.webp">
     </a>
   </div>
+
   
 Manage test cases, execute manual or automated tests, debug issues, and even fix code—directly within tools like Cursor, Claude, or any MCP-enabled client, using plain English.
 #### Test from anywhere:
 Easily connect the BrowserStack Test Platform to your favourite AI tools, such as IDEs, LLMs, or agentic workflows.
+#### Test with natural language:
+Manage, execute, debug tests, and even fix code using plain English prompts.
 #### Reduced context switching:
 Stay in flow—keep all project context in one place and trigger actions directly from your IDE or LLM.
 
@@ -115,7 +118,7 @@ Create and manage test cases, create test plans and trigger test runs using natu
 "update test results as passed for Login tests test run from My Demo Project"
 ```
 
-### 🧪 Access BrowserStack AI agnets 
+### 🧪 Access BrowserStack AI agents 
 
 Generate test cases from PRDs, convert manual tests to low-code automation, and auto-heal flaky scripts powered by BrowserStack’s AI agents, seamlessly integrated into your workflow.  Below are few example prompts to access Browserstack AI agents
 
diff --git a/package-lock.json b/package-lock.json
index eff5a06..7cd172b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "@browserstack/mcp-server",
-  "version": "1.1.8",
+  "version": "1.2.1",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "@browserstack/mcp-server",
-      "version": "1.1.8",
+      "version": "1.2.1",
       "license": "ISC",
       "dependencies": {
         "@modelcontextprotocol/sdk": "^1.11.4",
diff --git a/package.json b/package.json
index 5c15fb3..d5f007e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@browserstack/mcp-server",
-  "version": "1.1.8",
+  "version": "1.2.1",
   "description": "BrowserStack's Official MCP Server",
   "main": "dist/index.js",
   "repository": {
diff --git a/src/config.ts b/src/config.ts
index 95136b8..63a4ac6 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -36,20 +36,18 @@ for (const key of BROWSERSTACK_LOCAL_OPTION_KEYS) {
  */
 export class Config {
   constructor(
-    public readonly browserstackUsername: string,
-    public readonly browserstackAccessKey: string,
     public readonly DEV_MODE: boolean,
     public readonly browserstackLocalOptions: Record<string, any>,
     public readonly USE_OWN_LOCAL_BINARY_PROCESS: boolean,
+    public readonly REMOTE_MCP: boolean,
   ) {}
 }
 
 const config = new Config(
-  process.env.BROWSERSTACK_USERNAME!,
-  process.env.BROWSERSTACK_ACCESS_KEY!,
   process.env.DEV_MODE === "true",
   browserstackLocalOptions,
   process.env.USE_OWN_LOCAL_BINARY_PROCESS === "true",
+  process.env.REMOTE_MCP === "true",
 );
 
 export default config;
diff --git a/src/index.ts b/src/index.ts
index c5da73f..dec3584 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,44 +1,12 @@
 #!/usr/bin/env node
 
-import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
 import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
 import { createRequire } from "module";
 const require = createRequire(import.meta.url);
 const packageJson = require("../package.json");
 import "dotenv/config";
 import logger from "./logger.js";
-import addSDKTools from "./tools/bstack-sdk.js";
-import addAppLiveTools from "./tools/applive.js";
-import addBrowserLiveTools from "./tools/live.js";
-import addAccessibilityTools from "./tools/accessibility.js";
-import addTestManagementTools from "./tools/testmanagement.js";
-import addAppAutomationTools from "./tools/appautomate.js";
-import addFailureLogsTools from "./tools/getFailureLogs.js";
-import addAutomateTools from "./tools/automate.js";
-import addSelfHealTools from "./tools/selfheal.js";
-import { setupOnInitialized } from "./oninitialized.js";
-
-function registerTools(server: McpServer) {
-  addAccessibilityTools(server);
-  addSDKTools(server);
-  addAppLiveTools(server);
-  addBrowserLiveTools(server);
-  addTestManagementTools(server);
-  addAppAutomationTools(server);
-  addFailureLogsTools(server);
-  addAutomateTools(server);
-  addSelfHealTools(server);
-}
-
-// Create an MCP server
-const server: McpServer = new McpServer({
-  name: "BrowserStack MCP Server",
-  version: packageJson.version,
-});
-
-setupOnInitialized(server);
-
-registerTools(server);
+import { BrowserStackMcpServer } from "./server-factory.js";
 
 async function main() {
   logger.info(
@@ -46,9 +14,31 @@ async function main() {
     packageJson.version,
   );
 
-  // Start receiving messages on stdin and sending messages on stdout
+  const remoteMCP = process.env.REMOTE_MCP === "true";
+  if (remoteMCP) {
+    logger.info("Running in remote MCP mode");
+    return;
+  }
+
+  const username = process.env.BROWSERSTACK_USERNAME;
+  const accessKey = process.env.BROWSERSTACK_ACCESS_KEY;
+
+  if (!username) {
+    throw new Error("BROWSERSTACK_USERNAME environment variable is required");
+  }
+
+  if (!accessKey) {
+    throw new Error("BROWSERSTACK_ACCESS_KEY environment variable is required");
+  }
+
   const transport = new StdioServerTransport();
-  await server.connect(transport);
+
+  const mcpServer = new BrowserStackMcpServer({
+    "browserstack-username": username,
+    "browserstack-access-key": accessKey,
+  });
+
+  await mcpServer.getInstance().connect(transport);
 }
 
 main().catch(console.error);
@@ -57,3 +47,6 @@ main().catch(console.error);
 process.on("exit", () => {
   logger.flush();
 });
+
+export { setLogger } from "./logger.js";
+export { BrowserStackMcpServer } from "./server-factory.js";
diff --git a/src/lib/api.ts b/src/lib/api.ts
index af453f1..64051e7 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -1,19 +1,25 @@
-import config from "../config.js";
+import { getBrowserStackAuth } from "./get-auth.js";
+import { BrowserStackConfig } from "../lib/types.js";
+import { apiClient } from "./apiClient.js";
 
 export async function getLatestO11YBuildInfo(
   buildName: string,
   projectName: string,
+  config: BrowserStackConfig,
 ) {
   const buildsUrl = `https://api-observability.browserstack.com/ext/v1/builds/latest?build_name=${encodeURIComponent(
     buildName,
   )}&project_name=${encodeURIComponent(projectName)}`;
 
-  const buildsResponse = await fetch(buildsUrl, {
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
+
+  const buildsResponse = await apiClient.get({
+    url: buildsUrl,
     headers: {
-      Authorization: `Basic ${Buffer.from(
-        `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-      ).toString("base64")}`,
+      Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   if (!buildsResponse.ok) {
@@ -25,5 +31,5 @@ export async function getLatestO11YBuildInfo(
     throw new Error(`Failed to fetch builds: ${buildsResponse.statusText}`);
   }
 
-  return buildsResponse.json();
+  return buildsResponse;
 }
diff --git a/src/lib/apiClient.ts b/src/lib/apiClient.ts
new file mode 100644
index 0000000..23cdeea
--- /dev/null
+++ b/src/lib/apiClient.ts
@@ -0,0 +1,184 @@
+import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
+import httpsProxyAgentPkg from "https-proxy-agent";
+const { HttpsProxyAgent } = httpsProxyAgentPkg;
+import * as https from "https";
+import * as fs from "fs";
+import config from "../config.js";
+
+type RequestOptions = {
+  url: string;
+  headers?: Record<string, string>;
+  params?: Record<string, string | number>;
+  body?: any;
+  raise_error?: boolean; // default: true
+};
+
+class ApiResponse<T = any> {
+  private _response: AxiosResponse<T>;
+
+  constructor(response: AxiosResponse<T>) {
+    this._response = response;
+  }
+
+  get data(): T {
+    return this._response.data;
+  }
+
+  get status(): number {
+    return this._response.status;
+  }
+
+  get statusText(): string {
+    return this._response.statusText;
+  }
+
+  get headers(): Record<string, string> {
+    const raw = this._response.headers;
+    const sanitized: Record<string, string> = {};
+
+    for (const key in raw) {
+      const value = raw[key];
+      if (typeof value === "string") {
+        sanitized[key] = value;
+      }
+    }
+
+    return sanitized;
+  }
+
+  get config(): AxiosRequestConfig {
+    return this._response.config;
+  }
+
+  get url(): string | undefined {
+    return this._response.config.url;
+  }
+
+  get ok(): boolean {
+    return this._response.status >= 200 && this._response.status < 300;
+  }
+}
+
+// Utility to create HTTPS agent if needed (proxy/CA)
+function getAxiosAgent(): AxiosRequestConfig["httpsAgent"] | undefined {
+  const proxyHost = config.browserstackLocalOptions.proxyHost;
+  const proxyPort = config.browserstackLocalOptions.proxyPort;
+  const caCertPath = config.browserstackLocalOptions.useCaCertificate;
+
+  // If both proxy host and port are defined
+  if (proxyHost && proxyPort) {
+    const proxyUrl = `http://${proxyHost}:${proxyPort}`;
+    if (caCertPath && fs.existsSync(caCertPath)) {
+      // Proxy + CA cert
+      const ca = fs.readFileSync(caCertPath);
+      return new HttpsProxyAgent({
+        host: proxyHost,
+        port: Number(proxyPort),
+        ca,
+        rejectUnauthorized: false, // Set to true if you want strict SSL
+      });
+    } else {
+      // Proxy only
+      return new HttpsProxyAgent(proxyUrl);
+    }
+  } else if (caCertPath && fs.existsSync(caCertPath)) {
+    // CA only
+    return new https.Agent({
+      ca: fs.readFileSync(caCertPath),
+      rejectUnauthorized: false, // Set to true for strict SSL
+    });
+  }
+  // Default agent (no proxy, no CA)
+  return undefined;
+}
+
+class ApiClient {
+  private instance = axios.create();
+
+  private get axiosAgent() {
+    return getAxiosAgent();
+  }
+
+  private async requestWrapper<T>(
+    fn: (agent: AxiosRequestConfig["httpsAgent"]) => Promise<AxiosResponse<T>>,
+    raise_error: boolean = true,
+  ): Promise<ApiResponse<T>> {
+    try {
+      const res = await fn(this.axiosAgent);
+      return new ApiResponse<T>(res);
+    } catch (error: any) {
+      if (error.response && !raise_error) {
+        return new ApiResponse<T>(error.response);
+      }
+      throw error;
+    }
+  }
+
+  async get<T = any>({
+    url,
+    headers,
+    params,
+    raise_error = true,
+  }: RequestOptions): Promise<ApiResponse<T>> {
+    return this.requestWrapper<T>(
+      (agent) =>
+        this.instance.get<T>(url, { headers, params, httpsAgent: agent }),
+      raise_error,
+    );
+  }
+
+  async post<T = any>({
+    url,
+    headers,
+    body,
+    raise_error = true,
+  }: RequestOptions): Promise<ApiResponse<T>> {
+    return this.requestWrapper<T>(
+      (agent) =>
+        this.instance.post<T>(url, body, { headers, httpsAgent: agent }),
+      raise_error,
+    );
+  }
+
+  async put<T = any>({
+    url,
+    headers,
+    body,
+    raise_error = true,
+  }: RequestOptions): Promise<ApiResponse<T>> {
+    return this.requestWrapper<T>(
+      (agent) =>
+        this.instance.put<T>(url, body, { headers, httpsAgent: agent }),
+      raise_error,
+    );
+  }
+
+  async patch<T = any>({
+    url,
+    headers,
+    body,
+    raise_error = true,
+  }: RequestOptions): Promise<ApiResponse<T>> {
+    return this.requestWrapper<T>(
+      (agent) =>
+        this.instance.patch<T>(url, body, { headers, httpsAgent: agent }),
+      raise_error,
+    );
+  }
+
+  async delete<T = any>({
+    url,
+    headers,
+    params,
+    raise_error = true,
+  }: RequestOptions): Promise<ApiResponse<T>> {
+    return this.requestWrapper<T>(
+      (agent) =>
+        this.instance.delete<T>(url, { headers, params, httpsAgent: agent }),
+      raise_error,
+    );
+  }
+}
+
+export const apiClient = new ApiClient();
+export type { ApiResponse, RequestOptions };
diff --git a/src/lib/device-cache.ts b/src/lib/device-cache.ts
index 5131bb5..55010a4 100644
--- a/src/lib/device-cache.ts
+++ b/src/lib/device-cache.ts
@@ -1,6 +1,7 @@
 import fs from "fs";
 import os from "os";
 import path from "path";
+import { apiClient } from "./apiClient.js";
 
 const CACHE_DIR = path.join(os.homedir(), ".browserstack", "combined_cache");
 const CACHE_FILE = path.join(CACHE_DIR, "data.json");
@@ -48,7 +49,7 @@ export async function getDevicesAndBrowsers(
     }
   }
 
-  const liveRes = await fetch(URLS[type]);
+  const liveRes = await apiClient.get({ url: URLS[type], raise_error: false });
 
   if (!liveRes.ok) {
     throw new Error(
@@ -56,10 +57,8 @@ export async function getDevicesAndBrowsers(
     );
   }
 
-  const data = await liveRes.json();
-
   cache = {
-    [type]: data,
+    [type]: liveRes.data,
   };
   fs.writeFileSync(CACHE_FILE, JSON.stringify(cache), "utf8");
 
diff --git a/src/lib/get-auth.ts b/src/lib/get-auth.ts
new file mode 100644
index 0000000..074e141
--- /dev/null
+++ b/src/lib/get-auth.ts
@@ -0,0 +1,10 @@
+import { BrowserStackConfig } from "../lib/types.js";
+
+export function getBrowserStackAuth(config: BrowserStackConfig): string {
+  const username = config["browserstack-username"];
+  const accessKey = config["browserstack-access-key"];
+  if (!username || !accessKey) {
+    throw new Error("BrowserStack credentials not set on server.authHeaders");
+  }
+  return `${username}:${accessKey}`;
+}
diff --git a/src/lib/instrumentation.ts b/src/lib/instrumentation.ts
index e6eccb4..59e5924 100644
--- a/src/lib/instrumentation.ts
+++ b/src/lib/instrumentation.ts
@@ -1,5 +1,5 @@
 import logger from "../logger.js";
-import config from "../config.js";
+import { getBrowserStackAuth } from "./get-auth.js";
 import { createRequire } from "module";
 const require = createRequire(import.meta.url);
 const packageJson = require("../../package.json");
@@ -21,12 +21,8 @@ export function trackMCP(
   toolName: string,
   clientInfo: { name?: string; version?: string },
   error?: unknown,
+  config?: any,
 ): void {
-  if (config.DEV_MODE) {
-    logger.info("Tracking MCP is disabled in dev mode");
-    return;
-  }
-
   const instrumentationEndpoint = "https://api.browserstack.com/sdk/v1/event";
   const isSuccess = !error;
   const mcpClient = clientInfo?.name || "unknown";
@@ -58,13 +54,17 @@ export function trackMCP(
       error instanceof Error ? error.constructor.name : "Unknown";
   }
 
+  let authHeader = undefined;
+  if (config) {
+    const authString = getBrowserStackAuth(config);
+    authHeader = `Basic ${Buffer.from(authString).toString("base64")}`;
+  }
+
   axios
     .post(instrumentationEndpoint, event, {
       headers: {
         "Content-Type": "application/json",
-        Authorization: `Basic ${Buffer.from(
-          `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-        ).toString("base64")}`,
+        ...(authHeader ? { Authorization: authHeader } : {}),
       },
       timeout: 2000,
     })
diff --git a/src/lib/local.ts b/src/lib/local.ts
index 8308d5b..0654a01 100644
--- a/src/lib/local.ts
+++ b/src/lib/local.ts
@@ -74,6 +74,8 @@ export async function killExistingBrowserStackLocalProcesses() {
 }
 
 export async function ensureLocalBinarySetup(
+  username: string,
+  password: string,
   localIdentifier?: string,
 ): Promise<void> {
   logger.info(
@@ -104,8 +106,8 @@ export async function ensureLocalBinarySetup(
   // Use a single options object from config and extend with required fields
   const bsLocalArgs: Record<string, any> = {
     ...(config.browserstackLocalOptions || {}),
-    key: config.browserstackAccessKey,
-    username: config.browserstackUsername,
+    key: password,
+    username,
   };
 
   if (localIdentifier) {
diff --git a/src/lib/types.ts b/src/lib/types.ts
new file mode 100644
index 0000000..6de14c2
--- /dev/null
+++ b/src/lib/types.ts
@@ -0,0 +1,4 @@
+export type BrowserStackConfig = {
+  "browserstack-username": string;
+  "browserstack-access-key": string;
+};
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 00cf097..e19532c 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -1,4 +1,5 @@
 import sharp from "sharp";
+import type { ApiResponse } from "./apiClient.js";
 
 export function sanitizeUrlParam(param: string): string {
   // Remove any characters that could be used for command injection
@@ -24,7 +25,10 @@ export async function maybeCompressBase64(base64: string): Promise<string> {
   return compressedBuffer.toString("base64");
 }
 
-export async function assertOkResponse(response: Response, action: string) {
+export async function assertOkResponse(
+  response: Response | ApiResponse,
+  action: string,
+) {
   if (!response.ok) {
     if (response.status === 404) {
       throw new Error(`Invalid session ID for ${action}`);
diff --git a/src/logger.ts b/src/logger.ts
index 8020128..6fb686c 100644
--- a/src/logger.ts
+++ b/src/logger.ts
@@ -1,9 +1,10 @@
 import { pino } from "pino";
 
-let logger: pino.Logger;
+// 1. The actual logger instance, swapped out as needed
+let currentLogger: any;
 
 if (process.env.NODE_ENV === "development") {
-  logger = pino({
+  currentLogger = pino({
     level: "debug",
     transport: {
       targets: [
@@ -23,8 +24,8 @@ if (process.env.NODE_ENV === "development") {
     },
   });
 } else {
-  // NULL logger
-  logger = pino({
+  // Null logger (logs go to /dev/null or NUL)
+  currentLogger = pino({
     level: "info",
     transport: {
       target: "pino/file",
@@ -35,4 +36,24 @@ if (process.env.NODE_ENV === "development") {
   });
 }
 
+// 2. Proxy logger: always delegates to the currentLogger
+const logger: any = new Proxy(
+  {},
+  {
+    get(_target, prop) {
+      // Forward function calls to currentLogger
+      if (typeof currentLogger[prop] === "function") {
+        return (...args: any[]) => currentLogger[prop](...args);
+      }
+      // Forward property gets
+      return currentLogger[prop];
+    },
+  },
+);
+
+// 3. Setter to update the logger instance everywhere
+export function setLogger(customLogger: any): void {
+  currentLogger = customLogger;
+}
+
 export default logger;
diff --git a/src/oninitialized.ts b/src/oninitialized.ts
index a3f2e4f..ec3c74c 100644
--- a/src/oninitialized.ts
+++ b/src/oninitialized.ts
@@ -1,8 +1,7 @@
-import config from "./config.js";
 import { trackMCP } from "./lib/instrumentation.js";
 import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
 
-export function setupOnInitialized(server: McpServer) {
+export function setupOnInitialized(server: McpServer, config?: any) {
   const nodeVersion = process.versions.node;
 
   // Check for Node.js version
@@ -12,13 +11,7 @@ export function setupOnInitialized(server: McpServer) {
     );
   }
 
-  // Check for BrowserStack credentials
-  if (!config.browserstackUsername || !config.browserstackAccessKey) {
-    throw new Error(
-      "BrowserStack credentials are missing. Please provide a valid username and access key.",
-    );
-  }
   server.server.oninitialized = () => {
-    trackMCP("started", server.server.getClientVersion()!);
+    trackMCP("started", server.server.getClientVersion()!, undefined, config);
   };
 }
diff --git a/src/server-factory.ts b/src/server-factory.ts
new file mode 100644
index 0000000..7088720
--- /dev/null
+++ b/src/server-factory.ts
@@ -0,0 +1,87 @@
+import {
+  McpServer,
+  RegisteredTool,
+} from "@modelcontextprotocol/sdk/server/mcp.js";
+import { createRequire } from "module";
+const require = createRequire(import.meta.url);
+const packageJson = require("../package.json");
+import logger from "./logger.js";
+import addSDKTools from "./tools/bstack-sdk.js";
+import addBrowserLiveTools from "./tools/live.js";
+import addAccessibilityTools from "./tools/accessibility.js";
+import addTestManagementTools from "./tools/testmanagement.js";
+import addAppAutomationTools from "./tools/appautomate.js";
+import addFailureLogsTools from "./tools/getFailureLogs.js";
+import addAutomateTools from "./tools/automate.js";
+import addSelfHealTools from "./tools/selfheal.js";
+import addAppLiveTools from "./tools/applive.js";
+import { setupOnInitialized } from "./oninitialized.js";
+import { BrowserStackConfig } from "./lib/types.js";
+
+/**
+ * Wrapper class for BrowserStack MCP Server
+ * Stores a map of registered tools by name
+ */
+export class BrowserStackMcpServer {
+  public server: McpServer;
+  public tools: Record<string, RegisteredTool> = {};
+
+  constructor(private config: BrowserStackConfig) {
+    logger.info(
+      "Creating BrowserStack MCP Server, version %s",
+      packageJson.version,
+    );
+
+    this.server = new McpServer({
+      name: "BrowserStack MCP Server",
+      version: packageJson.version,
+    });
+
+    setupOnInitialized(this.server, this.config);
+    this.registerTools();
+  }
+
+  /**
+   * Calls each tool-adder function and collects their returned tools
+   */
+  private registerTools() {
+    const toolAdders = [
+      addAccessibilityTools,
+      addSDKTools,
+      addAppLiveTools,
+      addBrowserLiveTools,
+      addTestManagementTools,
+      addAppAutomationTools,
+      addFailureLogsTools,
+      addAutomateTools,
+      addSelfHealTools,
+    ];
+
+    toolAdders.forEach((adder) => {
+      // Each adder now returns a Record<string, Tool>
+      const added: Record<string, RegisteredTool> = adder(
+        this.server,
+        this.config,
+      );
+      Object.assign(this.tools, added);
+    });
+  }
+
+  /**
+   * Expose the underlying MCP server instance
+   */
+  public getInstance(): McpServer {
+    return this.server;
+  }
+
+  /**
+   * Get all registered tools
+   */
+  public getTools(): Record<string, RegisteredTool> {
+    return this.tools;
+  }
+
+  public getTool(name: string): RegisteredTool | undefined {
+    return this.tools[name];
+  }
+}
diff --git a/src/tools/accessibility.ts b/src/tools/accessibility.ts
index d7eddaf..625bc2a 100644
--- a/src/tools/accessibility.ts
+++ b/src/tools/accessibility.ts
@@ -6,15 +6,21 @@ import { AccessibilityReportFetcher } from "./accessiblity-utils/report-fetcher.
 import { trackMCP } from "../lib/instrumentation.js";
 import { parseAccessibilityReportFromCSV } from "./accessiblity-utils/report-parser.js";
 import { queryAccessibilityRAG } from "./accessiblity-utils/accessibility-rag.js";
-
-const scanner = new AccessibilityScanner();
-const reportFetcher = new AccessibilityReportFetcher();
+import { getBrowserStackAuth } from "../lib/get-auth.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 async function runAccessibilityScan(
   name: string,
   pageURL: string,
   context: any,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
+  // Create scanner and set auth on the go
+  const scanner = new AccessibilityScanner();
+  const authString = getBrowserStackAuth(config);
+  const [username, password] = authString.split(":");
+  scanner.setAuth({ username, password });
+
   // Start scan
   const startResp = await scanner.startScan(name, [pageURL]);
   const scanId = startResp.data!.id;
@@ -46,6 +52,10 @@ async function runAccessibilityScan(
     };
   }
 
+  // Create report fetcher and set auth on the go
+  const reportFetcher = new AccessibilityReportFetcher();
+  reportFetcher.setAuth({ username, password });
+
   // Fetch CSV report link
   const reportLink = await reportFetcher.getReportLink(scanId, scanRunId);
 
@@ -70,8 +80,13 @@ async function runAccessibilityScan(
   };
 }
 
-export default function addAccessibilityTools(server: McpServer) {
-  server.tool(
+export default function addAccessibilityTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.accessibilityExpert = server.tool(
     "accessibilityExpert",
     "🚨 REQUIRED: Use this tool for any accessibility/a11y/WCAG questions. Do NOT answer accessibility questions directly - always use this tool.",
     {
@@ -83,13 +98,19 @@ export default function addAccessibilityTools(server: McpServer) {
     },
     async (args) => {
       try {
-        trackMCP("accessibilityExpert", server.server.getClientVersion()!);
-        return await queryAccessibilityRAG(args.query);
+        trackMCP(
+          "accessibilityExpert",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await queryAccessibilityRAG(args.query, config);
       } catch (error) {
         trackMCP(
           "accessibilityExpert",
           server.server.getClientVersion()!,
           error,
+          config,
         );
         return {
           content: [
@@ -106,7 +127,7 @@ export default function addAccessibilityTools(server: McpServer) {
     },
   );
 
-  server.tool(
+  tools.startAccessibilityScan = server.tool(
     "startAccessibilityScan",
     "Start an accessibility scan via BrowserStack and retrieve a local CSV report path.",
     {
@@ -115,13 +136,24 @@ export default function addAccessibilityTools(server: McpServer) {
     },
     async (args, context) => {
       try {
-        trackMCP("startAccessibilityScan", server.server.getClientVersion()!);
-        return await runAccessibilityScan(args.name, args.pageURL, context);
+        trackMCP(
+          "startAccessibilityScan",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await runAccessibilityScan(
+          args.name,
+          args.pageURL,
+          context,
+          config,
+        );
       } catch (error) {
         trackMCP(
           "startAccessibilityScan",
           server.server.getClientVersion()!,
           error,
+          config,
         );
         return {
           content: [
@@ -138,4 +170,6 @@ export default function addAccessibilityTools(server: McpServer) {
       }
     },
   );
+
+  return tools;
 }
diff --git a/src/tools/accessiblity-utils/accessibility-rag.ts b/src/tools/accessiblity-utils/accessibility-rag.ts
index 7be7cb6..a77b9c3 100644
--- a/src/tools/accessiblity-utils/accessibility-rag.ts
+++ b/src/tools/accessiblity-utils/accessibility-rag.ts
@@ -1,35 +1,50 @@
-import fetch from "node-fetch";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
 
 export interface RAGChunk {
   url: string;
   content: string;
 }
 
-export async function queryAccessibilityRAG(userQuery: string): Promise<any> {
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
+
+export interface AccessibilityRAGResponse {
+  content: Array<{
+    type: "text";
+    text: string;
+  }>;
+}
+
+export async function queryAccessibilityRAG(
+  userQuery: string,
+  config: BrowserStackConfig,
+): Promise<any> {
   const url = "https://accessibility.browserstack.com/api/tcg-proxy/search";
 
-  const auth = Buffer.from(
-    `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-  ).toString("base64");
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
-  const response = await fetch(url, {
-    method: "POST",
+  const response = await apiClient.post({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
-    body: JSON.stringify({
+    body: {
       query: userQuery,
-    }),
+    },
+    raise_error: false,
   });
 
   if (!response.ok) {
-    const errorText = await response.text();
+    const errorText =
+      typeof response.data === "string"
+        ? response.data
+        : JSON.stringify(response.data);
     throw new Error(`RAG endpoint error: ${response.status} ${errorText}`);
   }
 
-  const responseData = (await response.json()) as any;
+  const responseData = response.data as any;
 
   if (!responseData.success) {
     throw new Error("Something went wrong: " + responseData.message);
@@ -39,8 +54,21 @@ export async function queryAccessibilityRAG(userQuery: string): Promise<any> {
   let parsedData;
   try {
     parsedData = JSON.parse(responseData.data);
-  } catch {
-    throw new Error("Failed to parse RAG response data as JSON");
+  } catch (err) {
+    throw new Error(
+      "Failed to parse RAG response data as JSON: " +
+        (err instanceof Error ? err.message : String(err)),
+    );
+  }
+
+  if (
+    !parsedData ||
+    !parsedData.data ||
+    !Array.isArray(parsedData.data.chunks)
+  ) {
+    throw new Error(
+      "RAG response data is missing expected 'data.chunks' array",
+    );
   }
 
   const chunks: RAGChunk[] = parsedData.data.chunks;
diff --git a/src/tools/accessiblity-utils/report-fetcher.ts b/src/tools/accessiblity-utils/report-fetcher.ts
index 498ea20..b5ad029 100644
--- a/src/tools/accessiblity-utils/report-fetcher.ts
+++ b/src/tools/accessiblity-utils/report-fetcher.ts
@@ -1,5 +1,4 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
 
 interface ReportInitResponse {
   success: true;
@@ -14,34 +13,47 @@ interface ReportResponse {
 }
 
 export class AccessibilityReportFetcher {
-  private auth = {
-    username: config.browserstackUsername,
-    password: config.browserstackAccessKey,
-  };
+  private auth: { username: string; password: string } | undefined;
+
+  public setAuth(auth: { username: string; password: string }): void {
+    this.auth = auth;
+  }
 
   async getReportLink(scanId: string, scanRunId: string): Promise<string> {
     // Initiate CSV link generation
     const initUrl = `https://api-accessibility.browserstack.com/api/website-scanner/v1/scans/${scanId}/scan_runs/issues?scan_run_id=${scanRunId}`;
-    const initResp = await axios.get<ReportInitResponse>(initUrl, {
-      auth: this.auth,
+
+    let basicAuthHeader = undefined;
+    if (this.auth) {
+      const { username, password } = this.auth;
+      basicAuthHeader =
+        "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
+    }
+    const initResp = await apiClient.get({
+      url: initUrl,
+      headers: basicAuthHeader ? { Authorization: basicAuthHeader } : undefined,
     });
-    if (!initResp.data.success) {
+    const initData: ReportInitResponse = initResp.data;
+    if (!initData.success) {
       throw new Error(
-        `Failed to initiate report: ${initResp.data.error || initResp.data.data.message}`,
+        `Failed to initiate report: ${initData.error || initData.data.message}`,
       );
     }
-    const taskId = initResp.data.data.task_id;
+    const taskId = initData.data.task_id;
 
     // Fetch the generated CSV link
     const reportUrl = `https://api-accessibility.browserstack.com/api/website-scanner/v1/scans/${scanId}/scan_runs/issues?task_id=${encodeURIComponent(
       taskId,
     )}`;
-    const reportResp = await axios.get<ReportResponse>(reportUrl, {
-      auth: this.auth,
+    // Use apiClient for the report link request as well
+    const reportResp = await apiClient.get({
+      url: reportUrl,
+      headers: basicAuthHeader ? { Authorization: basicAuthHeader } : undefined,
     });
-    if (!reportResp.data.success) {
-      throw new Error(`Failed to fetch report: ${reportResp.data.error}`);
+    const reportData: ReportResponse = reportResp.data;
+    if (!reportData.success) {
+      throw new Error(`Failed to fetch report: ${reportData.error}`);
     }
-    return reportResp.data.data.reportLink;
+    return reportData.data.reportLink;
   }
 }
diff --git a/src/tools/accessiblity-utils/report-parser.ts b/src/tools/accessiblity-utils/report-parser.ts
index ffef7d6..0510b44 100644
--- a/src/tools/accessiblity-utils/report-parser.ts
+++ b/src/tools/accessiblity-utils/report-parser.ts
@@ -1,4 +1,4 @@
-import fetch from "node-fetch";
+import { apiClient } from "../../lib/apiClient.js";
 import { parse } from "csv-parse/sync";
 
 type SimplifiedAccessibilityIssue = {
@@ -30,9 +30,10 @@ export async function parseAccessibilityReportFromCSV(
   { maxCharacterLength = 5000, nextPage = 0 }: PaginationOptions = {},
 ): Promise<PaginatedResult> {
   // 1) Download & parse
-  const res = await fetch(reportLink);
+  const res = await apiClient.get({ url: reportLink });
   if (!res.ok) throw new Error(`Failed to download report: ${res.statusText}`);
-  const text = await res.text();
+  const text =
+    typeof res.data === "string" ? res.data : JSON.stringify(res.data);
   const all: SimplifiedAccessibilityIssue[] = parse(text, {
     columns: true,
     skip_empty_lines: true,
diff --git a/src/tools/accessiblity-utils/scanner.ts b/src/tools/accessiblity-utils/scanner.ts
index 3c4974e..640da0b 100644
--- a/src/tools/accessiblity-utils/scanner.ts
+++ b/src/tools/accessiblity-utils/scanner.ts
@@ -1,11 +1,12 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
+import { randomUUID } from "node:crypto";
 import logger from "../../logger.js";
 import {
   isLocalURL,
   ensureLocalBinarySetup,
   killExistingBrowserStackLocalProcesses,
 } from "../../lib/local.js";
+import config from "../../config.js";
 
 export interface AccessibilityScanResponse {
   success: boolean;
@@ -20,18 +21,24 @@ export interface AccessibilityScanStatus {
 }
 
 export class AccessibilityScanner {
-  private auth = {
-    username: config.browserstackUsername,
-    password: config.browserstackAccessKey,
-  };
+  private auth: { username: string; password: string } | undefined;
+
+  public setAuth(auth: { username: string; password: string }): void {
+    this.auth = auth;
+  }
 
   async startScan(
     name: string,
     urlList: string[],
   ): Promise<AccessibilityScanResponse> {
+    if (!this.auth?.username || !this.auth?.password) {
+      throw new Error(
+        "BrowserStack credentials are not set for AccessibilityScanner.",
+      );
+    }
     // Check if any URL is local
     const hasLocal = urlList.some(isLocalURL);
-    const localIdentifier = crypto.randomUUID();
+    const localIdentifier = randomUUID();
     const localHosts = new Set(["127.0.0.1", "localhost", "0.0.0.0"]);
     const BS_LOCAL_DOMAIN = "bs-local.com";
 
@@ -41,8 +48,18 @@ export class AccessibilityScanner {
       );
     }
 
+    if (config.REMOTE_MCP && hasLocal) {
+      throw new Error(
+        "Local URLs are not supported in this remote mcp. Please use a public URL.",
+      );
+    }
+
     if (hasLocal) {
-      await ensureLocalBinarySetup(localIdentifier);
+      await ensureLocalBinarySetup(
+        this.auth.username,
+        this.auth.password,
+        localIdentifier,
+      );
     } else {
       await killExistingBrowserStackLocalProcesses();
     }
@@ -79,28 +96,35 @@ export class AccessibilityScanner {
     }
 
     try {
-      const { data } = await axios.post<AccessibilityScanResponse>(
-        "https://api-accessibility.browserstack.com/api/website-scanner/v1/scans",
-        requestBody,
-        { auth: this.auth },
-      );
+      const response = await apiClient.post<AccessibilityScanResponse>({
+        url: "https://api-accessibility.browserstack.com/api/website-scanner/v1/scans",
+        headers: {
+          Authorization:
+            "Basic " +
+            Buffer.from(`${this.auth.username}:${this.auth.password}`).toString(
+              "base64",
+            ),
+          "Content-Type": "application/json",
+        },
+        body: requestBody,
+      });
+      const data = response.data;
       if (!data.success)
         throw new Error(`Unable to start scan: ${data.errors?.join(", ")}`);
       return data;
-    } catch (err) {
-      if (axios.isAxiosError(err) && err.response?.data) {
-        if (err.response.status === 422) {
-          throw new Error(
-            "A scan with this name already exists. please update the name and run again.",
-          );
-        }
-        const msg =
-          (err.response.data as any).error ||
-          (err.response.data as any).message ||
-          err.message;
-        throw new Error(`Failed to start scan: ${msg}`);
+    } catch (err: any) {
+      // apiClient throws generic errors, try to extract message
+      if (err?.response?.status === 422) {
+        throw new Error(
+          "A scan with this name already exists. please update the name and run again.",
+        );
       }
-      throw err;
+      const msg =
+        err?.response?.data?.error ||
+        err?.response?.data?.message ||
+        err?.message ||
+        String(err);
+      throw new Error(`Failed to start scan: ${msg}`);
     }
   }
 
@@ -109,19 +133,23 @@ export class AccessibilityScanner {
     scanRunId: string,
   ): Promise<AccessibilityScanStatus> {
     try {
-      const { data } = await axios.get<AccessibilityScanStatus>(
-        `https://api-accessibility.browserstack.com/api/website-scanner/v1/scans/${scanId}/scan_runs/${scanRunId}/status`,
-        { auth: this.auth },
-      );
+      const response = await apiClient.get<AccessibilityScanStatus>({
+        url: `https://api-accessibility.browserstack.com/api/website-scanner/v1/scans/${scanId}/scan_runs/${scanRunId}/status`,
+        headers: {
+          Authorization:
+            "Basic " +
+            Buffer.from(
+              `${this.auth?.username}:${this.auth?.password}`,
+            ).toString("base64"),
+        },
+      });
+      const data = response.data;
       if (!data.success)
         throw new Error(`Failed to get status: ${data.errors?.join(", ")}`);
       return data;
-    } catch (err) {
-      if (axios.isAxiosError(err) && err.response?.data) {
-        const msg = (err.response.data as any).message || err.message;
-        throw new Error(`Failed to get scan status: ${msg}`);
-      }
-      throw err;
+    } catch (err: any) {
+      const msg = err?.response?.data?.message || err?.message || String(err);
+      throw new Error(`Failed to get scan status: ${msg}`);
     }
   }
 
diff --git a/src/tools/appautomate-utils/appautomate.ts b/src/tools/appautomate-utils/appautomate.ts
index a52e622..eb47f54 100644
--- a/src/tools/appautomate-utils/appautomate.ts
+++ b/src/tools/appautomate-utils/appautomate.ts
@@ -1,8 +1,8 @@
 import fs from "fs";
-import axios from "axios";
-import config from "../../config.js";
 import FormData from "form-data";
+import { apiClient } from "../../lib/apiClient.js";
 import { customFuzzySearch } from "../../lib/fuzzy.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 interface Device {
   device: string;
@@ -124,7 +124,11 @@ export function validateArgs(args: {
 /**
  * Uploads an application file to AppAutomate and returns the app URL
  */
-export async function uploadApp(appPath: string): Promise<string> {
+export async function uploadApp(
+  appPath: string,
+  username: string,
+  password: string,
+): Promise<string> {
   const filePath = appPath;
 
   if (!fs.existsSync(filePath)) {
@@ -134,23 +138,182 @@ export async function uploadApp(appPath: string): Promise<string> {
   const formData = new FormData();
   formData.append("file", fs.createReadStream(filePath));
 
-  const response = await axios.post<UploadResponse>(
-    "https://api-cloud.browserstack.com/app-automate/upload",
-    formData,
-    {
-      headers: {
-        ...formData.getHeaders(),
-      },
-      auth: {
-        username: config.browserstackUsername,
-        password: config.browserstackAccessKey,
-      },
+  const response = await apiClient.post<UploadResponse>({
+    url: "https://api-cloud.browserstack.com/app-automate/upload",
+    headers: {
+      ...formData.getHeaders(),
+      Authorization:
+        "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
     },
-  );
+    body: formData,
+  });
 
   if (response.data.app_url) {
     return response.data.app_url;
   } else {
-    throw new Error(`Failed to upload app: ${response.data}`);
+    throw new Error(`Failed to upload app: ${JSON.stringify(response.data)}`);
+  }
+}
+
+// Helper to upload a file to a given BrowserStack endpoint and return a specific property from the response.
+async function uploadFileToBrowserStack(
+  filePath: string,
+  endpoint: string,
+  responseKey: string,
+  config: BrowserStackConfig,
+): Promise<string> {
+  if (!fs.existsSync(filePath)) {
+    throw new Error(`File not found at path: ${filePath}`);
   }
+
+  const formData = new FormData();
+  formData.append("file", fs.createReadStream(filePath));
+
+  const authHeader =
+    "Basic " +
+    Buffer.from(
+      `${config["browserstack-username"]}:${config["browserstack-access-key"]}`,
+    ).toString("base64");
+
+  const response = await apiClient.post({
+    url: endpoint,
+    headers: {
+      ...formData.getHeaders(),
+      Authorization: authHeader,
+    },
+    body: formData,
+  });
+
+  if (response.data[responseKey]) {
+    return response.data[responseKey];
+  }
+
+  throw new Error(`Failed to upload file: ${JSON.stringify(response.data)}`);
+}
+
+//Uploads an Android app (.apk or .aab) to BrowserStack Espresso endpoint and returns the app_url
+export async function uploadEspressoApp(
+  appPath: string,
+  config: BrowserStackConfig,
+): Promise<string> {
+  return uploadFileToBrowserStack(
+    appPath,
+    "https://api-cloud.browserstack.com/app-automate/espresso/v2/app",
+    "app_url",
+    config,
+  );
+}
+
+//Uploads an Espresso test suite (.apk) to BrowserStack and returns the test_suite_url
+export async function uploadEspressoTestSuite(
+  testSuitePath: string,
+  config: BrowserStackConfig,
+): Promise<string> {
+  return uploadFileToBrowserStack(
+    testSuitePath,
+    "https://api-cloud.browserstack.com/app-automate/espresso/v2/test-suite",
+    "test_suite_url",
+    config,
+  );
+}
+
+//Uploads an iOS app (.ipa) to BrowserStack XCUITest endpoint and returns the app_url
+export async function uploadXcuiApp(
+  appPath: string,
+  config: BrowserStackConfig,
+): Promise<string> {
+  return uploadFileToBrowserStack(
+    appPath,
+    "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/app",
+    "app_url",
+    config,
+  );
+}
+
+//Uploads an XCUITest test suite (.zip) to BrowserStack and returns the test_suite_url
+export async function uploadXcuiTestSuite(
+  testSuitePath: string,
+  config: BrowserStackConfig,
+): Promise<string> {
+  return uploadFileToBrowserStack(
+    testSuitePath,
+    "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/test-suite",
+    "test_suite_url",
+    config,
+  );
+}
+
+// Triggers an Espresso test run on BrowserStack and returns the build_id
+export async function triggerEspressoBuild(
+  app_url: string,
+  test_suite_url: string,
+  devices: string[],
+  project: string,
+): Promise<string> {
+  const auth = {
+    username: process.env.BROWSERSTACK_USERNAME || "",
+    password: process.env.BROWSERSTACK_ACCESS_KEY || "",
+  };
+
+  const response = await apiClient.post({
+    url: "https://api-cloud.browserstack.com/app-automate/espresso/v2/build",
+    headers: {
+      Authorization:
+        "Basic " +
+        Buffer.from(`${auth.username}:${auth.password}`).toString("base64"),
+      "Content-Type": "application/json",
+    },
+    body: {
+      app: app_url,
+      testSuite: test_suite_url,
+      devices,
+      project,
+    },
+  });
+
+  if (response.data.build_id) {
+    return response.data.build_id;
+  }
+
+  throw new Error(
+    `Failed to trigger Espresso build: ${JSON.stringify(response.data)}`,
+  );
+}
+
+// Triggers an XCUITest run on BrowserStack and returns the build_id
+export async function triggerXcuiBuild(
+  app_url: string,
+  test_suite_url: string,
+  devices: string[],
+  project: string,
+  config: BrowserStackConfig,
+): Promise<string> {
+  const auth = {
+    username: config["browserstack-username"],
+    password: config["browserstack-access-key"],
+  };
+
+  const response = await apiClient.post({
+    url: "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build",
+    headers: {
+      Authorization:
+        "Basic " +
+        Buffer.from(`${auth.username}:${auth.password}`).toString("base64"),
+      "Content-Type": "application/json",
+    },
+    body: {
+      app: app_url,
+      testSuite: test_suite_url,
+      devices,
+      project,
+    },
+  });
+
+  if (response.data.build_id) {
+    return response.data.build_id;
+  }
+
+  throw new Error(
+    `Failed to trigger XCUITest build: ${JSON.stringify(response.data)}`,
+  );
 }
diff --git a/src/tools/appautomate-utils/types.ts b/src/tools/appautomate-utils/types.ts
new file mode 100644
index 0000000..16af726
--- /dev/null
+++ b/src/tools/appautomate-utils/types.ts
@@ -0,0 +1,5 @@
+export enum AppTestPlatform {
+  ESPRESSO = "espresso",
+  APPIUM = "appium",
+  XCUITEST = "xcuitest",
+}
diff --git a/src/tools/appautomate.ts b/src/tools/appautomate.ts
index a265e96..22d56d4 100644
--- a/src/tools/appautomate.ts
+++ b/src/tools/appautomate.ts
@@ -2,10 +2,12 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import logger from "../logger.js";
-import config from "../config.js";
+import { getBrowserStackAuth } from "../lib/get-auth.js";
+import { BrowserStackConfig } from "../lib/types.js";
 import { trackMCP } from "../lib/instrumentation.js";
 import { maybeCompressBase64 } from "../lib/utils.js";
 import { remote } from "webdriverio";
+import { AppTestPlatform } from "./appautomate-utils/types.js";
 
 import {
   getDevicesAndBrowsers,
@@ -18,6 +20,12 @@ import {
   resolveVersion,
   validateArgs,
   uploadApp,
+  uploadEspressoApp,
+  uploadEspressoTestSuite,
+  triggerEspressoBuild,
+  uploadXcuiApp,
+  uploadXcuiTestSuite,
+  triggerXcuiBuild,
 } from "./appautomate-utils/appautomate.js";
 
 // Types
@@ -47,11 +55,12 @@ async function takeAppScreenshot(args: {
   desiredPlatformVersion: string;
   appPath: string;
   desiredPhone: string;
+  config: BrowserStackConfig;
 }): Promise<CallToolResult> {
   let driver;
   try {
     validateArgs(args);
-    const { desiredPlatform, desiredPhone, appPath } = args;
+    const { desiredPlatform, desiredPhone, appPath, config } = args;
     let { desiredPlatformVersion } = args;
 
     const platforms = (
@@ -86,8 +95,10 @@ async function takeAppScreenshot(args: {
         `Device "${desiredPhone}" with version ${desiredPlatformVersion} not found.`,
       );
     }
+    const authString = getBrowserStackAuth(config);
+    const [username, password] = authString.split(":");
 
-    const app_url = await uploadApp(appPath);
+    const app_url = await uploadApp(appPath, username, password);
     logger.info(`App uploaded. URL: ${app_url}`);
 
     const capabilities = {
@@ -97,8 +108,8 @@ async function takeAppScreenshot(args: {
       "appium:app": app_url,
       "appium:autoGrantPermissions": true,
       "bstack:options": {
-        userName: config.browserstackUsername,
-        accessKey: config.browserstackAccessKey,
+        userName: username,
+        accessKey: password,
         appiumVersion: "2.0.1",
       },
     };
@@ -143,11 +154,86 @@ async function takeAppScreenshot(args: {
   }
 }
 
-/**
- * Registers the `takeAppScreenshot` tool with the MCP server.
- */
-export default function addAppAutomationTools(server: McpServer) {
-  server.tool(
+//Runs AppAutomate tests on BrowserStack by uploading app and test suite, then triggering a test run.
+async function runAppTestsOnBrowserStack(
+  args: {
+    appPath: string;
+    testSuitePath: string;
+    devices: string[];
+    project: string;
+    detectedAutomationFramework: string;
+  },
+  config: BrowserStackConfig,
+): Promise<CallToolResult> {
+  switch (args.detectedAutomationFramework) {
+    case AppTestPlatform.ESPRESSO: {
+      try {
+        const app_url = await uploadEspressoApp(args.appPath, config);
+        const test_suite_url = await uploadEspressoTestSuite(
+          args.testSuitePath,
+          config,
+        );
+        const build_id = await triggerEspressoBuild(
+          app_url,
+          test_suite_url,
+          args.devices,
+          args.project,
+        );
+
+        return {
+          content: [
+            {
+              type: "text",
+              text: `✅ Espresso run started successfully!\n\n🔧 Build ID: ${build_id}\n🔗 View your build: https://app-automate.browserstack.com/builds/${build_id}`,
+            },
+          ],
+        };
+      } catch (err) {
+        logger.error("Error running App Automate test", err);
+        throw err;
+      }
+    }
+    case AppTestPlatform.XCUITEST: {
+      try {
+        const app_url = await uploadXcuiApp(args.appPath, config);
+        const test_suite_url = await uploadXcuiTestSuite(
+          args.testSuitePath,
+          config,
+        );
+        const build_id = await triggerXcuiBuild(
+          app_url,
+          test_suite_url,
+          args.devices,
+          args.project,
+          config,
+        );
+        return {
+          content: [
+            {
+              type: "text",
+              text: `✅ XCUITest run started successfully!\n\n🔧 Build ID: ${build_id}\n🔗 View your build: https://app-automate.browserstack.com/builds/${build_id}`,
+            },
+          ],
+        };
+      } catch (err) {
+        logger.error("Error running XCUITest App Automate test", err);
+        throw err;
+      }
+    }
+    default:
+      throw new Error(
+        `Unsupported automation framework: ${args.detectedAutomationFramework}. If you need support for this framework, please open an issue at Github`,
+      );
+  }
+}
+
+export default function addAppAutomationTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.takeAppScreenshot = server.tool(
     "takeAppScreenshot",
     "Use this tool to take a screenshot of an app running on a BrowserStack device. This is useful for visual testing and debugging.",
     {
@@ -172,10 +258,20 @@ export default function addAppAutomationTools(server: McpServer) {
     },
     async (args) => {
       try {
-        trackMCP("takeAppScreenshot", server.server.getClientVersion()!);
-        return await takeAppScreenshot(args);
+        trackMCP(
+          "takeAppScreenshot",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await takeAppScreenshot({ ...args, config });
       } catch (error) {
-        trackMCP("takeAppScreenshot", server.server.getClientVersion()!, error);
+        trackMCP(
+          "takeAppScreenshot",
+          server.server.getClientVersion()!,
+          error,
+          config,
+        );
         const errorMessage =
           error instanceof Error ? error.message : "Unknown error";
         return {
@@ -189,4 +285,81 @@ export default function addAppAutomationTools(server: McpServer) {
       }
     },
   );
+
+  tools.runAppTestsOnBrowserStack = server.tool(
+    "runAppTestsOnBrowserStack",
+    "Run AppAutomate tests on BrowserStack by uploading app and test suite. If running from Android Studio or Xcode, the tool will help export app and test files automatically. For other environments, you'll need to provide the paths to your pre-built app and test files.",
+    {
+      appPath: z
+        .string()
+        .describe(
+          "Path to your application file:\n" +
+            "If in development IDE directory:\n" +
+            "• For Android: 'gradle assembleDebug'\n" +
+            "• For iOS:\n" +
+            "  xcodebuild clean -scheme YOUR_SCHEME && \\\n" +
+            "  xcodebuild archive -scheme YOUR_SCHEME -configuration Release -archivePath build/app.xcarchive && \\\n" +
+            "  xcodebuild -exportArchive -archivePath build/app.xcarchive -exportPath build/ipa -exportOptionsPlist exportOptions.plist\n\n" +
+            "If in other directory, provide existing app path",
+        ),
+      testSuitePath: z
+        .string()
+        .describe(
+          "Path to your test suite file:\n" +
+            "If in development IDE directory:\n" +
+            "• For Android: 'gradle assembleAndroidTest'\n" +
+            "• For iOS:\n" +
+            "  xcodebuild test-without-building -scheme YOUR_SCHEME -destination 'generic/platform=iOS' && \\\n" +
+            "  cd ~/Library/Developer/Xcode/DerivedData/*/Build/Products/Debug-iphonesimulator/ && \\\n" +
+            "  zip -r Tests.zip *.xctestrun *-Runner.app\n\n" +
+            "If in other directory, provide existing test file path",
+        ),
+      devices: z
+        .array(z.string())
+        .describe(
+          "List of devices to run the test on, e.g., ['Samsung Galaxy S20-10.0', 'iPhone 12 Pro-16.0'].",
+        ),
+      project: z
+        .string()
+        .optional()
+        .default("BStack-AppAutomate-Suite")
+        .describe("Project name for organizing test runs on BrowserStack."),
+      detectedAutomationFramework: z
+        .string()
+        .describe(
+          "The automation framework used in the project, such as 'espresso' (Android) or 'xcuitest' (iOS).",
+        ),
+    },
+    async (args) => {
+      try {
+        trackMCP(
+          "runAppTestsOnBrowserStack",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await runAppTestsOnBrowserStack(args, config);
+      } catch (error) {
+        trackMCP(
+          "runAppTestsOnBrowserStack",
+          server.server.getClientVersion()!,
+          error,
+          config,
+        );
+        const errorMessage =
+          error instanceof Error ? error.message : "Unknown error";
+        return {
+          content: [
+            {
+              type: "text",
+              text: `Error running App Automate test: ${errorMessage}`,
+            },
+          ],
+          isError: true,
+        };
+      }
+    },
+  );
+
+  return tools;
 }
diff --git a/src/tools/applive-utils/start-session.ts b/src/tools/applive-utils/start-session.ts
index 5ba4b5f..7b7ac8b 100644
--- a/src/tools/applive-utils/start-session.ts
+++ b/src/tools/applive-utils/start-session.ts
@@ -1,14 +1,17 @@
 import logger from "../../logger.js";
-import childProcess from "child_process";
 import {
   getDevicesAndBrowsers,
   BrowserStackProducts,
 } from "../../lib/device-cache.js";
 import { sanitizeUrlParam } from "../../lib/utils.js";
 import { uploadApp } from "./upload-app.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
 import { findDeviceByName } from "./device-search.js";
 import { pickVersion } from "./version-utils.js";
 import { DeviceEntry } from "./types.js";
+import childProcess from "child_process";
+import { BrowserStackConfig } from "../../lib/types.js";
+import envConfig from "../../config.js";
 
 interface StartSessionArgs {
   appPath: string;
@@ -17,12 +20,20 @@ interface StartSessionArgs {
   desiredPlatformVersion: string;
 }
 
+interface StartSessionOptions {
+  config: BrowserStackConfig;
+}
+
 /**
  * Start an App Live session: filter, select, upload, and open.
  */
-export async function startSession(args: StartSessionArgs): Promise<string> {
+export async function startSession(
+  args: StartSessionArgs,
+  options: StartSessionOptions,
+): Promise<string> {
   const { appPath, desiredPlatform, desiredPhone, desiredPlatformVersion } =
     args;
+  const { config } = options;
 
   // 1) Fetch devices for APP_LIVE
   const data = await getDevicesAndBrowsers(BrowserStackProducts.APP_LIVE);
@@ -61,7 +72,9 @@ export async function startSession(args: StartSessionArgs): Promise<string> {
   }
 
   // 6) Upload app
-  const { app_url } = await uploadApp(appPath);
+  const authString = getBrowserStackAuth(config);
+  const [username, password] = authString.split(":");
+  const { app_url } = await uploadApp(appPath, username, password);
   logger.info(`App uploaded: ${app_url}`);
 
   if (!app_url) {
@@ -82,7 +95,10 @@ export async function startSession(args: StartSessionArgs): Promise<string> {
   });
   const launchUrl = `https://app-live.browserstack.com/dashboard#${params.toString()}&device=${deviceParam}`;
 
-  openBrowser(launchUrl);
+  if (!envConfig.REMOTE_MCP) {
+    openBrowser(launchUrl);
+  }
+
   return launchUrl + note;
 }
 
diff --git a/src/tools/applive-utils/upload-app.ts b/src/tools/applive-utils/upload-app.ts
index a6dc756..e370864 100644
--- a/src/tools/applive-utils/upload-app.ts
+++ b/src/tools/applive-utils/upload-app.ts
@@ -1,13 +1,16 @@
-import axios, { AxiosError } from "axios";
+import { apiClient } from "../../lib/apiClient.js";
 import FormData from "form-data";
 import fs from "fs";
-import config from "../../config.js";
 
 interface UploadResponse {
   app_url: string;
 }
 
-export async function uploadApp(filePath: string): Promise<UploadResponse> {
+export async function uploadApp(
+  filePath: string,
+  username: string,
+  password: string,
+): Promise<UploadResponse> {
   if (!fs.existsSync(filePath)) {
     throw new Error(`File not found at path: ${filePath}`);
   }
@@ -16,27 +19,20 @@ export async function uploadApp(filePath: string): Promise<UploadResponse> {
   formData.append("file", fs.createReadStream(filePath));
 
   try {
-    const response = await axios.post<UploadResponse>(
-      "https://api-cloud.browserstack.com/app-live/upload",
-      formData,
-      {
-        headers: {
-          ...formData.getHeaders(),
-        },
-        auth: {
-          username: config.browserstackUsername,
-          password: config.browserstackAccessKey,
-        },
+    const response = await apiClient.post<UploadResponse>({
+      url: "https://api-cloud.browserstack.com/app-live/upload",
+      headers: {
+        ...formData.getHeaders(),
+        Authorization:
+          "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
       },
-    );
+      body: formData,
+    });
 
     return response.data;
-  } catch (error: unknown) {
-    if (error instanceof AxiosError) {
-      throw new Error(
-        `Failed to upload app: ${error.response?.data?.message || error.message}`,
-      );
-    }
-    throw error;
+  } catch (error: any) {
+    const msg =
+      error?.response?.data?.message || error?.message || String(error);
+    throw new Error(`Failed to upload app: ${msg}`);
   }
 }
diff --git a/src/tools/applive.ts b/src/tools/applive.ts
index 28312cd..be8b1d7 100644
--- a/src/tools/applive.ts
+++ b/src/tools/applive.ts
@@ -5,16 +5,20 @@ import fs from "fs";
 import { startSession } from "./applive-utils/start-session.js";
 import logger from "../logger.js";
 import { trackMCP } from "../lib/instrumentation.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 /**
  * Launches an App Live Session on BrowserStack.
  */
-export async function startAppLiveSession(args: {
-  desiredPlatform: string;
-  desiredPlatformVersion: string;
-  appPath: string;
-  desiredPhone: string;
-}): Promise<CallToolResult> {
+export async function startAppLiveSession(
+  args: {
+    desiredPlatform: string;
+    desiredPlatformVersion: string;
+    appPath: string;
+    desiredPhone: string;
+  },
+  config: BrowserStackConfig,
+): Promise<CallToolResult> {
   if (!args.desiredPlatform) {
     throw new Error("You must provide a desiredPlatform.");
   }
@@ -46,12 +50,15 @@ export async function startAppLiveSession(args: {
     throw new Error("The app path does not exist or is not readable.");
   }
 
-  const launchUrl = await startSession({
-    appPath: args.appPath,
-    desiredPlatform: args.desiredPlatform as "android" | "ios",
-    desiredPhone: args.desiredPhone,
-    desiredPlatformVersion: args.desiredPlatformVersion,
-  });
+  const launchUrl = await startSession(
+    {
+      appPath: args.appPath,
+      desiredPlatform: args.desiredPlatform as "android" | "ios",
+      desiredPhone: args.desiredPhone,
+      desiredPlatformVersion: args.desiredPlatformVersion,
+    },
+    { config },
+  );
 
   return {
     content: [
@@ -63,8 +70,13 @@ export async function startAppLiveSession(args: {
   };
 }
 
-export default function addAppLiveTools(server: McpServer) {
-  server.tool(
+export default function addAppLiveTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.runAppLiveSession = server.tool(
     "runAppLiveSession",
     "Use this tool when user wants to manually check their app on a particular mobile device using BrowserStack's cloud infrastructure. Can be used to debug crashes, slow performance, etc.",
     {
@@ -91,11 +103,21 @@ export default function addAppLiveTools(server: McpServer) {
     },
     async (args) => {
       try {
-        trackMCP("runAppLiveSession", server.server.getClientVersion()!);
-        return await startAppLiveSession(args);
+        trackMCP(
+          "runAppLiveSession",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await startAppLiveSession(args, config);
       } catch (error) {
         logger.error("App live session failed: %s", error);
-        trackMCP("runAppLiveSession", server.server.getClientVersion()!, error);
+        trackMCP(
+          "runAppLiveSession",
+          server.server.getClientVersion()!,
+          error,
+          config,
+        );
         return {
           content: [
             {
@@ -109,4 +131,6 @@ export default function addAppLiveTools(server: McpServer) {
       }
     },
   );
+
+  return tools;
 }
diff --git a/src/tools/automate-utils/fetch-screenshots.ts b/src/tools/automate-utils/fetch-screenshots.ts
index eabbc7a..5574f0b 100644
--- a/src/tools/automate-utils/fetch-screenshots.ts
+++ b/src/tools/automate-utils/fetch-screenshots.ts
@@ -1,28 +1,35 @@
-import config from "../../config.js";
 import { assertOkResponse, maybeCompressBase64 } from "../../lib/utils.js";
 import { SessionType } from "../../lib/constants.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
+import { apiClient } from "../../lib/apiClient.js";
 
-//Extracts screenshot URLs from BrowserStack session logs
 async function extractScreenshotUrls(
   sessionId: string,
   sessionType: SessionType,
+  config: BrowserStackConfig,
 ): Promise<string[]> {
-  const credentials = `${config.browserstackUsername}:${config.browserstackAccessKey}`;
-  const auth = Buffer.from(credentials).toString("base64");
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
   const baseUrl = `https://api.browserstack.com/${sessionType === SessionType.Automate ? "automate" : "app-automate"}`;
 
   const url = `${baseUrl}/sessions/${sessionId}/logs`;
-  const response = await fetch(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   await assertOkResponse(response, "Session");
 
-  const text = await response.text();
+  const text =
+    typeof response.data === "string"
+      ? response.data
+      : JSON.stringify(response.data);
 
   const urls: string[] = [];
   const SCREENSHOT_PATTERN = /REQUEST.*GET.*\/screenshot/;
@@ -52,9 +59,9 @@ async function convertUrlsToBase64(
 ): Promise<Array<{ url: string; base64: string }>> {
   const screenshots = await Promise.all(
     urls.map(async (url) => {
-      const response = await fetch(url);
-      const arrayBuffer = await response.arrayBuffer();
-      const base64 = Buffer.from(arrayBuffer).toString("base64");
+      const response = await apiClient.get({ url });
+      // Axios returns response.data as a Buffer for binary data
+      const base64 = Buffer.from(response.data).toString("base64");
 
       // Compress the base64 image if needed
       const compressedBase64 = await maybeCompressBase64(base64);
@@ -73,8 +80,9 @@ async function convertUrlsToBase64(
 export async function fetchAutomationScreenshots(
   sessionId: string,
   sessionType: SessionType = SessionType.Automate,
+  config: BrowserStackConfig,
 ) {
-  const urls = await extractScreenshotUrls(sessionId, sessionType);
+  const urls = await extractScreenshotUrls(sessionId, sessionType, config);
   if (urls.length === 0) {
     return [];
   }
diff --git a/src/tools/automate.ts b/src/tools/automate.ts
index b0f1f73..7fa95be 100644
--- a/src/tools/automate.ts
+++ b/src/tools/automate.ts
@@ -5,16 +5,21 @@ import { fetchAutomationScreenshots } from "./automate-utils/fetch-screenshots.j
 import { SessionType } from "../lib/constants.js";
 import { trackMCP } from "../lib/instrumentation.js";
 import logger from "../logger.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 // Tool function that fetches and processes screenshots from BrowserStack Automate session
-export async function fetchAutomationScreenshotsTool(args: {
-  sessionId: string;
-  sessionType: SessionType;
-}): Promise<CallToolResult> {
+export async function fetchAutomationScreenshotsTool(
+  args: {
+    sessionId: string;
+    sessionType: SessionType;
+  },
+  config: BrowserStackConfig,
+): Promise<CallToolResult> {
   try {
     const screenshots = await fetchAutomationScreenshots(
       args.sessionId,
       args.sessionType,
+      config,
     );
 
     if (screenshots.length === 0) {
@@ -53,8 +58,13 @@ export async function fetchAutomationScreenshotsTool(args: {
 }
 
 //Registers the fetchAutomationScreenshots tool with the MCP server
-export default function addAutomationTools(server: McpServer) {
-  server.tool(
+export default function addAutomationTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.fetchAutomationScreenshots = server.tool(
     "fetchAutomationScreenshots",
     "Fetch and process screenshots from a BrowserStack Automate session",
     {
@@ -70,13 +80,16 @@ export default function addAutomationTools(server: McpServer) {
         trackMCP(
           "fetchAutomationScreenshots",
           server.server.getClientVersion()!,
+          undefined,
+          config,
         );
-        return await fetchAutomationScreenshotsTool(args);
+        return await fetchAutomationScreenshotsTool(args, config);
       } catch (error) {
         trackMCP(
           "fetchAutomationScreenshots",
           server.server.getClientVersion()!,
           error,
+          config,
         );
         const errorMessage =
           error instanceof Error ? error.message : "Unknown error";
@@ -91,4 +104,6 @@ export default function addAutomationTools(server: McpServer) {
       }
     },
   );
+
+  return tools;
 }
diff --git a/src/tools/bstack-sdk.ts b/src/tools/bstack-sdk.ts
index 7e9d723..f2e597e 100644
--- a/src/tools/bstack-sdk.ts
+++ b/src/tools/bstack-sdk.ts
@@ -23,7 +23,8 @@ import {
   formatPercyInstructions,
   getPercyInstructions,
 } from "./sdk-utils/percy/instructions.js";
-
+import { getBrowserStackAuth } from "../lib/get-auth.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 /**
  * BrowserStack SDK hooks into your test framework to seamlessly run tests on BrowserStack.
@@ -35,13 +36,19 @@ export async function bootstrapProjectWithSDK({
   detectedLanguage,
   desiredPlatforms,
   enablePercy,
+  config,
 }: {
   detectedBrowserAutomationFramework: SDKSupportedBrowserAutomationFramework;
   detectedTestingFramework: SDKSupportedTestingFramework;
   detectedLanguage: SDKSupportedLanguage;
   desiredPlatforms: string[];
   enablePercy: boolean;
+  config: BrowserStackConfig;
 }): Promise<CallToolResult> {
+  // Get credentials from config
+  const authString = getBrowserStackAuth(config);
+  const [username, accessKey] = authString.split(":");
+
   // Handle frameworks with unique setup instructions that don't use browserstack.yml
   if (
     detectedBrowserAutomationFramework === "cypress" ||
@@ -51,6 +58,8 @@ export async function bootstrapProjectWithSDK({
       detectedBrowserAutomationFramework,
       detectedTestingFramework,
       detectedLanguage,
+      username,
+      accessKey,
     );
 
     if (enablePercy) {
@@ -78,6 +87,8 @@ export async function bootstrapProjectWithSDK({
   const sdkSetupCommand = getSDKPrefixCommand(
     detectedLanguage,
     detectedTestingFramework,
+    username,
+    accessKey,
   );
 
   const ymlInstructions = generateBrowserStackYMLInstructions(
@@ -90,6 +101,8 @@ export async function bootstrapProjectWithSDK({
       detectedBrowserAutomationFramework,
       detectedTestingFramework,
       detectedLanguage,
+      username,
+      accessKey,
     );
 
   let combinedInstructions = "";
@@ -150,10 +163,15 @@ function formatFinalInstructions(combinedInstructions: string): CallToolResult {
   };
 }
 
-export default function addSDKTools(server: McpServer) {
-  server.tool(
-    "runTestsOnBrowserStack",
-    "Use this tool to get instructions for running tests on BrowserStack and browserstack percy",
+export default function addSDKTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.setupBrowserStackAutomateTests = server.tool(
+    "setupBrowserStackAutomateTests",
+    "Set up and run automated web-based tests on BrowserStack using the BrowserStack SDK. Use for functional or integration tests on BrowserStack, with optional Percy visual testing for supported frameworks. Example prompts: run this test on browserstack; run this test on browserstack with Percy; set up this project for browserstack with Percy. Integrate BrowserStack SDK into your project",
     {
       detectedBrowserAutomationFramework: z
         .nativeEnum(SDKSupportedBrowserAutomationFrameworkEnum)
@@ -190,7 +208,12 @@ export default function addSDKTools(server: McpServer) {
 
     async (args) => {
       try {
-        trackMCP("runTestsOnBrowserStack", server.server.getClientVersion()!);
+        trackMCP(
+          "runTestsOnBrowserStack",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
 
         return await bootstrapProjectWithSDK({
           detectedBrowserAutomationFramework:
@@ -203,12 +226,14 @@ export default function addSDKTools(server: McpServer) {
 
           desiredPlatforms: args.desiredPlatforms,
           enablePercy: args.enablePercy,
+          config,
         });
       } catch (error) {
         trackMCP(
           "runTestsOnBrowserStack",
           server.server.getClientVersion()!,
           error,
+          config,
         );
 
         return {
@@ -224,4 +249,6 @@ export default function addSDKTools(server: McpServer) {
       }
     },
   );
+
+  return tools;
 }
diff --git a/src/tools/failurelogs-utils/app-automate.ts b/src/tools/failurelogs-utils/app-automate.ts
index 7aff74a..85d33a4 100644
--- a/src/tools/failurelogs-utils/app-automate.ts
+++ b/src/tools/failurelogs-utils/app-automate.ts
@@ -1,28 +1,34 @@
-import config from "../../config.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
 import { filterLinesByKeywords, validateLogResponse } from "./utils.js";
-
-const auth = Buffer.from(
-  `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-).toString("base64");
+import { BrowserStackConfig } from "../../lib/types.js";
+import { apiClient } from "../../lib/apiClient.js";
 
 // DEVICE LOGS
 export async function retrieveDeviceLogs(
   sessionId: string,
   buildId: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const url = `https://api.browserstack.com/app-automate/builds/${buildId}/sessions/${sessionId}/deviceLogs`;
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
-  const response = await fetch(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   const validationError = validateLogResponse(response, "device logs");
   if (validationError) return validationError.message!;
 
-  const logText = await response.text();
+  const logText =
+    typeof response.data === "string"
+      ? response.data
+      : JSON.stringify(response.data);
   const logs = filterDeviceFailures(logText);
   return logs.length > 0
     ? `Device Failures (${logs.length} found):\n${JSON.stringify(logs, null, 2)}`
@@ -33,20 +39,28 @@ export async function retrieveDeviceLogs(
 export async function retrieveAppiumLogs(
   sessionId: string,
   buildId: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const url = `https://api.browserstack.com/app-automate/builds/${buildId}/sessions/${sessionId}/appiumlogs`;
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
-  const response = await fetch(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   const validationError = validateLogResponse(response, "Appium logs");
   if (validationError) return validationError.message!;
 
-  const logText = await response.text();
+  const logText =
+    typeof response.data === "string"
+      ? response.data
+      : JSON.stringify(response.data);
   const logs = filterAppiumFailures(logText);
   return logs.length > 0
     ? `Appium Failures (${logs.length} found):\n${JSON.stringify(logs, null, 2)}`
@@ -57,20 +71,28 @@ export async function retrieveAppiumLogs(
 export async function retrieveCrashLogs(
   sessionId: string,
   buildId: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const url = `https://api.browserstack.com/app-automate/builds/${buildId}/sessions/${sessionId}/crashlogs`;
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
-  const response = await fetch(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   const validationError = validateLogResponse(response, "crash logs");
   if (validationError) return validationError.message!;
 
-  const logText = await response.text();
+  const logText =
+    typeof response.data === "string"
+      ? response.data
+      : JSON.stringify(response.data);
   const logs = filterCrashFailures(logText);
   return logs.length > 0
     ? `Crash Failures (${logs.length} found):\n${JSON.stringify(logs, null, 2)}`
diff --git a/src/tools/failurelogs-utils/automate.ts b/src/tools/failurelogs-utils/automate.ts
index e8b5e95..9f2cf29 100644
--- a/src/tools/failurelogs-utils/automate.ts
+++ b/src/tools/failurelogs-utils/automate.ts
@@ -1,33 +1,35 @@
-import config from "../../config.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
 import {
   HarEntry,
   HarFile,
   filterLinesByKeywords,
   validateLogResponse,
 } from "./utils.js";
-
-const auth = Buffer.from(
-  `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-).toString("base64");
+import { BrowserStackConfig } from "../../lib/types.js";
+import { apiClient } from "../../lib/apiClient.js";
 
 // NETWORK LOGS
 export async function retrieveNetworkFailures(
   sessionId: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const url = `https://api.browserstack.com/automate/sessions/${sessionId}/networklogs`;
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
-  const response = await fetch(url, {
-    method: "GET",
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   const validationError = validateLogResponse(response, "network logs");
   if (validationError) return validationError.message!;
 
-  const networklogs: HarFile = await response.json();
+  const networklogs: HarFile = response.data;
   const failureEntries: HarEntry[] = networklogs.log.entries.filter(
     (entry: HarEntry) =>
       entry.response.status === 0 ||
@@ -61,20 +63,28 @@ export async function retrieveNetworkFailures(
 // SESSION LOGS
 export async function retrieveSessionFailures(
   sessionId: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const url = `https://api.browserstack.com/automate/sessions/${sessionId}/logs`;
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
-  const response = await fetch(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   const validationError = validateLogResponse(response, "session logs");
   if (validationError) return validationError.message!;
 
-  const logText = await response.text();
+  const logText =
+    typeof response.data === "string"
+      ? response.data
+      : JSON.stringify(response.data);
   const logs = filterSessionFailures(logText);
   return logs.length > 0
     ? `Session Failures (${logs.length} found):\n${JSON.stringify(logs, null, 2)}`
@@ -84,20 +94,28 @@ export async function retrieveSessionFailures(
 // CONSOLE LOGS
 export async function retrieveConsoleFailures(
   sessionId: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const url = `https://api.browserstack.com/automate/sessions/${sessionId}/consolelogs`;
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
 
-  const response = await fetch(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
     },
+    raise_error: false,
   });
 
   const validationError = validateLogResponse(response, "console logs");
   if (validationError) return validationError.message!;
 
-  const logText = await response.text();
+  const logText =
+    typeof response.data === "string"
+      ? response.data
+      : JSON.stringify(response.data);
   const logs = filterConsoleFailures(logText);
   return logs.length > 0
     ? `Console Failures (${logs.length} found):\n${JSON.stringify(logs, null, 2)}`
diff --git a/src/tools/failurelogs-utils/utils.ts b/src/tools/failurelogs-utils/utils.ts
index 68f617b..3cc8084 100644
--- a/src/tools/failurelogs-utils/utils.ts
+++ b/src/tools/failurelogs-utils/utils.ts
@@ -1,3 +1,5 @@
+import type { ApiResponse } from "../../lib/apiClient.js";
+
 export interface LogResponse {
   logs?: any[];
   message?: string;
@@ -26,7 +28,7 @@ export interface HarEntry {
 }
 
 export function validateLogResponse(
-  response: Response,
+  response: Response | ApiResponse,
   logType: string,
 ): LogResponse | null {
   if (!response.ok) {
diff --git a/src/tools/getFailureLogs.ts b/src/tools/getFailureLogs.ts
index e6e8b7d..6c41477 100644
--- a/src/tools/getFailureLogs.ts
+++ b/src/tools/getFailureLogs.ts
@@ -1,8 +1,8 @@
 import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
-import logger from "../logger.js";
 import { trackMCP } from "../lib/instrumentation.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 import {
   retrieveNetworkFailures,
@@ -26,12 +26,15 @@ type LogType = AutomateLogType | AppAutomateLogType;
 type SessionTypeValues = SessionType;
 
 // Main log fetcher function
-export async function getFailureLogs(args: {
-  sessionId: string;
-  buildId?: string;
-  logTypes: LogType[];
-  sessionType: SessionTypeValues;
-}): Promise<CallToolResult> {
+export async function getFailureLogs(
+  args: {
+    sessionId: string;
+    buildId?: string;
+    logTypes: LogType[];
+    sessionType: SessionTypeValues;
+  },
+  config: BrowserStackConfig,
+): Promise<CallToolResult> {
   const results: CallToolResult["content"] = [];
   const errors: string[] = [];
   let validLogTypes: LogType[] = [];
@@ -97,37 +100,49 @@ export async function getFailureLogs(args: {
     for (const logType of validLogTypes) {
       switch (logType) {
         case AutomateLogType.NetworkLogs: {
-          response = await retrieveNetworkFailures(args.sessionId);
+          response = await retrieveNetworkFailures(args.sessionId, config);
           results.push({ type: "text", text: response });
           break;
         }
 
         case AutomateLogType.SessionLogs: {
-          response = await retrieveSessionFailures(args.sessionId);
+          response = await retrieveSessionFailures(args.sessionId, config);
           results.push({ type: "text", text: response });
           break;
         }
 
         case AutomateLogType.ConsoleLogs: {
-          response = await retrieveConsoleFailures(args.sessionId);
+          response = await retrieveConsoleFailures(args.sessionId, config);
           results.push({ type: "text", text: response });
           break;
         }
 
         case AppAutomateLogType.DeviceLogs: {
-          response = await retrieveDeviceLogs(args.sessionId, args.buildId!);
+          response = await retrieveDeviceLogs(
+            args.sessionId,
+            args.buildId!,
+            config,
+          );
           results.push({ type: "text", text: response });
           break;
         }
 
         case AppAutomateLogType.AppiumLogs: {
-          response = await retrieveAppiumLogs(args.sessionId, args.buildId!);
+          response = await retrieveAppiumLogs(
+            args.sessionId,
+            args.buildId!,
+            config,
+          );
           results.push({ type: "text", text: response });
           break;
         }
 
         case AppAutomateLogType.CrashLogs: {
-          response = await retrieveCrashLogs(args.sessionId, args.buildId!);
+          response = await retrieveCrashLogs(
+            args.sessionId,
+            args.buildId!,
+            config,
+          );
           results.push({ type: "text", text: response });
           break;
         }
@@ -149,8 +164,13 @@ export async function getFailureLogs(args: {
 }
 
 // Register tool with the MCP server
-export default function registerGetFailureLogs(server: McpServer) {
-  server.tool(
+export default function registerGetFailureLogs(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.getFailureLogs = server.tool(
     "getFailureLogs",
     "Fetch various types of logs from a BrowserStack session. Supports both automate and app-automate sessions.",
     {
@@ -185,17 +205,27 @@ export default function registerGetFailureLogs(server: McpServer) {
     },
     async (args) => {
       try {
-        trackMCP("getFailureLogs", server.server.getClientVersion()!);
-        return await getFailureLogs(args);
+        trackMCP(
+          "getFailureLogs",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await getFailureLogs(args, config);
       } catch (error) {
-        const message = error instanceof Error ? error.message : String(error);
-        trackMCP("getFailureLogs", server.server.getClientVersion()!, error);
-        logger.error("Failed to fetch logs: %s", message);
+        trackMCP(
+          "getFailureLogs",
+          server.server.getClientVersion()!,
+          error,
+          config,
+        );
         return {
           content: [
             {
               type: "text",
-              text: `Failed to fetch logs: ${message}`,
+              text: `Failed to fetch failure logs: ${
+                error instanceof Error ? error.message : "Unknown error"
+              }`,
               isError: true,
             },
           ],
@@ -204,4 +234,6 @@ export default function registerGetFailureLogs(server: McpServer) {
       }
     },
   );
+
+  return tools;
 }
diff --git a/src/tools/live-utils/start-session.ts b/src/tools/live-utils/start-session.ts
index 1efb776..04960fa 100644
--- a/src/tools/live-utils/start-session.ts
+++ b/src/tools/live-utils/start-session.ts
@@ -15,13 +15,26 @@ import {
   killExistingBrowserStackLocalProcesses,
 } from "../../lib/local.js";
 
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
+import envConfig from "../../config.js";
+
 /**
  * Prepares local tunnel setup based on URL type
  */
-async function prepareLocalTunnel(url: string): Promise<boolean> {
+async function prepareLocalTunnel(
+  url: string,
+  username: string,
+  password: string,
+): Promise<boolean> {
   const isLocal = isLocalURL(url);
+  if (isLocal && envConfig.REMOTE_MCP) {
+    throw new Error(
+      "Local URLs are not supported in this remote mcp. Please use a public URL.",
+    );
+  }
   if (isLocal) {
-    await ensureLocalBinarySetup();
+    await ensureLocalBinarySetup(username, password);
   } else {
     await killExistingBrowserStackLocalProcesses();
   }
@@ -33,13 +46,24 @@ async function prepareLocalTunnel(url: string): Promise<boolean> {
  */
 export async function startBrowserSession(
   args: DesktopSearchArgs | MobileSearchArgs,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const entry =
     args.platformType === PlatformType.DESKTOP
       ? await filterDesktop(args as DesktopSearchArgs)
       : await filterMobile(args as MobileSearchArgs);
 
-  const isLocal = await prepareLocalTunnel(args.url);
+  // Get credentials from config
+  const authString = getBrowserStackAuth(config);
+  const [username, password] = authString.split(":");
+
+  if (!username || !password) {
+    throw new Error(
+      "BrowserStack credentials are not set. Please configure them in the server settings.",
+    );
+  }
+
+  const isLocal = await prepareLocalTunnel(args.url, username, password);
 
   const url =
     args.platformType === PlatformType.DESKTOP
@@ -49,8 +73,9 @@ export async function startBrowserSession(
           isLocal,
         )
       : buildMobileUrl(args as MobileSearchArgs, entry as MobileEntry, isLocal);
-
-  openBrowser(url);
+  if (!envConfig.REMOTE_MCP) {
+    openBrowser(url);
+  }
   return entry.notes ? `${url}, ${entry.notes}` : url;
 }
 
diff --git a/src/tools/live.ts b/src/tools/live.ts
index 02f9eae..f6fd948 100644
--- a/src/tools/live.ts
+++ b/src/tools/live.ts
@@ -1,10 +1,11 @@
-// File: src/tools/live.ts
 import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
 import { z } from "zod";
 import logger from "../logger.js";
 import { startBrowserSession } from "./live-utils/start-session.js";
 import { PlatformType } from "./live-utils/types.js";
 import { trackMCP } from "../lib/instrumentation.js";
+import { BrowserStackConfig } from "../lib/types.js";
+import globalConfig from "../config.js";
 
 // Define the schema shape
 const LiveArgsShape = {
@@ -41,20 +42,24 @@ const LiveArgsSchema = z.object(LiveArgsShape);
  */
 async function launchDesktopSession(
   args: z.infer<typeof LiveArgsSchema>,
+  config: BrowserStackConfig,
 ): Promise<string> {
   if (!args.desiredBrowser)
     throw new Error("You must provide a desiredBrowser");
   if (!args.desiredBrowserVersion)
     throw new Error("You must provide a desiredBrowserVersion");
 
-  return startBrowserSession({
-    platformType: PlatformType.DESKTOP,
-    url: args.desiredURL,
-    os: args.desiredOS,
-    osVersion: args.desiredOSVersion,
-    browser: args.desiredBrowser,
-    browserVersion: args.desiredBrowserVersion,
-  });
+  return startBrowserSession(
+    {
+      platformType: PlatformType.DESKTOP,
+      url: args.desiredURL,
+      os: args.desiredOS,
+      osVersion: args.desiredOSVersion,
+      browser: args.desiredBrowser,
+      browserVersion: args.desiredBrowserVersion,
+    },
+    config,
+  );
 }
 
 /**
@@ -62,57 +67,83 @@ async function launchDesktopSession(
  */
 async function launchMobileSession(
   args: z.infer<typeof LiveArgsSchema>,
+  config: BrowserStackConfig,
 ): Promise<string> {
   if (!args.desiredDevice) throw new Error("You must provide a desiredDevice");
 
-  return startBrowserSession({
-    platformType: PlatformType.MOBILE,
-    browser: args.desiredBrowser,
-    url: args.desiredURL,
-    os: args.desiredOS,
-    osVersion: args.desiredOSVersion,
-    device: args.desiredDevice,
-  });
+  return startBrowserSession(
+    {
+      platformType: PlatformType.MOBILE,
+      browser: args.desiredBrowser,
+      url: args.desiredURL,
+      os: args.desiredOS,
+      osVersion: args.desiredOSVersion,
+      device: args.desiredDevice,
+    },
+    config,
+  );
 }
 
 /**
  * Handles the core logic for running a browser session
  */
-async function runBrowserSession(rawArgs: any) {
+async function runBrowserSession(rawArgs: any, config: BrowserStackConfig) {
   // Validate and narrow
   const args = LiveArgsSchema.parse(rawArgs);
 
   // Branch desktop vs mobile and delegate
   const launchUrl =
     args.platformType === PlatformType.DESKTOP
-      ? await launchDesktopSession(args)
-      : await launchMobileSession(args);
+      ? await launchDesktopSession(args, config)
+      : await launchMobileSession(args, config);
 
-  return {
-    content: [
+  let response = [
+    {
+      type: "text" as const,
+      text: `✅ Session started. If it didn't open automatically, visit:\n${launchUrl}`,
+    },
+  ];
+
+  if (globalConfig.REMOTE_MCP) {
+    response = [
       {
         type: "text" as const,
-        text: `✅ Session started. If it didn't open automatically, visit:\n${launchUrl}`,
+        text: `✅ To start the session. Click on ${launchUrl}`,
       },
-    ],
+    ];
+  }
+
+  return {
+    content: response,
   };
 }
 
-export default function addBrowserLiveTools(server: McpServer) {
-  server.tool(
+export default function addBrowserLiveTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.runBrowserLiveSession = server.tool(
     "runBrowserLiveSession",
     "Launch a BrowserStack Live session (desktop or mobile).",
     LiveArgsShape,
     async (args) => {
       try {
-        trackMCP("runBrowserLiveSession", server.server.getClientVersion()!);
-        return await runBrowserSession(args);
+        trackMCP(
+          "runBrowserLiveSession",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await runBrowserSession(args, config);
       } catch (error) {
         logger.error("Live session failed: %s", error);
         trackMCP(
           "runBrowserLiveSession",
           server.server.getClientVersion()!,
           error,
+          config,
         );
         return {
           content: [
@@ -127,4 +158,6 @@ export default function addBrowserLiveTools(server: McpServer) {
       }
     },
   );
+
+  return tools;
 }
diff --git a/src/tools/observability.ts b/src/tools/observability.ts
index b5ad127..ae0e8bb 100644
--- a/src/tools/observability.ts
+++ b/src/tools/observability.ts
@@ -4,14 +4,25 @@ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import { getLatestO11YBuildInfo } from "../lib/api.js";
 import { trackMCP } from "../lib/instrumentation.js";
 import logger from "../logger.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 export async function getFailuresInLastRun(
   buildName: string,
   projectName: string,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
-  const buildsData = await getLatestO11YBuildInfo(buildName, projectName);
+  const buildsData = await getLatestO11YBuildInfo(
+    buildName,
+    projectName,
+    config,
+  );
 
-  const observabilityUrl = buildsData.observability_url;
+  if (!buildsData.data) {
+    throw new Error(
+      "No observability URL found in build data, this is likely because the build is not yet available on BrowserStack Observability.",
+    );
+  }
+  const observabilityUrl = buildsData.data.observability_url;
   if (!observabilityUrl) {
     throw new Error(
       "No observability URL found in build data, this is likely because the build is not yet available on BrowserStack Observability.",
@@ -19,13 +30,13 @@ export async function getFailuresInLastRun(
   }
 
   let overview = "No overview available";
-  if (buildsData.unique_errors?.overview?.insight) {
-    overview = buildsData.unique_errors.overview.insight;
+  if (buildsData.data.unique_errors?.overview?.insight) {
+    overview = buildsData.data.unique_errors.overview.insight;
   }
 
   let details = "No error details available";
-  if (buildsData.unique_errors?.top_unique_errors?.length > 0) {
-    details = buildsData.unique_errors.top_unique_errors
+  if (buildsData.data.unique_errors?.top_unique_errors?.length > 0) {
+    details = buildsData.data.unique_errors.top_unique_errors
       .map((error: any) => error.error)
       .filter(Boolean)
       .join("\n");
@@ -41,7 +52,10 @@ export async function getFailuresInLastRun(
   };
 }
 
-export default function addObservabilityTools(server: McpServer) {
+export default function addObservabilityTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
   server.tool(
     "getFailuresInLastRun",
     "Use this tool to debug failures in the last run of the test suite on BrowserStack. Use only when browserstack.yml file is present in the project root.",
@@ -59,14 +73,24 @@ export default function addObservabilityTools(server: McpServer) {
     },
     async (args) => {
       try {
-        trackMCP("getFailuresInLastRun", server.server.getClientVersion()!);
-        return await getFailuresInLastRun(args.buildName, args.projectName);
+        trackMCP(
+          "getFailuresInLastRun",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await getFailuresInLastRun(
+          args.buildName,
+          args.projectName,
+          config,
+        );
       } catch (error) {
         logger.error("Failed to get failures in the last run: %s", error);
         trackMCP(
           "getFailuresInLastRun",
           server.server.getClientVersion()!,
           error,
+          config,
         );
         return {
           content: [
diff --git a/src/tools/sdk-utils/commands.ts b/src/tools/sdk-utils/commands.ts
index 6865551..f257347 100644
--- a/src/tools/sdk-utils/commands.ts
+++ b/src/tools/sdk-utils/commands.ts
@@ -7,6 +7,7 @@ const JAVA_FRAMEWORK_MAP: Record<string, string> = {
   junit5: "junit5",
   junit4: "junit4",
   cucumber: "cucumber-testng",
+  serenity: "serenity",
 };
 
 // Common Gradle setup instructions (platform-independent)
@@ -25,6 +26,8 @@ const GRADLE_SETUP_INSTRUCTIONS = `
 export function getSDKPrefixCommand(
   language: SDKSupportedLanguage,
   framework: string,
+  username: string,
+  accessKey: string,
 ): string {
   switch (language) {
     case "nodejs":
@@ -36,7 +39,7 @@ npm i -D browserstack-node-sdk@latest
 ---STEP---
 Run the following command to setup browserstack sdk:
 \`\`\`bash
-npx setup --username ${process.env.BROWSERSTACK_USERNAME} --key ${process.env.BROWSERSTACK_ACCESS_KEY}
+npx setup --username ${username} --key ${accessKey}
 \`\`\`
 ---STEP---
 Edit the browserstack.yml file that was created in the project root to add your desired platforms and browsers.`;
@@ -50,8 +53,8 @@ Edit the browserstack.yml file that was created in the project root to add your
         : `mvn archetype:generate -B -DarchetypeGroupId=com.browserstack \\
 -DarchetypeArtifactId=browserstack-sdk-archetype-integrate -DarchetypeVersion=1.0 \\
 -DgroupId=com.browserstack -DartifactId=browserstack-sdk-archetype-integrate -Dversion=1.0 \\
--DBROWSERSTACK_USERNAME="${process.env.BROWSERSTACK_USERNAME}" \\
--DBROWSERSTACK_ACCESS_KEY="${process.env.BROWSERSTACK_ACCESS_KEY}" \\
+-DBROWSERSTACK_USERNAME="${username}" \\
+-DBROWSERSTACK_ACCESS_KEY="${accessKey}" \\
 -DBROWSERSTACK_FRAMEWORK="${mavenFramework}"`;
 
       const platformLabel = isWindows ? "Windows" : "macOS/Linux";
diff --git a/src/tools/sdk-utils/constants.ts b/src/tools/sdk-utils/constants.ts
index 468a9f7..5149e41 100644
--- a/src/tools/sdk-utils/constants.ts
+++ b/src/tools/sdk-utils/constants.ts
@@ -1,11 +1,10 @@
 import { ConfigMapping } from "./types.js";
-import config from "../../config.js";
 
 /**
  * ---------- PYTHON INSTRUCTIONS ----------
  */
 
-const pythonInstructions = `
+const pythonInstructions = (username: string, accessKey: string) => `
 ---STEP---
 
 Install the BrowserStack SDK:
@@ -17,7 +16,7 @@ python3 -m pip install browserstack-sdk
 
 Setup the BrowserStack SDK with your credentials:
 \`\`\`bash
-browserstack-sdk setup --username "${config.browserstackUsername}" --key "${config.browserstackAccessKey}"
+browserstack-sdk setup --username "${username}" --key "${accessKey}"
 \`\`\`
 
 ---STEP---
@@ -28,10 +27,12 @@ browserstack-sdk python <path-to-test-file>
 \`\`\`
 `;
 
-const generatePythonFrameworkInstructions = (framework: string) => `
+const generatePythonFrameworkInstructions =
+  (framework: string) => (username: string, accessKey: string) => `
 ---STEP---
 
 Install the BrowserStack SDK:
+
 \`\`\`bash
 python3 -m pip install browserstack-sdk
 \`\`\`
@@ -40,7 +41,7 @@ python3 -m pip install browserstack-sdk
 
 Setup the BrowserStack SDK with framework-specific configuration:
 \`\`\`bash
-browserstack-sdk setup --framework "${framework}" --username "${config.browserstackUsername}" --key "${config.browserstackAccessKey}"
+browserstack-sdk setup --framework "${framework}" --username "${username}" --key "${accessKey}"
 \`\`\`
 
 ---STEP---
@@ -62,7 +63,7 @@ const pytestInstructions = generatePythonFrameworkInstructions("pytest");
 const argsInstruction =
   '<argLine>-javaagent:"${com.browserstack:browserstack-java-sdk:jar}"</argLine>';
 
-const javaInstructions = `
+const javaInstructions = (username: string, accessKey: string) => `
 ---STEP---
 
 Add the BrowserStack Java SDK dependency to your \`pom.xml\`:
@@ -88,8 +89,8 @@ dependencies {
 
 Export your BrowserStack credentials as environment variables:
 \`\`\`bash
-export BROWSERSTACK_USERNAME=${config.browserstackUsername}
-export BROWSERSTACK_ACCESS_KEY=${config.browserstackAccessKey}
+export BROWSERSTACK_USERNAME=${username}
+export BROWSERSTACK_ACCESS_KEY=${accessKey}
 \`\`\`
 
 ---STEP---
@@ -105,11 +106,68 @@ gradle clean test
 \`\`\`
 `;
 
+const serenityInstructions = (username: string, accessKey: string) => `
+---STEP---
+
+Set BrowserStack credentials as environment variables:
+For macOS/Linux:
+\`\`\`bash
+export BROWSERSTACK_USERNAME=${username}
+export BROWSERSTACK_ACCESS_KEY=${accessKey}
+\`\`\`
+
+For Windows Command Prompt:
+\`\`\`cmd
+set BROWSERSTACK_USERNAME=${username}
+set BROWSERSTACK_ACCESS_KEY=${accessKey}
+\`\`\`
+
+---STEP---
+
+Add serenity-browserstack dependency in pom.xml:
+Add the following dependency to your pom.xml file and save it:
+\`\`\`xml
+<dependency>
+  <groupId>net.serenity-bdd</groupId>
+  <artifactId>serenity-browserstack</artifactId>
+  <version>3.3.4</version>
+</dependency>
+\`\`\`
+
+---STEP---
+
+Set up serenity.conf file:
+Create or update your serenity.conf file in the project root with the following configuration:
+\`\`\`
+webdriver {
+  driver = remote
+  remote.url = "https://hub.browserstack.com/wd/hub"
+}
+browserstack.user="${username}"
+browserstack.key="${accessKey}"
+\`\`\`
+
+---STEP---
+
+Run your Serenity tests:
+You can continue running your tests as you normally would. For example:
+
+Using Maven:
+\`\`\`bash
+mvn clean verify
+\`\`\`
+
+Using Gradle:
+\`\`\`bash
+gradle clean test
+\`\`\`
+`;
+
 /**
  * ---------- CSharp INSTRUCTIONS ----------
  */
 
-const csharpCommonInstructions = `
+const csharpCommonInstructions = (username: string, accessKey: string) => `
 ---STEP---
 
 Install BrowserStack TestAdapter NuGet package:
@@ -128,7 +186,7 @@ dotnet build
 
 Set up BrowserStack SDK with your credentials:
 \`\`\`bash
-dotnet browserstack-sdk setup --userName ${config.browserstackUsername} --accessKey ${config.browserstackAccessKey}
+dotnet browserstack-sdk setup --userName ${username} --accessKey ${accessKey}
 \`\`\`
 
 ---STEP---
@@ -144,7 +202,7 @@ fi
 
 ---STEP---
 
-macOS (Apple Silicon) setup (required only if arm64 detected):
+macOS (Apple Silicon) setup (Strictly follow if arm64 detected):
 Install the x64 version of .NET for BrowserStack compatibility.
 
 - Check your current .NET version:
@@ -153,6 +211,7 @@ Install the x64 version of .NET for BrowserStack compatibility.
   \`\`\`
 
 - Ensure the path exists strictly; if not, create it first and then run the setup:
+  This automatically installs the x64 version of .NET in the specified path. No need to install it from external sources.
   \`\`\`bash
   sudo dotnet browserstack-sdk setup-dotnet --dotnet-path "<your-chosen-path>" --dotnet-version "<your-dotnet-version>"
   \`\`\`
@@ -161,7 +220,7 @@ Install the x64 version of .NET for BrowserStack compatibility.
 ---STEP---
 
 Run the tests:
-- For macOS (Apple Silicon), use the full path:
+- For macOS (Apple Silicon), use the full path where the x64 version of .NET is installed:
   \`\`\`bash
   <your-chosen-path>/dotnet browserstack-sdk
   \`\`\`
@@ -171,7 +230,10 @@ Run the tests:
   \`\`\`
 `;
 
-const csharpPlaywrightCommonInstructions = `
+const csharpPlaywrightCommonInstructions = (
+  username: string,
+  accessKey: string,
+) => `
 ---STEP---
 
 Install BrowserStack TestAdapter NuGet package:
@@ -190,7 +252,7 @@ dotnet build
 
 Set up BrowserStack SDK with your credentials:
 \`\`\`bash
-dotnet browserstack-sdk setup --userName ${config.browserstackUsername} --accessKey ${config.browserstackAccessKey}
+dotnet browserstack-sdk setup --userName ${username} --accessKey ${accessKey}
 \`\`\`
 
 ---STEP---
@@ -221,6 +283,7 @@ Install the x64 version of .NET for compatibility with BrowserStack.
   \`\`\`
 
 - Ensure the path exists strictly; if not, create it first and then run the setup:
+  This automatically installs the x64 version of .NET in the specified path. No need to install it from external sources.
   \`\`\`bash
   sudo dotnet browserstack-sdk setup-dotnet --dotnet-path "<your-chosen-path>" --dotnet-version "<your-dotnet-version>"
   \`\`\`
@@ -250,7 +313,7 @@ Run the tests:
  * ---------- NODEJS INSTRUCTIONS ----------
  */
 
-const nodejsInstructions = `
+const nodejsInstructions = (username: string, accessKey: string) => `
 ---STEP---
 
 Ensure \`browserstack-node-sdk\` is present in package.json with the latest version:
@@ -271,13 +334,17 @@ Add new scripts to package.json for running tests on BrowserStack:
 
 Export BrowserStack credentials as environment variables:
 Set the following environment variables before running tests.
+\`\`\`bash
+export BROWSERSTACK_USERNAME=${username}
+export BROWSERSTACK_ACCESS_KEY=${accessKey}
+\`\`\`
 `;
 
 /**
  * ---------- EXPORT CONFIG ----------
  */
 
-const webdriverioInstructions = `
+const webdriverioInstructions = (username: string, accessKey: string) => `
 ---STEP---
 
 Set BrowserStack Credentials:
@@ -285,14 +352,14 @@ Export your BrowserStack username and access key as environment variables.
 
 For macOS/Linux:
 \`\`\`bash
-export BROWSERSTACK_USERNAME= ${config.browserstackUsername}
-export BROWSERSTACK_ACCESS_KEY= ${config.browserstackAccessKey}
+export BROWSERSTACK_USERNAME=${username}
+export BROWSERSTACK_ACCESS_KEY=${accessKey}
 \`\`\`
 
 For Windows PowerShell:
 \`\`\`powershell
-$env:BROWSERSTACK_USERNAME=${config.browserstackUsername}
-$env:BROWSERSTACK_ACCESS_KEY=${config.browserstackAccessKey}
+$env:BROWSERSTACK_USERNAME=${username}
+$env:BROWSERSTACK_ACCESS_KEY=${accessKey}
 \`\`\`
 
 ---STEP---
@@ -383,7 +450,7 @@ Run your tests:
 You can now run your tests on BrowserStack using your standard WebdriverIO command.
 `;
 
-const cypressInstructions = `
+const cypressInstructions = (username: string, accessKey: string) => `
 ---STEP---
 
 Install the BrowserStack Cypress CLI:
@@ -412,8 +479,8 @@ Open the generated \`browserstack.json\` file and update it with your BrowserSta
 \`\`\`json
 {
   "auth": {
-    "username": "${config.browserstackUsername}",
-    "access_key": "${config.browserstackAccessKey}"
+    "username": "${username}",
+    "access_key": "${accessKey}"
   },
   "browsers": [
     {
@@ -478,6 +545,7 @@ export const SUPPORTED_CONFIGURATIONS: ConfigMapping = {
       cucumber: { instructions: javaInstructions },
       junit4: { instructions: javaInstructions },
       junit5: { instructions: javaInstructions },
+      serenity: { instructions: serenityInstructions },
     },
   },
   csharp: {
@@ -489,6 +557,8 @@ export const SUPPORTED_CONFIGURATIONS: ConfigMapping = {
       xunit: { instructions: csharpCommonInstructions },
       nunit: { instructions: csharpCommonInstructions },
       mstest: { instructions: csharpCommonInstructions },
+      specflow: { instructions: csharpCommonInstructions },
+      reqnroll: { instructions: csharpCommonInstructions },
     },
   },
   nodejs: {
diff --git a/src/tools/sdk-utils/instructions.ts b/src/tools/sdk-utils/instructions.ts
index 902bed9..d98c872 100644
--- a/src/tools/sdk-utils/instructions.ts
+++ b/src/tools/sdk-utils/instructions.ts
@@ -10,6 +10,8 @@ export const getInstructionsForProjectConfiguration = (
   detectedBrowserAutomationFramework: SDKSupportedBrowserAutomationFramework,
   detectedTestingFramework: SDKSupportedTestingFramework,
   detectedLanguage: SDKSupportedLanguage,
+  username: string,
+  accessKey: string,
 ) => {
   const configuration = SUPPORTED_CONFIGURATIONS[detectedLanguage];
 
@@ -33,9 +35,11 @@ export const getInstructionsForProjectConfiguration = (
     );
   }
 
-  return configuration[detectedBrowserAutomationFramework][
-    detectedTestingFramework
-  ].instructions;
+  const instructionFunction =
+    configuration[detectedBrowserAutomationFramework][detectedTestingFramework]
+      .instructions;
+
+  return instructionFunction(username, accessKey);
 };
 
 export function generateBrowserStackYMLInstructions(
@@ -46,10 +50,10 @@ export function generateBrowserStackYMLInstructions(
 # ======================
 # BrowserStack Reporting
 # ======================
-# A single name for your project to organize all your tests. This is required for Percy.
-projectName: BrowserStack Sample
-# A name for the group of tests you are running
-buildName: mcp-run
+# Project and build names help organize your test runs in BrowserStack dashboard and Percy.
+# TODO: Replace these sample values with your actual project details
+projectName: Sample Project
+buildName: Sample Build
 
 # =======================================
 # Platforms (Browsers / Devices to test)
diff --git a/src/tools/sdk-utils/percy/constants.ts b/src/tools/sdk-utils/percy/constants.ts
index 63a3eae..39dea6a 100644
--- a/src/tools/sdk-utils/percy/constants.ts
+++ b/src/tools/sdk-utils/percy/constants.ts
@@ -159,6 +159,7 @@ export const PERCY_INSTRUCTIONS: PercyConfigMapping = {
       cucumber: { script_updates: javaSeleniumInstructions },
       junit4: { script_updates: javaSeleniumInstructions },
       junit5: { script_updates: javaSeleniumInstructions },
+      serenity: { script_updates: javaSeleniumInstructions },
     },
   },
   csharp: {
diff --git a/src/tools/sdk-utils/types.ts b/src/tools/sdk-utils/types.ts
index 3e3ed44..e30449e 100644
--- a/src/tools/sdk-utils/types.ts
+++ b/src/tools/sdk-utils/types.ts
@@ -28,10 +28,13 @@ export enum SDKSupportedTestingFrameworkEnum {
   junit4 = "junit4",
   junit5 = "junit5",
   testng = "testng",
+  serenity = "serenity",
   cypress = "cypress",
   nunit = "nunit",
   mstest = "mstest",
   xunit = "xunit",
+  specflow = "specflow",
+  reqnroll = "reqnroll",
 }
 export type SDKSupportedTestingFramework =
   keyof typeof SDKSupportedTestingFrameworkEnum;
@@ -42,7 +45,10 @@ export type ConfigMapping = Record<
     Record<
       SDKSupportedBrowserAutomationFrameworkEnum,
       Partial<
-        Record<SDKSupportedTestingFrameworkEnum, { instructions: string }>
+        Record<
+          SDKSupportedTestingFrameworkEnum,
+          { instructions: (username: string, accessKey: string) => string }
+        >
       >
     >
   >
diff --git a/src/tools/selfheal-utils/selfheal.ts b/src/tools/selfheal-utils/selfheal.ts
index f9b837b..a1464cd 100644
--- a/src/tools/selfheal-utils/selfheal.ts
+++ b/src/tools/selfheal-utils/selfheal.ts
@@ -1,5 +1,4 @@
 import { assertOkResponse } from "../../lib/utils.js";
-import config from "../../config.js";
 
 interface SelectorMapping {
   originalSelector: string;
@@ -10,12 +9,20 @@ interface SelectorMapping {
   };
 }
 
-export async function getSelfHealSelectors(sessionId: string) {
-  const credentials = `${config.browserstackUsername}:${config.browserstackAccessKey}`;
-  const auth = Buffer.from(credentials).toString("base64");
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
+import { apiClient } from "../../lib/apiClient.js";
+
+export async function getSelfHealSelectors(
+  sessionId: string,
+  config: BrowserStackConfig,
+) {
+  const authString = getBrowserStackAuth(config);
+  const auth = Buffer.from(authString).toString("base64");
   const url = `https://api.browserstack.com/automate/sessions/${sessionId}/logs`;
 
-  const response = await fetch(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
       "Content-Type": "application/json",
       Authorization: `Basic ${auth}`,
@@ -23,7 +30,10 @@ export async function getSelfHealSelectors(sessionId: string) {
   });
 
   await assertOkResponse(response, "session logs");
-  const logText = await response.text();
+  const logText =
+    typeof response.data === "string"
+      ? response.data
+      : JSON.stringify(response.data);
   return extractHealedSelectors(logText);
 }
 
diff --git a/src/tools/selfheal.ts b/src/tools/selfheal.ts
index 83cd568..ee67668 100644
--- a/src/tools/selfheal.ts
+++ b/src/tools/selfheal.ts
@@ -4,13 +4,15 @@ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import { getSelfHealSelectors } from "./selfheal-utils/selfheal.js";
 import logger from "../logger.js";
 import { trackMCP } from "../lib/instrumentation.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 // Tool function that fetches self-healing selectors
-export async function fetchSelfHealSelectorTool(args: {
-  sessionId: string;
-}): Promise<CallToolResult> {
+export async function fetchSelfHealSelectorTool(
+  args: { sessionId: string },
+  config: BrowserStackConfig,
+): Promise<CallToolResult> {
   try {
-    const selectors = await getSelfHealSelectors(args.sessionId);
+    const selectors = await getSelfHealSelectors(args.sessionId, config);
     return {
       content: [
         {
@@ -28,8 +30,13 @@ export async function fetchSelfHealSelectorTool(args: {
 }
 
 // Registers the fetchSelfHealSelector tool with the MCP server
-export default function addSelfHealTools(server: McpServer) {
-  server.tool(
+export default function addSelfHealTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.fetchSelfHealedSelectors = server.tool(
     "fetchSelfHealedSelectors",
     "Retrieves AI-generated, self-healed selectors for a BrowserStack Automate session to resolve flaky tests caused by dynamic DOM changes.",
     {
@@ -37,13 +44,19 @@ export default function addSelfHealTools(server: McpServer) {
     },
     async (args) => {
       try {
-        trackMCP("fetchSelfHealedSelectors", server.server.getClientVersion()!);
-        return await fetchSelfHealSelectorTool(args);
+        trackMCP(
+          "fetchSelfHealedSelectors",
+          server.server.getClientVersion()!,
+          undefined,
+          config,
+        );
+        return await fetchSelfHealSelectorTool(args, config);
       } catch (error) {
         trackMCP(
           "fetchSelfHealedSelectors",
           server.server.getClientVersion()!,
           error,
+          config,
         );
         const errorMessage =
           error instanceof Error ? error.message : "Unknown error";
@@ -58,4 +71,6 @@ export default function addSelfHealTools(server: McpServer) {
       }
     },
   );
+
+  return tools;
 }
diff --git a/src/tools/testmanagement-utils/TCG-utils/api.ts b/src/tools/testmanagement-utils/TCG-utils/api.ts
index 8fb836d..4298add 100644
--- a/src/tools/testmanagement-utils/TCG-utils/api.ts
+++ b/src/tools/testmanagement-utils/TCG-utils/api.ts
@@ -1,4 +1,4 @@
-import axios from "axios";
+import { apiClient } from "../../../lib/apiClient.js";
 import {
   TCG_TRIGGER_URL,
   TCG_POLL_URL,
@@ -12,17 +12,20 @@ import {
   CreateTestCasesFromFileArgs,
 } from "./types.js";
 import { createTestCasePayload } from "./helpers.js";
-import config from "../../../config.js";
+import { getBrowserStackAuth } from "../../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../../lib/types.js";
 
 /**
  * Fetch default and custom form fields for a project.
  */
 export async function fetchFormFields(
   projectId: string,
+  config: BrowserStackConfig,
 ): Promise<{ default_fields: any; custom_fields: any }> {
-  const res = await axios.get(FORM_FIELDS_URL(projectId), {
+  const res = await apiClient.get({
+    url: FORM_FIELDS_URL(projectId),
     headers: {
-      "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
+      "API-TOKEN": getBrowserStackAuth(config),
     },
   });
   return res.data;
@@ -37,10 +40,16 @@ export async function triggerTestCaseGeneration(
   folderId: string,
   projectId: string,
   source: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
-  const res = await axios.post(
-    TCG_TRIGGER_URL,
-    {
+  const res = await apiClient.post({
+    url: TCG_TRIGGER_URL,
+    headers: {
+      "API-TOKEN": getBrowserStackAuth(config),
+      "Content-Type": "application/json",
+      "request-source": source,
+    },
+    body: {
       document,
       documentId,
       folderId,
@@ -48,16 +57,9 @@ export async function triggerTestCaseGeneration(
       source,
       webhookUrl: `https://test-management.browserstack.com/api/v1/projects/${projectId}/folder/${folderId}/webhooks/tcg`,
     },
-    {
-      headers: {
-        "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-        "Content-Type": "application/json",
-        "request-source": source,
-      },
-    },
-  );
+  });
   if (res.status !== 200) {
-    throw new Error(`Trigger failed: ${res.statusText}`);
+    throw new Error(`Trigger failed: ${res.statusText || res.status}`);
   }
   return res.data["x-bstack-traceRequestId"];
 }
@@ -71,26 +73,25 @@ export async function fetchTestCaseDetails(
   projectId: string,
   testCaseIds: string[],
   source: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   if (testCaseIds.length === 0) {
     throw new Error("No testCaseIds provided to fetchTestCaseDetails");
   }
-  const res = await axios.post(
-    FETCH_DETAILS_URL,
-    {
+  const res = await apiClient.post({
+    url: FETCH_DETAILS_URL,
+    headers: {
+      "API-TOKEN": getBrowserStackAuth(config),
+      "request-source": source,
+      "Content-Type": "application/json",
+    },
+    body: {
       document_id: documentId,
       folder_id: folderId,
       project_id: projectId,
       test_case_ids: testCaseIds,
     },
-    {
-      headers: {
-        "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-        "request-source": source,
-        "Content-Type": "application/json",
-      },
-    },
-  );
+  });
   if (res.data.data.success !== true) {
     throw new Error(`Fetch details failed: ${res.data.data.message}`);
   }
@@ -102,6 +103,7 @@ export async function fetchTestCaseDetails(
  */
 export async function pollTestCaseDetails(
   traceRequestId: string,
+  config: BrowserStackConfig,
 ): Promise<Record<string, any>> {
   const detailMap: Record<string, any> = {};
   let done = false;
@@ -110,17 +112,13 @@ export async function pollTestCaseDetails(
     // add a bit of jitter to avoid synchronized polling storms
     await new Promise((r) => setTimeout(r, 10000 + Math.random() * 5000));
 
-    const poll = await axios.post(
-      `${TCG_POLL_URL}?x-bstack-traceRequestId=${encodeURIComponent(
-        traceRequestId,
-      )}`,
-      {},
-      {
-        headers: {
-          "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-        },
+    const poll = await apiClient.post({
+      url: `${TCG_POLL_URL}?x-bstack-traceRequestId=${encodeURIComponent(traceRequestId)}`,
+      headers: {
+        "API-TOKEN": getBrowserStackAuth(config),
       },
-    );
+      body: {},
+    });
 
     if (!poll.data.data.success) {
       throw new Error(`Polling failed: ${poll.data.data.message}`);
@@ -153,6 +151,7 @@ export async function pollScenariosTestDetails(
   context: any,
   documentId: number,
   source: string,
+  config: BrowserStackConfig,
 ): Promise<Record<string, Scenario>> {
   const { folderId, projectReferenceId } = args;
   const scenariosMap: Record<string, Scenario> = {};
@@ -163,19 +162,17 @@ export async function pollScenariosTestDetails(
   await new Promise<void>((resolve, reject) => {
     const intervalId = setInterval(async () => {
       try {
-        const poll = await axios.post(
-          `${TCG_POLL_URL}?x-bstack-traceRequestId=${encodeURIComponent(traceId)}`,
-          {},
-          {
-            headers: {
-              "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-            },
+        const poll = await apiClient.post({
+          url: `${TCG_POLL_URL}?x-bstack-traceRequestId=${encodeURIComponent(traceId)}`,
+          headers: {
+            "API-TOKEN": getBrowserStackAuth(config),
           },
-        );
+          body: {},
+        });
 
         if (poll.status !== 200) {
           clearInterval(intervalId);
-          reject(new Error(`Polling error: ${poll.statusText}`));
+          reject(new Error(`Polling error: ${poll.statusText || poll.status}`));
           return;
         }
 
@@ -212,8 +209,9 @@ export async function pollScenariosTestDetails(
                 projectReferenceId,
                 ids,
                 source,
+                config,
               );
-              detailPromises.push(pollTestCaseDetails(reqId));
+              detailPromises.push(pollTestCaseDetails(reqId, config));
 
               scenariosMap[sc.id] ||= {
                 id: sc.id,
@@ -275,6 +273,7 @@ export async function bulkCreateTestCases(
   traceId: string,
   context: any,
   documentId: number,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const results: Record<string, any> = {};
   const total = Object.keys(scenariosMap).length;
@@ -300,16 +299,14 @@ export async function bulkCreateTestCases(
     };
 
     try {
-      const resp = await axios.post(
-        BULK_CREATE_URL(projectId, folderId),
-        payload,
-        {
-          headers: {
-            "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
-            "Content-Type": "application/json",
-          },
+      const resp = await apiClient.post({
+        url: BULK_CREATE_URL(projectId, folderId),
+        headers: {
+          "API-TOKEN": getBrowserStackAuth(config),
+          "Content-Type": "application/json",
         },
-      );
+        body: payload,
+      });
       results[id] = resp.data;
       await context.sendNotification({
         method: "notifications/progress",
@@ -342,17 +339,21 @@ export async function bulkCreateTestCases(
 
 export async function projectIdentifierToId(
   projectId: string,
+  config: BrowserStackConfig,
 ): Promise<string> {
   const url = `https://test-management.browserstack.com/api/v1/projects/?q=${projectId}`;
 
-  const response = await axios.get(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
-      "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
+      "API-TOKEN": getBrowserStackAuth(config),
       accept: "application/json, text/plain, */*",
     },
   });
   if (response.data.success !== true) {
-    throw new Error(`Failed to fetch project ID: ${response.statusText}`);
+    throw new Error(
+      `Failed to fetch project ID: ${response.statusText || response.status}`,
+    );
   }
   for (const project of response.data.projects) {
     if (project.identifier === projectId) {
@@ -365,19 +366,21 @@ export async function projectIdentifierToId(
 export async function testCaseIdentifierToDetails(
   projectId: string,
   testCaseIdentifier: string,
+  config: BrowserStackConfig,
 ): Promise<{ testCaseId: string; folderId: string }> {
   const url = `https://test-management.browserstack.com/api/v1/projects/${projectId}/test-cases/search?q[query]=${testCaseIdentifier}`;
 
-  const response = await axios.get(url, {
+  const response = await apiClient.get({
+    url,
     headers: {
-      "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
+      "API-TOKEN": getBrowserStackAuth(config),
       accept: "application/json, text/plain, */*",
     },
   });
 
   if (response.data.success !== true) {
     throw new Error(
-      `Failed to fetch test case details: ${response.statusText}`,
+      `Failed to fetch test case details: ${response.statusText || response.status}`,
     );
   }
 
diff --git a/src/tools/testmanagement-utils/TCG-utils/helpers.ts b/src/tools/testmanagement-utils/TCG-utils/helpers.ts
index 40a690c..1a25328 100644
--- a/src/tools/testmanagement-utils/TCG-utils/helpers.ts
+++ b/src/tools/testmanagement-utils/TCG-utils/helpers.ts
@@ -1,4 +1,5 @@
 import { DefaultFieldMaps } from "./types.js";
+import { randomUUID } from "node:crypto";
 
 /**
  * Build mappings for default fields for priority, status, and case type.
@@ -60,7 +61,7 @@ export function createTestCasePayload(
         rich_text_id: null,
         scenario: scenarioId,
         test_case_count: tc.test_case_count || 1,
-        uuid: tc.uuid || crypto.randomUUID?.() || "unknown-uuid",
+        uuid: tc.uuid || randomUUID() || "unknown-uuid",
         "x-bstack-traceRequestId": traceId,
       },
     }),
diff --git a/src/tools/testmanagement-utils/add-test-result.ts b/src/tools/testmanagement-utils/add-test-result.ts
index b8be68c..c41db3b 100644
--- a/src/tools/testmanagement-utils/add-test-result.ts
+++ b/src/tools/testmanagement-utils/add-test-result.ts
@@ -1,8 +1,8 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
-import { formatAxiosError } from "../../lib/error.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Schema for adding a test result to a test run.
@@ -33,6 +33,7 @@ export type AddTestResultArgs = z.infer<typeof AddTestResultSchema>;
  */
 export async function addTestResult(
   rawArgs: AddTestResultArgs,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   try {
     const args = AddTestResultSchema.parse(rawArgs);
@@ -45,12 +46,17 @@ export async function addTestResult(
       test_case_id: args.test_case_id,
     } as any;
 
-    const response = await axios.post(url, body, {
-      auth: {
-        username: config.browserstackUsername,
-        password: config.browserstackAccessKey,
+    const authString = getBrowserStackAuth(config);
+    const [username, password] = authString.split(":");
+
+    const response = await apiClient.post({
+      url,
+      headers: {
+        "Content-Type": "application/json",
+        Authorization:
+          "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
       },
-      headers: { "Content-Type": "application/json" },
+      body,
     });
 
     const data = response.data;
@@ -70,6 +76,18 @@ export async function addTestResult(
       ],
     };
   } catch (err: any) {
-    return formatAxiosError(err, "Failed to add test result to test run");
+    const msg =
+      err?.response?.data?.message ||
+      err?.response?.data?.error ||
+      err?.message ||
+      String(err);
+    return {
+      content: [
+        {
+          type: "text",
+          text: `Failed to add test result to test run: ${msg}`,
+        },
+      ],
+    };
   }
 }
diff --git a/src/tools/testmanagement-utils/create-lca-steps.ts b/src/tools/testmanagement-utils/create-lca-steps.ts
index 4016750..2f6e4a0 100644
--- a/src/tools/testmanagement-utils/create-lca-steps.ts
+++ b/src/tools/testmanagement-utils/create-lca-steps.ts
@@ -1,13 +1,13 @@
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
-import axios from "axios";
-import config from "../../config.js";
-import { formatAxiosError } from "../../lib/error.js";
+import { apiClient } from "../../lib/apiClient.js";
 import {
   projectIdentifierToId,
   testCaseIdentifierToDetails,
 } from "./TCG-utils/api.js";
 import { pollLCAStatus } from "./poll-lca-status.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Schema for creating LCA steps for a test case
@@ -65,15 +65,20 @@ export type CreateLCAStepsArgs = z.infer<typeof CreateLCAStepsSchema>;
 export async function createLCASteps(
   args: CreateLCAStepsArgs,
   context: any,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   try {
     // Get the project ID from identifier
-    const projectId = await projectIdentifierToId(args.project_identifier);
+    const projectId = await projectIdentifierToId(
+      args.project_identifier,
+      config,
+    );
 
     // Get the test case ID and folder ID from identifier
     const { testCaseId, folderId } = await testCaseIdentifierToDetails(
       projectId,
       args.test_case_identifier,
+      config,
     );
 
     const url = `https://test-management.browserstack.com/api/v1/projects/${projectId}/test-cases/${testCaseId}/lcnc`;
@@ -88,74 +93,61 @@ export async function createLCASteps(
       webhook_path: `https://test-management.browserstack.com/api/v1/projects/${projectId}/test-cases/${testCaseId}/webhooks/lcnc`,
     };
 
-    const response = await axios.post(url, payload, {
+    await apiClient.post({
+      url,
       headers: {
-        "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
+        "API-TOKEN": getBrowserStackAuth(config),
         accept: "application/json, text/plain, */*",
         "Content-Type": "application/json",
       },
+      body: payload,
     });
 
-    if (response.status >= 200 && response.status < 300) {
-      // Check if user wants to wait for completion
-      if (!args.wait_for_completion) {
+    // Check if user wants to wait for completion
+    if (!args.wait_for_completion) {
+      return {
+        content: [
+          {
+            type: "text",
+            text: `LCA steps creation initiated for test case ${args.test_case_identifier} (ID: ${testCaseId})`,
+          },
+          {
+            type: "text",
+            text: "LCA build started. Check the BrowserStack Lowcode Automation UI for completion status.",
+          },
+        ],
+      };
+    }
+
+    // Start polling for LCA build completion
+    try {
+      const max_wait_minutes = 10; // Maximum wait time in minutes
+      const maxWaitMs = max_wait_minutes * 60 * 1000;
+      const lcaResult = await pollLCAStatus(
+        projectId,
+        folderId,
+        testCaseId,
+        context,
+        maxWaitMs, // max wait time
+        2 * 60 * 1000, // 2 minutes initial wait
+        10 * 1000, // 10 seconds interval
+        config,
+      );
+
+      if (lcaResult && lcaResult.status === "done") {
         return {
           content: [
             {
               type: "text",
-              text: `LCA steps creation initiated for test case ${args.test_case_identifier} (ID: ${testCaseId})`,
+              text: `Successfully created LCA steps for test case ${args.test_case_identifier} (ID: ${testCaseId})`,
             },
             {
               type: "text",
-              text: "LCA build started. Check the BrowserStack Lowcode Automation UI for completion status.",
+              text: `LCA build completed! Resource URL: ${lcaResult.resource_path}`,
             },
           ],
         };
-      }
-
-      // Start polling for LCA build completion
-      try {
-        const max_wait_minutes = 10; // Maximum wait time in minutes
-        const maxWaitMs = max_wait_minutes * 60 * 1000;
-        const lcaResult = await pollLCAStatus(
-          projectId,
-          folderId,
-          testCaseId,
-          context,
-          maxWaitMs, // max wait time
-          2 * 60 * 1000, // 2 minutes initial wait
-          10 * 1000, // 10 seconds interval
-        );
-
-        if (lcaResult && lcaResult.status === "done") {
-          return {
-            content: [
-              {
-                type: "text",
-                text: `Successfully created LCA steps for test case ${args.test_case_identifier} (ID: ${testCaseId})`,
-              },
-              {
-                type: "text",
-                text: `LCA build completed! Resource URL: ${lcaResult.resource_path}`,
-              },
-            ],
-          };
-        } else {
-          return {
-            content: [
-              {
-                type: "text",
-                text: `LCA steps creation initiated for test case ${args.test_case_identifier} (ID: ${testCaseId})`,
-              },
-              {
-                type: "text",
-                text: `Warning: LCA build did not complete within ${max_wait_minutes} minutes. You can check the status later in the BrowserStack Test Management UI.`,
-              },
-            ],
-          };
-        }
-      } catch (pollError) {
-        console.error("Error during LCA polling:", pollError);
+      } else {
         return {
           content: [
             {
@@ -164,15 +156,27 @@ export async function createLCASteps(
             },
             {
               type: "text",
-              text: "Warning: Error occurred while polling for LCA build completion. Check the BrowserStack Test Management UI for status.",
+              text: `Warning: LCA build did not complete within ${max_wait_minutes} minutes. You can check the status later in the BrowserStack Test Management UI.`,
             },
           ],
         };
       }
-    } else {
-      throw new Error(`Unexpected response: ${JSON.stringify(response.data)}`);
+    } catch (pollError) {
+      console.error("Error during LCA polling:", pollError);
+      return {
+        content: [
+          {
+            type: "text",
+            text: `LCA steps creation initiated for test case ${args.test_case_identifier} (ID: ${testCaseId})`,
+          },
+          {
+            type: "text",
+            text: "Warning: Error occurred while polling for LCA build completion. Check the BrowserStack Test Management UI for status.",
+          },
+        ],
+      };
     }
-  } catch (error) {
+  } catch (error: any) {
     // Add more specific error handling
     if (error instanceof Error) {
       if (error.message.includes("not found")) {
@@ -188,6 +192,19 @@ export async function createLCASteps(
         };
       }
     }
-    return formatAxiosError(error, "Failed to create LCA steps");
+    const msg =
+      error?.response?.data?.message ||
+      error?.response?.data?.error ||
+      error?.message ||
+      String(error);
+    return {
+      content: [
+        {
+          type: "text",
+          text: `Failed to create LCA steps: ${msg}`,
+        },
+      ],
+      isError: true,
+    };
   }
 }
diff --git a/src/tools/testmanagement-utils/create-project-folder.ts b/src/tools/testmanagement-utils/create-project-folder.ts
index ef83570..df0e17a 100644
--- a/src/tools/testmanagement-utils/create-project-folder.ts
+++ b/src/tools/testmanagement-utils/create-project-folder.ts
@@ -1,9 +1,10 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
-import { formatAxiosError } from "../../lib/error.js"; // or correct path
+import { formatAxiosError } from "../../lib/error.js";
 import { projectIdentifierToId } from "../testmanagement-utils/TCG-utils/api.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 // Schema for combined project/folder creation
 export const CreateProjFoldSchema = z.object({
@@ -37,6 +38,7 @@ type CreateProjFoldArgs = z.infer<typeof CreateProjFoldSchema>;
  */
 export async function createProjectOrFolder(
   args: CreateProjFoldArgs,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   const {
     project_name,
@@ -53,22 +55,28 @@ export async function createProjectOrFolder(
     );
   }
 
+  const authString = getBrowserStackAuth(config);
+  const [username, password] = authString.split(":");
+
   let projId = project_identifier;
 
   // Step 1: Create project if project_name provided
   if (project_name) {
     try {
-      const res = await axios.post(
-        "https://test-management.browserstack.com/api/v2/projects",
-        { project: { name: project_name, description: project_description } },
-        {
-          auth: {
-            username: config.browserstackUsername,
-            password: config.browserstackAccessKey,
-          },
-          headers: { "Content-Type": "application/json" },
+      const authString = getBrowserStackAuth(config);
+      const [username, password] = authString.split(":");
+      const res = await apiClient.post({
+        url: "https://test-management.browserstack.com/api/v2/projects",
+        headers: {
+          "Content-Type": "application/json",
+          Authorization:
+            "Basic " +
+            Buffer.from(`${username}:${password}`).toString("base64"),
+        },
+        body: {
+          project: { name: project_name, description: project_description },
         },
-      );
+      });
 
       if (!res.data.success) {
         throw new Error(
@@ -78,8 +86,8 @@ export async function createProjectOrFolder(
       // Project created successfully
 
       projId = res.data.project.identifier;
-    } catch (err) {
-      return formatAxiosError(err, "Failed to create project..");
+    } catch (err: any) {
+      return formatAxiosError(err, "Failed to create project.");
     }
   }
   // Step 2: Create folder if folder_name provided
@@ -87,25 +95,24 @@ export async function createProjectOrFolder(
     if (!projId)
       throw new Error("Cannot create folder without project_identifier.");
     try {
-      const res = await axios.post(
-        `https://test-management.browserstack.com/api/v2/projects/${encodeURIComponent(
+      const res = await apiClient.post({
+        url: `https://test-management.browserstack.com/api/v2/projects/${encodeURIComponent(
           projId,
         )}/folders`,
-        {
+        headers: {
+          "Content-Type": "application/json",
+          Authorization:
+            "Basic " +
+            Buffer.from(`${username}:${password}`).toString("base64"),
+        },
+        body: {
           folder: {
             name: folder_name,
             description: folder_description,
             parent_id,
           },
         },
-        {
-          auth: {
-            username: config.browserstackUsername,
-            password: config.browserstackAccessKey,
-          },
-          headers: { "Content-Type": "application/json" },
-        },
-      );
+      });
 
       if (!res.data.success) {
         throw new Error(`Failed to create folder: ${JSON.stringify(res.data)}`);
@@ -113,7 +120,7 @@ export async function createProjectOrFolder(
       // Folder created successfully
 
       const folder = res.data.folder;
-      const projectId = await projectIdentifierToId(projId);
+      const projectId = await projectIdentifierToId(projId, config);
 
       return {
         content: [
@@ -127,7 +134,7 @@ export async function createProjectOrFolder(
           },
         ],
       };
-    } catch (err) {
+    } catch (err: any) {
       return formatAxiosError(err, "Failed to create folder.");
     }
   }
diff --git a/src/tools/testmanagement-utils/create-testcase.ts b/src/tools/testmanagement-utils/create-testcase.ts
index bb9029a..446d54d 100644
--- a/src/tools/testmanagement-utils/create-testcase.ts
+++ b/src/tools/testmanagement-utils/create-testcase.ts
@@ -1,9 +1,9 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
-import { formatAxiosError } from "../../lib/error.js"; // or correct
+import { formatAxiosError } from "../../lib/error.js";
 import { projectIdentifierToId } from "./TCG-utils/api.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 interface TestCaseStep {
   step: string;
@@ -138,25 +138,28 @@ export function sanitizeArgs(args: any) {
   return cleaned;
 }
 
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+
 export async function createTestCase(
   params: TestCaseCreateRequest,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   const body = { test_case: params };
+  const authString = getBrowserStackAuth(config);
+  const [username, password] = authString.split(":");
 
   try {
-    const response = await axios.post<TestCaseResponse>(
-      `https://test-management.browserstack.com/api/v2/projects/${encodeURIComponent(
+    const response = await apiClient.post({
+      url: `https://test-management.browserstack.com/api/v2/projects/${encodeURIComponent(
         params.project_identifier,
       )}/folders/${encodeURIComponent(params.folder_id)}/test-cases`,
-      body,
-      {
-        auth: {
-          username: config.browserstackUsername,
-          password: config.browserstackAccessKey,
-        },
-        headers: { "Content-Type": "application/json" },
+      headers: {
+        "Content-Type": "application/json",
+        Authorization:
+          "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
       },
-    );
+      body,
+    });
 
     const { data } = response.data;
     if (!data.success) {
@@ -175,7 +178,10 @@ export async function createTestCase(
     }
 
     const tc = data.test_case;
-    const projectId = await projectIdentifierToId(params.project_identifier);
+    const projectId = await projectIdentifierToId(
+      params.project_identifier,
+      config,
+    );
 
     return {
       content: [
diff --git a/src/tools/testmanagement-utils/create-testrun.ts b/src/tools/testmanagement-utils/create-testrun.ts
index 2b8b4c6..45edaab 100644
--- a/src/tools/testmanagement-utils/create-testrun.ts
+++ b/src/tools/testmanagement-utils/create-testrun.ts
@@ -1,8 +1,9 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import { formatAxiosError } from "../../lib/error.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Schema for creating a test run.
@@ -53,6 +54,7 @@ export type CreateTestRunArgs = z.infer<typeof CreateTestRunSchema>;
  */
 export async function createTestRun(
   rawArgs: CreateTestRunArgs,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   try {
     const inputArgs = {
@@ -68,17 +70,17 @@ export async function createTestRun(
       args.project_identifier,
     )}/test-runs`;
 
-    const response = await axios.post(
+    const authString = getBrowserStackAuth(config);
+    const [username, password] = authString.split(":");
+    const response = await apiClient.post({
       url,
-      { test_run: args.test_run },
-      {
-        auth: {
-          username: config.browserstackUsername,
-          password: config.browserstackAccessKey,
-        },
-        headers: { "Content-Type": "application/json" },
+      headers: {
+        "Content-Type": "application/json",
+        Authorization:
+          "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
       },
-    );
+      body: { test_run: args.test_run },
+    });
 
     const data = response.data;
     if (!data.success) {
diff --git a/src/tools/testmanagement-utils/list-testcases.ts b/src/tools/testmanagement-utils/list-testcases.ts
index f882830..98f95aa 100644
--- a/src/tools/testmanagement-utils/list-testcases.ts
+++ b/src/tools/testmanagement-utils/list-testcases.ts
@@ -1,8 +1,9 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import { formatAxiosError } from "../../lib/error.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Schema for listing test cases with optional filters.
@@ -38,6 +39,7 @@ export type ListTestCasesArgs = z.infer<typeof ListTestCasesSchema>;
  */
 export async function listTestCases(
   args: ListTestCasesArgs,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   try {
     // Build query string
@@ -51,10 +53,13 @@ export async function listTestCases(
       args.project_identifier,
     )}/test-cases?${params.toString()}`;
 
-    const resp = await axios.get(url, {
-      auth: {
-        username: config.browserstackUsername,
-        password: config.browserstackAccessKey,
+    const authString = getBrowserStackAuth(config);
+    const [username, password] = authString.split(":");
+    const resp = await apiClient.get({
+      url,
+      headers: {
+        Authorization:
+          "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
       },
     });
 
diff --git a/src/tools/testmanagement-utils/list-testruns.ts b/src/tools/testmanagement-utils/list-testruns.ts
index 5bad0bc..1d3390b 100644
--- a/src/tools/testmanagement-utils/list-testruns.ts
+++ b/src/tools/testmanagement-utils/list-testruns.ts
@@ -1,8 +1,9 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import { formatAxiosError } from "../../lib/error.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Schema for listing test runs with optional filters.
@@ -26,6 +27,7 @@ type ListTestRunsArgs = z.infer<typeof ListTestRunsSchema>;
  */
 export async function listTestRuns(
   args: ListTestRunsArgs,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   try {
     const params = new URLSearchParams();
@@ -38,10 +40,13 @@ export async function listTestRuns(
         args.project_identifier,
       )}/test-runs?` + params.toString();
 
-    const resp = await axios.get(url, {
-      auth: {
-        username: config.browserstackUsername,
-        password: config.browserstackAccessKey,
+    const authString = getBrowserStackAuth(config);
+    const [username, password] = authString.split(":");
+    const resp = await apiClient.get({
+      url,
+      headers: {
+        Authorization:
+          "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
       },
     });
 
diff --git a/src/tools/testmanagement-utils/poll-lca-status.ts b/src/tools/testmanagement-utils/poll-lca-status.ts
index cdaf971..3a5e4fb 100644
--- a/src/tools/testmanagement-utils/poll-lca-status.ts
+++ b/src/tools/testmanagement-utils/poll-lca-status.ts
@@ -1,5 +1,6 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Interface for the test case response structure
@@ -36,6 +37,7 @@ export async function pollLCAStatus(
   maxWaitTimeMs: number = 10 * 60 * 1000, // 10 minutes default
   initialWaitMs: number = 2 * 60 * 1000, // 2 minutes initial wait
   pollIntervalMs: number = 10 * 1000, // 10 seconds interval
+  config: BrowserStackConfig,
 ): Promise<{ resource_path: string; status: string } | null> {
   const url = `https://test-management.browserstack.com/api/v1/projects/${projectId}/folder/${folderId}/test-cases/${testCaseId}`;
 
@@ -91,20 +93,24 @@ export async function pollLCAStatus(
     // Set up polling interval
     const intervalId = setInterval(async () => {
       try {
-        const response = await axios.get<TestCaseResponse>(url, {
+        const authString = getBrowserStackAuth(config);
+        const response = await apiClient.get({
+          url,
           headers: {
-            "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
+            "API-TOKEN": authString,
             accept: "application/json, text/plain, */*",
           },
         });
 
-        if (response.data.data.success && response.data.data.test_case) {
-          const testCase = response.data.data.test_case;
+        const responseData: TestCaseResponse = response.data;
+
+        if (responseData.data.success && responseData.data.test_case) {
+          const testCase = responseData.data.test_case;
 
           // Check lcnc_build_map in both possible locations
           const lcncBuildMap =
             testCase.lcnc_build_map ||
-            response.data.data.metadata?.lcnc_build_map;
+            responseData.data.metadata?.lcnc_build_map;
 
           if (lcncBuildMap) {
             if (lcncBuildMap.status === "done") {
diff --git a/src/tools/testmanagement-utils/testcase-from-file.ts b/src/tools/testmanagement-utils/testcase-from-file.ts
index 41b1834..96bf835 100644
--- a/src/tools/testmanagement-utils/testcase-from-file.ts
+++ b/src/tools/testmanagement-utils/testcase-from-file.ts
@@ -13,10 +13,12 @@ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import { signedUrlMap } from "../../lib/inmemory-store.js";
 import logger from "../../logger.js";
 import { projectIdentifierToId } from "./TCG-utils/api.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 export async function createTestCasesFromFile(
   args: CreateTestCasesFromFileArgs,
   context: any,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   logger.info(
     `createTestCasesFromFile called with projectId: ${args.projectReferenceId}, folderId: ${args.folderId}`,
@@ -25,10 +27,12 @@ export async function createTestCasesFromFile(
   if (args.projectReferenceId.startsWith("PR-")) {
     args.projectReferenceId = await projectIdentifierToId(
       args.projectReferenceId,
+      config,
     );
   }
   const { default_fields, custom_fields } = await fetchFormFields(
     args.projectReferenceId,
+    config,
   );
   const fieldMaps = buildDefaultFieldMaps(default_fields);
   const booleanFieldId = findBooleanFieldId(custom_fields);
@@ -57,6 +61,7 @@ export async function createTestCasesFromFile(
     args.folderId,
     args.projectReferenceId,
     source,
+    config,
   );
 
   const scenariosMap = await pollScenariosTestDetails(
@@ -65,6 +70,7 @@ export async function createTestCasesFromFile(
     context,
     documentId,
     source,
+    config,
   );
 
   const resultString = await bulkCreateTestCases(
@@ -76,6 +82,7 @@ export async function createTestCasesFromFile(
     traceId,
     context,
     documentId,
+    config,
   );
 
   signedUrlMap.delete(args.documentId);
diff --git a/src/tools/testmanagement-utils/update-testrun.ts b/src/tools/testmanagement-utils/update-testrun.ts
index ed8c8d0..0c56af7 100644
--- a/src/tools/testmanagement-utils/update-testrun.ts
+++ b/src/tools/testmanagement-utils/update-testrun.ts
@@ -1,8 +1,9 @@
-import axios from "axios";
-import config from "../../config.js";
+import { apiClient } from "../../lib/apiClient.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
 import { formatAxiosError } from "../../lib/error.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Schema for updating a test run with partial fields.
@@ -35,6 +36,7 @@ type UpdateTestRunArgs = z.infer<typeof UpdateTestRunSchema>;
  */
 export async function updateTestRun(
   args: UpdateTestRunArgs,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   try {
     const body = { test_run: args.test_run };
@@ -42,11 +44,17 @@ export async function updateTestRun(
       args.project_identifier,
     )}/test-runs/${encodeURIComponent(args.test_run_id)}/update`;
 
-    const resp = await axios.patch(url, body, {
-      auth: {
-        username: config.browserstackUsername,
-        password: config.browserstackAccessKey,
+    const authString = getBrowserStackAuth(config);
+    const [username, password] = authString.split(":");
+
+    const resp = await apiClient.patch({
+      url,
+      headers: {
+        Authorization:
+          "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
+        "Content-Type": "application/json",
       },
+      body,
     });
 
     const data = resp.data;
diff --git a/src/tools/testmanagement-utils/upload-file.ts b/src/tools/testmanagement-utils/upload-file.ts
index 3f76c2e..e8e81fc 100644
--- a/src/tools/testmanagement-utils/upload-file.ts
+++ b/src/tools/testmanagement-utils/upload-file.ts
@@ -1,13 +1,14 @@
 import { z } from "zod";
 import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
-import axios from "axios";
+import { apiClient } from "../../lib/apiClient.js";
 import FormData from "form-data";
 import fs from "fs";
 import path from "path";
 import { v4 as uuidv4 } from "uuid";
-import config from "../../config.js";
+import { getBrowserStackAuth } from "../../lib/get-auth.js";
 import { signedUrlMap } from "../../lib/inmemory-store.js";
 import { projectIdentifierToId } from "./TCG-utils/api.js";
+import { BrowserStackConfig } from "../../lib/types.js";
 
 /**
  * Schema for the upload file tool
@@ -28,6 +29,7 @@ export const UploadFileSchema = z.object({
  */
 export async function uploadFile(
   args: z.infer<typeof UploadFileSchema>,
+  config: BrowserStackConfig,
 ): Promise<CallToolResult> {
   const { project_identifier, file_path } = args;
 
@@ -46,19 +48,24 @@ export async function uploadFile(
       };
     }
     // Get the project ID
-    const projectIdResponse = await projectIdentifierToId(project_identifier);
+    const projectIdResponse = await projectIdentifierToId(
+      project_identifier,
+      config,
+    );
 
     const formData = new FormData();
     formData.append("attachments[]", fs.createReadStream(file_path));
 
     const uploadUrl = `https://test-management.browserstack.com/api/v1/projects/${projectIdResponse}/generic/attachments/ai_uploads`;
 
-    const response = await axios.post(uploadUrl, formData, {
+    const response = await apiClient.post({
+      url: uploadUrl,
       headers: {
         ...formData.getHeaders(),
-        "API-TOKEN": `${config.browserstackUsername}:${config.browserstackAccessKey}`,
+        "API-TOKEN": getBrowserStackAuth(config),
         accept: "application/json, text/plain, */*",
       },
+      body: formData,
     });
 
     if (
diff --git a/src/tools/testmanagement.ts b/src/tools/testmanagement.ts
index 8c72c22..830639c 100644
--- a/src/tools/testmanagement.ts
+++ b/src/tools/testmanagement.ts
@@ -14,8 +14,6 @@ import {
   CreateTestCaseSchema,
 } from "./testmanagement-utils/create-testcase.js";
 
-let serverInstance: McpServer;
-
 import {
   listTestCases,
   ListTestCasesSchema,
@@ -53,6 +51,7 @@ import {
   createLCASteps,
   CreateLCAStepsSchema,
 } from "./testmanagement-utils/create-lca-steps.js";
+import { BrowserStackConfig } from "../lib/types.js";
 
 //TODO: Moving the traceMCP and catch block to the parent(server) function
 
@@ -61,19 +60,24 @@ import {
  */
 export async function createProjectOrFolderTool(
   args: z.infer<typeof CreateProjFoldSchema>,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
     trackMCP(
       "createProjectOrFolder",
-      serverInstance.server.getClientVersion()!,
+      server.server.getClientVersion()!,
+      undefined,
+      config,
     );
-    return await createProjectOrFolder(args);
+    return await createProjectOrFolder(args, config);
   } catch (err) {
     logger.error("Failed to create project/folder: %s", err);
     trackMCP(
       "createProjectOrFolder",
-      serverInstance.server.getClientVersion()!,
+      server.server.getClientVersion()!,
       err,
+      config,
     );
     return {
       content: [
@@ -95,15 +99,22 @@ export async function createProjectOrFolderTool(
  */
 export async function createTestCaseTool(
   args: TestCaseCreateRequest,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   // Sanitize input arguments
   const cleanedArgs = sanitizeArgs(args);
   try {
-    trackMCP("createTestCase", serverInstance.server.getClientVersion()!);
-    return await createTestCaseAPI(cleanedArgs);
+    trackMCP(
+      "createTestCase",
+      server.server.getClientVersion()!,
+      undefined,
+      config,
+    );
+    return await createTestCaseAPI(cleanedArgs, config);
   } catch (err) {
     logger.error("Failed to create test case: %s", err);
-    trackMCP("createTestCase", serverInstance.server.getClientVersion()!, err);
+    trackMCP("createTestCase", server.server.getClientVersion()!, err, config);
     return {
       content: [
         {
@@ -125,12 +136,19 @@ export async function createTestCaseTool(
 
 export async function listTestCasesTool(
   args: z.infer<typeof ListTestCasesSchema>,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
-    trackMCP("listTestCases", serverInstance.server.getClientVersion()!);
-    return await listTestCases(args);
+    trackMCP(
+      "listTestCases",
+      server.server.getClientVersion()!,
+      undefined,
+      config,
+    );
+    return await listTestCases(args, config);
   } catch (err) {
-    trackMCP("listTestCases", serverInstance.server.getClientVersion()!, err);
+    trackMCP("listTestCases", server.server.getClientVersion()!, err, config);
     return {
       content: [
         {
@@ -151,12 +169,19 @@ export async function listTestCasesTool(
  */
 export async function createTestRunTool(
   args: z.infer<typeof CreateTestRunSchema>,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
-    trackMCP("createTestRun", serverInstance.server.getClientVersion()!);
-    return await createTestRun(args);
+    trackMCP(
+      "createTestRun",
+      server.server.getClientVersion()!,
+      undefined,
+      config,
+    );
+    return await createTestRun(args, config);
   } catch (err) {
-    trackMCP("createTestRun", serverInstance.server.getClientVersion()!, err);
+    trackMCP("createTestRun", server.server.getClientVersion()!, err, config);
     return {
       content: [
         {
@@ -177,12 +202,19 @@ export async function createTestRunTool(
  */
 export async function listTestRunsTool(
   args: z.infer<typeof ListTestRunsSchema>,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
-    trackMCP("listTestRuns", serverInstance.server.getClientVersion()!);
-    return await listTestRuns(args);
+    trackMCP(
+      "listTestRuns",
+      server.server.getClientVersion()!,
+      undefined,
+      config,
+    );
+    return await listTestRuns(args, config);
   } catch (err) {
-    trackMCP("listTestRuns", serverInstance.server.getClientVersion()!, err);
+    trackMCP("listTestRuns", server.server.getClientVersion()!, err, config);
     return {
       content: [
         {
@@ -205,12 +237,19 @@ export async function listTestRunsTool(
  */
 export async function updateTestRunTool(
   args: z.infer<typeof UpdateTestRunSchema>,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
-    trackMCP("updateTestRun", serverInstance.server.getClientVersion()!);
-    return await updateTestRun(args);
+    trackMCP(
+      "updateTestRun",
+      server.server.getClientVersion()!,
+      undefined,
+      config,
+    );
+    return await updateTestRun(args, config);
   } catch (err) {
-    trackMCP("updateTestRun", serverInstance.server.getClientVersion()!, err);
+    trackMCP("updateTestRun", server.server.getClientVersion()!, err, config);
     return {
       content: [
         {
@@ -231,12 +270,19 @@ export async function updateTestRunTool(
  */
 export async function addTestResultTool(
   args: z.infer<typeof AddTestResultSchema>,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
-    trackMCP("addTestResult", serverInstance.server.getClientVersion()!);
-    return await addTestResult(args);
+    trackMCP(
+      "addTestResult",
+      server.server.getClientVersion()!,
+      undefined,
+      config,
+    );
+    return await addTestResult(args, config);
   } catch (err) {
-    trackMCP("addTestResult", serverInstance.server.getClientVersion()!, err);
+    trackMCP("addTestResult", server.server.getClientVersion()!, err, config);
     return {
       content: [
         {
@@ -257,18 +303,23 @@ export async function addTestResultTool(
  */
 export async function uploadProductRequirementFileTool(
   args: z.infer<typeof UploadFileSchema>,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
     trackMCP(
       "uploadProductRequirementFile",
-      serverInstance.server.getClientVersion()!,
+      server.server.getClientVersion()!,
+      undefined,
+      config,
     );
-    return await uploadFile(args);
+    return await uploadFile(args, config);
   } catch (err) {
     trackMCP(
       "uploadProductRequirementFile",
-      serverInstance.server.getClientVersion()!,
+      server.server.getClientVersion()!,
       err,
+      config,
     );
     return {
       content: [
@@ -291,19 +342,18 @@ export async function uploadProductRequirementFileTool(
 export async function createTestCasesFromFileTool(
   args: z.infer<typeof CreateTestCasesFromFileSchema>,
   context: any,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
     trackMCP(
       "createTestCasesFromFile",
-      serverInstance.server.getClientVersion()!,
+      server.server.getClientVersion()!,
+      undefined,
     );
-    return await createTestCasesFromFile(args, context);
+    return await createTestCasesFromFile(args, context, config);
   } catch (err) {
-    trackMCP(
-      "createTestCasesFromFile",
-      serverInstance.server.getClientVersion()!,
-      err,
-    );
+    trackMCP("createTestCasesFromFile", server.server.getClientVersion()!, err);
     return {
       content: [
         {
@@ -325,12 +375,19 @@ export async function createTestCasesFromFileTool(
 export async function createLCAStepsTool(
   args: z.infer<typeof CreateLCAStepsSchema>,
   context: any,
+  config: BrowserStackConfig,
+  server: McpServer,
 ): Promise<CallToolResult> {
   try {
-    trackMCP("createLCASteps", serverInstance.server.getClientVersion()!);
-    return await createLCASteps(args, context);
+    trackMCP(
+      "createLCASteps",
+      server.server.getClientVersion()!,
+      undefined,
+      config,
+    );
+    return await createLCASteps(args, context, config);
   } catch (err) {
-    trackMCP("createLCASteps", serverInstance.server.getClientVersion()!, err);
+    trackMCP("createLCASteps", server.server.getClientVersion()!, err, config);
     return {
       content: [
         {
@@ -349,71 +406,82 @@ export async function createLCAStepsTool(
 /**
  * Registers both project/folder and test-case tools.
  */
-export default function addTestManagementTools(server: McpServer) {
-  serverInstance = server;
-  server.tool(
+export default function addTestManagementTools(
+  server: McpServer,
+  config: BrowserStackConfig,
+) {
+  const tools: Record<string, any> = {};
+
+  tools.createProjectOrFolder = server.tool(
     "createProjectOrFolder",
     "Create a project and/or folder in BrowserStack Test Management.",
     CreateProjFoldSchema.shape,
-    createProjectOrFolderTool,
+    (args) => createProjectOrFolderTool(args, config, server),
   );
 
-  server.tool(
+  tools.createTestCase = server.tool(
     "createTestCase",
     "Use this tool to create a test case in BrowserStack Test Management.",
     CreateTestCaseSchema.shape,
-    createTestCaseTool,
+    (args) => createTestCaseTool(args, config, server),
   );
 
-  server.tool(
+  tools.listTestCases = server.tool(
     "listTestCases",
     "List test cases in a project with optional filters (status, priority, custom fields, etc.)",
     ListTestCasesSchema.shape,
-    listTestCasesTool,
+    (args) => listTestCasesTool(args, config, server),
   );
 
-  server.tool(
+  tools.createTestRun = server.tool(
     "createTestRun",
     "Create a test run in BrowserStack Test Management.",
     CreateTestRunSchema.shape,
-    createTestRunTool,
+    (args) => createTestRunTool(args, config, server),
   );
 
-  server.tool(
+  tools.listTestRuns = server.tool(
     "listTestRuns",
     "List test runs in a project with optional filters (date ranges, assignee, state, etc.)",
     ListTestRunsSchema.shape,
-    listTestRunsTool,
+    (args) => listTestRunsTool(args, config, server),
   );
-  server.tool(
+
+  tools.updateTestRun = server.tool(
     "updateTestRun",
     "Update a test run in BrowserStack Test Management.",
     UpdateTestRunSchema.shape,
-    updateTestRunTool,
+    (args) => updateTestRunTool(args, config, server),
   );
-  server.tool(
+
+  tools.addTestResult = server.tool(
     "addTestResult",
     "Add a test result to a specific test run via BrowserStack Test Management API.",
     AddTestResultSchema.shape,
-    addTestResultTool,
+    (args) => addTestResultTool(args, config, server),
   );
 
-  server.tool(
+  tools.uploadProductRequirementFile = server.tool(
     "uploadProductRequirementFile",
     "Upload files (e.g., PDRs, PDFs) to BrowserStack Test Management and retrieve a file mapping ID. This is utilized for generating test cases from files and is part of the Test Case Generator AI Agent in BrowserStack.",
     UploadFileSchema.shape,
-    uploadProductRequirementFileTool,
+    (args) => uploadProductRequirementFileTool(args, config, server),
   );
-  server.tool(
+
+  tools.createTestCasesFromFile = server.tool(
     "createTestCasesFromFile",
     "Generate test cases from a file in BrowserStack Test Management using the Test Case Generator AI Agent.",
     CreateTestCasesFromFileSchema.shape,
-    createTestCasesFromFileTool,
+    (args, context) =>
+      createTestCasesFromFileTool(args, context, config, server),
   );
-  server.tool(
+
+  tools.createLCASteps = server.tool(
     "createLCASteps",
     "Generate Low Code Automation (LCA) steps for a test case in BrowserStack Test Management using the Low Code Automation Agent.",
     CreateLCAStepsSchema.shape,
-    createLCAStepsTool,
+    (args, context) => createLCAStepsTool(args, context, config, server),
   );
+
+  return tools;
 }
diff --git a/tests/tools/applive.test.ts b/tests/tools/applive.test.ts
index bf2db5f..3870bd6 100644
--- a/tests/tools/applive.test.ts
+++ b/tests/tools/applive.test.ts
@@ -52,58 +52,64 @@ describe('startAppLiveSession', () => {
     desiredPhone: 'iPhone 12 Pro'
   };
 
+  const mockConfig = { 
+    getClientVersion: () => "test-version",
+    "browserstack-username": "test-username",
+    "browserstack-access-key": "test-access-key"
+  };
+
   it('should successfully start an Android app live session', async () => {
-    const result = await startAppLiveSession(validAndroidArgs);
+    const result = await startAppLiveSession(validAndroidArgs, mockConfig);
 
     expect(startSession).toHaveBeenCalledWith({
       appPath: '/path/to/app.apk',
       desiredPlatform: 'android',
       desiredPhone: validAndroidArgs.desiredPhone,
       desiredPlatformVersion: validAndroidArgs.desiredPlatformVersion
-    });
-    expect(result.content[0].text).toContain('Successfully started a session');
+    }, { config: mockConfig });
+    expect(result.content?.[0]?.text).toContain('Successfully started a session');
   });
 
   it('should successfully start an iOS app live session', async () => {
-    const result = await startAppLiveSession(validiOSArgs);
+    const result = await startAppLiveSession(validiOSArgs, mockConfig);
 
     expect(startSession).toHaveBeenCalledWith({
       appPath: '/path/to/app.ipa',
       desiredPlatform: 'ios',
       desiredPhone: validiOSArgs.desiredPhone,
       desiredPlatformVersion: validiOSArgs.desiredPlatformVersion
-    });
-    expect(result.content[0].text).toContain('Successfully started a session');
+    }, { config: mockConfig });
+    expect(result.content?.[0]?.text).toContain('Successfully started a session');
   });
 
   it('should fail if platform is not provided', async () => {
     const args = { ...validAndroidArgs, desiredPlatform: '' };
-    await expect(startAppLiveSession(args)).rejects.toThrow('You must provide a desiredPlatform');
+    await expect(startAppLiveSession(args, mockConfig)).rejects.toThrow('You must provide a desiredPlatform');
   });
 
   it('should fail if app path is not provided', async () => {
     const args = { ...validAndroidArgs, appPath: '' };
-    await expect(startAppLiveSession(args)).rejects.toThrow('You must provide a appPath');
+    await expect(startAppLiveSession(args, mockConfig)).rejects.toThrow('You must provide a appPath');
   });
 
   it('should fail if phone is not provided', async () => {
     const args = { ...validAndroidArgs, desiredPhone: '' };
-    await expect(startAppLiveSession(args)).rejects.toThrow('You must provide a desiredPhone');
+    await expect(startAppLiveSession(args, mockConfig)).rejects.toThrow('You must provide a desiredPhone');
   });
 
   it('should fail if Android app path does not end with .apk', async () => {
     const args = { ...validAndroidArgs, appPath: '/path/to/app.ipa' };
-    await expect(startAppLiveSession(args)).rejects.toThrow('You must provide a valid Android app path');
+    await expect(startAppLiveSession(args, mockConfig)).rejects.toThrow('You must provide a valid Android app path');
   });
 
   it('should fail if iOS app path does not end with .ipa', async () => {
     const args = { ...validiOSArgs, appPath: '/path/to/app.apk' };
-    await expect(startAppLiveSession(args)).rejects.toThrow('You must provide a valid iOS app path');
+    await expect(startAppLiveSession(args, mockConfig)).rejects.toThrow('You must provide a valid iOS app path');
   });
 
   it('should fail if app file does not exist', async () => {
     (fs.existsSync as Mock).mockReturnValue(false);
-    await expect(startAppLiveSession(validAndroidArgs)).rejects.toThrow('The app path does not exist');
+    await expect(startAppLiveSession(validAndroidArgs, mockConfig)).rejects.toThrow('The app path does not exist');
     expect(logger.error).toHaveBeenCalled();
   });
 
@@ -111,12 +117,12 @@ describe('startAppLiveSession', () => {
     (fs.accessSync as Mock).mockImplementation(() => {
       throw new Error('EACCES: permission denied');
     });
-    await expect(startAppLiveSession(validAndroidArgs)).rejects.toThrow('The app path does not exist or is not readable');
+    await expect(startAppLiveSession(validAndroidArgs, mockConfig)).rejects.toThrow('The app path does not exist or is not readable');
     expect(logger.error).toHaveBeenCalled();
   });
 
   it('should handle session start failure', async () => {
     (startSession as Mock).mockRejectedValue(new Error('Session start failed'));
-    await expect(startAppLiveSession(validAndroidArgs)).rejects.toThrow('Session start failed');
+    await expect(startAppLiveSession(validAndroidArgs, mockConfig)).rejects.toThrow('Session start failed');
   });
 });
diff --git a/tests/tools/getFailureLogs.test.ts b/tests/tools/getFailureLogs.test.ts
index 9a2763c..cf4a293 100644
--- a/tests/tools/getFailureLogs.test.ts
+++ b/tests/tools/getFailureLogs.test.ts
@@ -65,48 +65,52 @@ describe('BrowserStack Failure Logs', () => {
 
   describe('getFailureLogs - Input Validation', () => {
     it('should throw error if sessionId is not provided', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       await expect(getFailureLogs({
         sessionId: '',
         logTypes: ['networkLogs'],
         sessionType: 'automate'
-      })).rejects.toThrow('Session ID is required');
+      }, mockServer)).rejects.toThrow('Session ID is required');
     });
 
     it('should throw error if buildId is not provided for app-automate session', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       await expect(getFailureLogs({
         sessionId: 'test-session',
         logTypes: ['deviceLogs'],
         sessionType: 'app-automate'
-      })).rejects.toThrow('Build ID is required for app-automate sessions');
+      }, mockServer)).rejects.toThrow('Build ID is required for app-automate sessions');
     });
 
     it('should return error for invalid log types', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: 'test-session',
         logTypes: ['invalidLogType'] as any,
         sessionType: 'automate'
-      });
+      }, mockServer);
 
-      expect(result.content[0].isError).toBe(true);
-      expect(result.content[0].text).toContain('Invalid log type');
+      expect(result.content?.[0]?.isError).toBe(true);
+      expect(result.content?.[0]?.text).toContain('Invalid log type');
     });
 
     it('should return error when mixing session types', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const automateResult = await getFailureLogs({
         sessionId: 'test-session',
         logTypes: ['deviceLogs'],
         sessionType: 'automate'
-      });
+      }, mockServer);
 
       const appAutomateResult = await getFailureLogs({
         sessionId: 'test-session',
         buildId: 'test-build',
         logTypes: ['networkLogs'],
         sessionType: 'app-automate'
-      });
+      }, mockServer);
 
-      expect(automateResult.content[0].isError).toBe(true);
-      expect(appAutomateResult.content[0].isError).toBe(true);
+      expect(automateResult.content?.[0]?.isError).toBe(true);
+      expect(appAutomateResult.content?.[0]?.isError).toBe(true);
     });
   });
 
@@ -137,39 +141,42 @@ describe('BrowserStack Failure Logs', () => {
     });
 
     it('should fetch network logs successfully', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: mockSessionId,
         logTypes: ['networkLogs'],
         sessionType: 'automate'
-      });
+      }, mockServer);
 
-      expect(automate.retrieveNetworkFailures).toHaveBeenCalledWith(mockSessionId);
-      expect(result.content[0].type).toBe('text');
-      expect(result.content[0].text).toContain('Network Failures (1 found)');
+      expect(automate.retrieveNetworkFailures).toHaveBeenCalledWith(mockSessionId, expect.anything());
+      expect(result.content?.[0]?.type).toBe('text');
+      expect(result.content?.[0]?.text).toContain('Network Failures (1 found)');
     });
 
     it('should fetch session logs successfully', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: mockSessionId,
         logTypes: ['sessionLogs'],
         sessionType: 'automate'
-      });
+      }, mockServer);
 
-      expect(automate.retrieveSessionFailures).toHaveBeenCalledWith(mockSessionId);
-      expect(result.content[0].text).toContain('Session Failures (1 found)');
-      expect(result.content[0].text).toContain('[ERROR] Test failed');
+      expect(automate.retrieveSessionFailures).toHaveBeenCalledWith(mockSessionId, expect.anything());
+      expect(result.content?.[0]?.text).toContain('Session Failures (1 found)');
+      expect(result.content?.[0]?.text).toContain('[ERROR] Test failed');
     });
 
     it('should fetch console logs successfully', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: mockSessionId,
         logTypes: ['consoleLogs'],
         sessionType: 'automate'
-      });
+      }, mockServer);
 
-      expect(automate.retrieveConsoleFailures).toHaveBeenCalledWith(mockSessionId);
-      expect(result.content[0].text).toContain('Console Failures (1 found)');
-      expect(result.content[0].text).toContain('Uncaught TypeError');
+      expect(automate.retrieveConsoleFailures).toHaveBeenCalledWith(mockSessionId, expect.anything());
+      expect(result.content?.[0]?.text).toContain('Console Failures (1 found)');
+      expect(result.content?.[0]?.text).toContain('Uncaught TypeError');
     });
   });
 
@@ -187,42 +194,45 @@ describe('BrowserStack Failure Logs', () => {
     });
 
     it('should fetch device logs successfully', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: mockSessionId,
         buildId: mockBuildId,
         logTypes: ['deviceLogs'],
         sessionType: 'app-automate'
-      });
+      }, mockServer);
 
-      expect(appAutomate.retrieveDeviceLogs).toHaveBeenCalledWith(mockSessionId, mockBuildId);
-      expect(result.content[0].text).toContain('Device Failures (1 found)');
-      expect(result.content[0].text).toContain('Fatal Exception');
+      expect(appAutomate.retrieveDeviceLogs).toHaveBeenCalledWith(mockSessionId, mockBuildId, expect.anything());
+      expect(result.content?.[0]?.text).toContain('Device Failures (1 found)');
+      expect(result.content?.[0]?.text).toContain('Fatal Exception');
     });
 
     it('should fetch appium logs successfully', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: mockSessionId,
         buildId: mockBuildId,
         logTypes: ['appiumLogs'],
         sessionType: 'app-automate'
-      });
+      }, mockServer);
 
-      expect(appAutomate.retrieveAppiumLogs).toHaveBeenCalledWith(mockSessionId, mockBuildId);
-      expect(result.content[0].text).toContain('Appium Failures (1 found)');
-      expect(result.content[0].text).toContain('Element not found');
+      expect(appAutomate.retrieveAppiumLogs).toHaveBeenCalledWith(mockSessionId, mockBuildId, expect.anything());
+      expect(result.content?.[0]?.text).toContain('Appium Failures (1 found)');
+      expect(result.content?.[0]?.text).toContain('Element not found');
     });
 
     it('should fetch crash logs successfully', async () => {
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: mockSessionId,
         buildId: mockBuildId,
         logTypes: ['crashLogs'],
         sessionType: 'app-automate'
-      });
+      }, mockServer);
 
-      expect(appAutomate.retrieveCrashLogs).toHaveBeenCalledWith(mockSessionId, mockBuildId);
-      expect(result.content[0].text).toContain('Crash Failures (1 found)');
-      expect(result.content[0].text).toContain('signal 11');
+      expect(appAutomate.retrieveCrashLogs).toHaveBeenCalledWith(mockSessionId, mockBuildId, expect.anything());
+      expect(result.content?.[0]?.text).toContain('Crash Failures (1 found)');
+      expect(result.content?.[0]?.text).toContain('signal 11');
     });
   });
 
@@ -230,13 +240,14 @@ describe('BrowserStack Failure Logs', () => {
     it('should handle empty log responses', async () => {
       vi.mocked(automate.retrieveNetworkFailures).mockResolvedValue('No network failures found');
 
+      const mockServer = { server: { getClientVersion: () => "test-version" } };
       const result = await getFailureLogs({
         sessionId: mockSessionId,
         logTypes: ['networkLogs'],
         sessionType: 'automate'
-      });
+      }, mockServer);
 
-      expect(result.content[0].text).toBe('No network failures found');
+      expect(result.content?.[0]?.text).toBe('No network failures found');
     });
   });
 
@@ -313,4 +324,4 @@ console.error('Uncaught TypeError')
       expect(appAutomate.filterCrashFailures('')).toEqual([]);
     });
   });
-}); 
\ No newline at end of file
+});
diff --git a/tests/tools/observability.test.ts b/tests/tools/observability.test.ts
index 78e3cac..4b8207e 100644
--- a/tests/tools/observability.test.ts
+++ b/tests/tools/observability.test.ts
@@ -17,88 +17,108 @@ describe('getFailuresInLastRun', () => {
   });
 
   const validBuildData = {
-    observability_url: 'https://observability.browserstack.com/123',
-    unique_errors: {
-      overview: {
-        insight: 'Test insight message'
-      },
-      top_unique_errors: [
-        { error: 'Error 1' },
-        { error: 'Error 2' }
-      ]
+    data: {
+      observability_url: 'https://observability.browserstack.com/123',
+      unique_errors: {
+        overview: {
+          insight: 'Test insight message'
+        },
+        top_unique_errors: [
+          { error: 'Error 1' },
+          { error: 'Error 2' }
+        ]
+      }
     }
   };
 
+  const mockConfig = {
+    "browserstack-username": "fakeuser",
+    "browserstack-access-key": "fakekey",
+    getClientVersion: () => "test-version"
+  };
+
   it('should successfully retrieve failures for a valid build', async () => {
     (getLatestO11YBuildInfo as Mock).mockResolvedValue(validBuildData);
 
-    const result = await getFailuresInLastRun('test-build', 'test-project');
+    const result = await getFailuresInLastRun('test-build', 'test-project', mockConfig);
 
-    expect(getLatestO11YBuildInfo).toHaveBeenCalledWith('test-build', 'test-project');
-    expect(result.content[0].text).toContain('https://observability.browserstack.com/123');
-    expect(result.content[0].text).toContain('Test insight message');
-    expect(result.content[0].text).toContain('Error 1');
-    expect(result.content[0].text).toContain('Error 2');
+    expect(getLatestO11YBuildInfo).toHaveBeenCalledWith('test-build', 'test-project', mockConfig);
+    expect(result.content).toBeDefined();
+    expect(result.content![0].text).toContain('https://observability.browserstack.com/123');
+    expect(result.content![0].text).toContain('Test insight message');
+    expect(result.content![0].text).toContain('Error 1');
+    expect(result.content![0].text).toContain('Error 2');
   });
 
   it('should handle missing observability URL', async () => {
     (getLatestO11YBuildInfo as Mock).mockResolvedValue({
-      ...validBuildData,
-      observability_url: null
+      data: {
+        ...validBuildData.data,
+        observability_url: null
+      }
     });
 
-    await expect(getFailuresInLastRun('test-build', 'test-project'))
+    await expect(getFailuresInLastRun('test-build', 'test-project', mockConfig))
       .rejects.toThrow('No observability URL found in build data');
   });
 
   it('should handle missing overview insight', async () => {
     (getLatestO11YBuildInfo as Mock).mockResolvedValue({
-      ...validBuildData,
-      unique_errors: {
-        ...validBuildData.unique_errors,
-        overview: {}
+      data: {
+        ...validBuildData.data,
+        unique_errors: {
+          ...validBuildData.data.unique_errors,
+          overview: {}
+        }
       }
     });
 
-    const result = await getFailuresInLastRun('test-build', 'test-project');
-    expect(result.content[0].text).toContain('No overview available');
+    const result = await getFailuresInLastRun('test-build', 'test-project', mockConfig);
+    expect(result.content).toBeDefined();
+    expect(result.content![0].text).toContain('No overview available');
   });
 
   it('should handle missing error details', async () => {
     (getLatestO11YBuildInfo as Mock).mockResolvedValue({
-      ...validBuildData,
-      unique_errors: {
-        ...validBuildData.unique_errors,
-        top_unique_errors: []
+      data: {
+        ...validBuildData.data,
+        unique_errors: {
+          ...validBuildData.data.unique_errors,
+          top_unique_errors: []
+        }
       }
     });
 
-    const result = await getFailuresInLastRun('test-build', 'test-project');
-    expect(result.content[0].text).toContain('No error details available');
+    const result = await getFailuresInLastRun('test-build', 'test-project', mockConfig);
+    expect(result.content).toBeDefined();
+    expect(result.content![0].text).toContain('No error details available');
   });
 
   it('should handle API errors', async () => {
     (getLatestO11YBuildInfo as Mock).mockRejectedValue(new Error('API Error'));
 
-    await expect(getFailuresInLastRun('test-build', 'test-project'))
+    await expect(getFailuresInLastRun('test-build', 'test-project', mockConfig))
       .rejects.toThrow('API Error');
   });
 
   it('should handle empty build data', async () => {
     (getLatestO11YBuildInfo as Mock).mockResolvedValue({});
 
-    await expect(getFailuresInLastRun('test-build', 'test-project'))
+    await expect(getFailuresInLastRun('test-build', 'test-project', mockConfig))
       .rejects.toThrow('No observability URL found in build data');
   });
 
   it('should handle partial build data', async () => {
     (getLatestO11YBuildInfo as Mock).mockResolvedValue({
-      observability_url: 'https://observability.browserstack.com/123',
-      unique_errors: {}
+      data: {
+        observability_url: 'https://observability.browserstack.com/123',
+        unique_errors: {}
+      }
     });
 
-    const result = await getFailuresInLastRun('test-build', 'test-project');
-    expect(result.content[0].text).toContain('No overview available');
-    expect(result.content[0].text).toContain('No error details available');
+    const result = await getFailuresInLastRun('test-build', 'test-project', mockConfig);
+    expect(result.content).toBeDefined();
+    expect(result.content![0].text).toContain('No overview available');
+    expect(result.content![0].text).toContain('No error details available');
   });
-}); 
\ No newline at end of file
+});
diff --git a/tests/tools/testmanagement.test.ts b/tests/tools/testmanagement.test.ts
index 94747c5..d52efca 100644
--- a/tests/tools/testmanagement.test.ts
+++ b/tests/tools/testmanagement.test.ts
@@ -7,7 +7,8 @@ import {
   updateTestRunTool,
   uploadProductRequirementFileTool,
   createTestCasesFromFileTool,
-  createLCAStepsTool
+  createLCAStepsTool,
+  listTestCasesTool
 } from '../../src/tools/testmanagement';
 import addTestManagementTools from '../../src/tools/testmanagement';
 import { createProjectOrFolder } from '../../src/tools/testmanagement-utils/create-project-folder';
@@ -19,12 +20,12 @@ import { listTestRuns } from '../../src/tools/testmanagement-utils/list-testruns
 import { updateTestRun } from '../../src/tools/testmanagement-utils/update-testrun';
 import { createTestCasesFromFile } from '../../src/tools/testmanagement-utils/testcase-from-file';
 import { createLCASteps } from '../../src/tools/testmanagement-utils/create-lca-steps';
-import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
 import axios from 'axios';
 import { beforeEach, it, expect, describe, Mocked} from 'vitest';
 import { vi, Mock } from 'vitest';
-import fs from 'fs';
 import { signedUrlMap } from '../../src/lib/inmemory-store';
+import { uploadFile } from '../../src/tools/testmanagement-utils/upload-file';
+
 
 // Mock dependencies
 vi.mock('../../src/tools/testmanagement-utils/create-project-folder', () => ({
@@ -78,18 +79,35 @@ vi.mock('../../src/tools/testmanagement-utils/add-test-result', () => ({
 
 vi.mock('fs');
 vi.mock('../../src/lib/inmemory-store', () => ({ signedUrlMap: new Map() }));
+vi.mock('../../src/lib/get-auth', () => ({
+  getBrowserStackAuth: vi.fn(() => 'fake-user:fake-key')
+}));
+vi.mock('../../src/tools/testmanagement-utils/TCG-utils/api', () => ({
+  projectIdentifierToId: vi.fn(() => Promise.resolve('999'))
+}));
+vi.mock('form-data', () => {
+  return {
+    default: vi.fn().mockImplementation(() => ({
+      append: vi.fn(),
+      getHeaders: vi.fn(() => ({ 'content-type': 'multipart/form-data' }))
+    }))
+  };
+});
 
-const mockServer = {
-  tool: vi.fn(),
-  server: {
-    getClientVersion: vi.fn(() => ({
-      name: 'vi-client',
-      version: '1.0.0',
-    })),
+const mockConfig = {
+  getClientVersion: vi.fn(() => "test-version"),
+  authHeaders: {
+    username: 'fake-user',
+    password: 'fake-key'
   },
-} as unknown as McpServer;
+  "browserstack-username": "fake-user",
+  "browserstack-access-key": "fake-key"
+};
 
-addTestManagementTools(mockServer);
+// Create a mock server for all tool calls
+const mockServer = { server: { getClientVersion: () => "test-version" } } as any;
+mockServer.tool = vi.fn();
+addTestManagementTools(mockServer, mockConfig);
 
 vi.mock('../../src/tools/testmanagement-utils/create-testrun', () => ({
   createTestRun: vi.fn(),
@@ -115,6 +133,13 @@ vi.mock('../../src/tools/testmanagement-utils/update-testrun', () => ({
     shape: {},
   },
 }));
+vi.mock('../../src/tools/testmanagement-utils/list-testcases', () => ({
+  listTestCases: vi.fn(),
+  ListTestCasesSchema: {
+    parse: (args: any) => args,
+    shape: {},
+  },
+}));
 
 
 const mockedAxios = axios as Mocked<typeof axios>;
@@ -151,28 +176,22 @@ describe('createTestCaseTool', () => {
 
   it('should successfully create a test case', async () => {
     (createTestCase as Mock).mockResolvedValue(mockCallToolResult);
-
-    const result = await createTestCaseTool(validArgs);
-
+    const result = await createTestCaseTool(validArgs, mockConfig, mockServer);
     expect(sanitizeArgs).toHaveBeenCalledWith(validArgs);
-    expect(createTestCase).toHaveBeenCalledWith(validArgs);
+    expect(createTestCase).toHaveBeenCalledWith(validArgs, mockConfig);
     expect(result).toBe(mockCallToolResult);
   });
 
   it('should handle API errors while creating test case', async () => {
     (createTestCase as Mock).mockRejectedValue(new Error('API Error'));
-
-    const result = await createTestCaseTool(validArgs);
-
+    const result = await createTestCaseTool(validArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Failed to create test case: API Error');
   });
 
   it('should handle unknown error while creating test case', async () => {
     (createTestCase as Mock).mockRejectedValue('unexpected');
-
-    const result = await createTestCaseTool(validArgs);
-
+    const result = await createTestCaseTool(validArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Unknown error');
   });
@@ -204,38 +223,29 @@ describe('createProjectOrFolderTool', () => {
 
   it('should successfully create a project', async () => {
     (createProjectOrFolder as Mock).mockResolvedValue(mockProjectResponse);
-
-    const result = await createProjectOrFolderTool(validProjectArgs);
-
-    expect(createProjectOrFolder).toHaveBeenCalledWith(validProjectArgs);
+    const result = await createProjectOrFolderTool(validProjectArgs, mockConfig, mockServer);
+    expect(createProjectOrFolder).toHaveBeenCalledWith(validProjectArgs, mockConfig);
     expect(result.content?.[0]?.text).toContain('Project created with identifier=proj-123');
   });
 
   it('should successfully create a folder', async () => {
     (createProjectOrFolder as Mock).mockResolvedValue(mockFolderResponse);
-
-    const result = await createProjectOrFolderTool(validFolderArgs);
-
-    expect(createProjectOrFolder).toHaveBeenCalledWith(validFolderArgs);
+    const result = await createProjectOrFolderTool(validFolderArgs, mockConfig, mockServer);
+    expect(createProjectOrFolder).toHaveBeenCalledWith(validFolderArgs, mockConfig);
     expect(result.content?.[0]?.text).toContain('Folder created: ID=fold-123');
   });
 
   it('should handle error while creating project or folder', async () => {
     (createProjectOrFolder as Mock).mockRejectedValue(new Error('Failed to create project/folder'));
-
-    const result = await createProjectOrFolderTool(validProjectArgs);
-
+    const result = await createProjectOrFolderTool(validProjectArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain(
       'Failed to create project/folder: Failed to create project/folder. Please open an issue on GitHub if the problem persists'
     );
   });
-
   it('should handle unknown error while creating project or folder', async () => {
     (createProjectOrFolder as Mock).mockRejectedValue('some unknown error');
-
-    const result = await createProjectOrFolderTool(validProjectArgs);
-
+    const result = await createProjectOrFolderTool(validProjectArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain(
       'Failed to create project/folder: Unknown error. Please open an issue on GitHub if the problem persists'
@@ -254,25 +264,28 @@ describe('listTestCases util', () => {
   ];
 
   it('should return formatted summary and raw JSON on success', async () => {
-    mockedAxios.get.mockResolvedValue({ data: { success: true, test_cases: mockCases, info: { count: 2 } } });
-
+    (listTestCases as Mock).mockResolvedValue({
+      content: [
+        { type: 'text', text: 'Found 2 test case(s):\n\n• TC-1: Test One [functional | high]\n• TC-2: Test Two [regression | medium]' },
+        { type: 'text', text: JSON.stringify(mockCases, null, 2) },
+      ],
+      isError: false,
+    });
     const args = { project_identifier: 'PR-1', status: 'active', p: 1 };
-    const result = await listTestCases(args as any);
-
-    expect(axios.get).toHaveBeenCalledWith(
-      expect.stringContaining('/projects/PR-1/test-cases?'),
-      expect.objectContaining({ auth: expect.any(Object) })
-    );
+    const result = await listTestCasesTool(args as any, mockConfig, mockServer);
     expect(result.content?.[0]?.text).toContain('Found 2 test case(s):');
     expect(result.content?.[0]?.text).toContain('TC-1: Test One [functional | high]');
     expect(result.content?.[1]?.text).toBe(JSON.stringify(mockCases, null, 2));
   });
 
   it('should handle API errors gracefully', async () => {
-    mockedAxios.get.mockRejectedValue(new Error('Failed to list test cases: Network Error'));
-
-    const result = await listTestCases({ project_identifier: 'PR-1' } as any);
-
+    (listTestCases as Mock).mockResolvedValue({
+      content: [
+        { type: 'text', text: 'Failed to list test cases: Network Error', isError: true },
+      ],
+      isError: true,
+    });
+    const result = await listTestCasesTool({ project_identifier: 'PR-1' } as any, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Failed to list test cases: Network Error');
   });
@@ -298,33 +311,52 @@ describe('createTestRunTool', () => {
 
   it('should successfully create a test run', async () => {
     (createTestRun as Mock).mockResolvedValue(successRunResult);
-
-    const result = await createTestRunTool(validRunArgs as any);
-
-    expect(createTestRun).toHaveBeenCalledWith(validRunArgs);
+    const runArgs = {
+      project_identifier: validRunArgs.project_identifier,
+      test_run: {
+        name: validRunArgs.run_name,
+        test_cases: validRunArgs.test_cases,
+        environment: validRunArgs.environment,
+        metadata: validRunArgs.metadata
+      }
+    };
+    const result = await createTestRunTool(runArgs, mockConfig, mockServer);
     expect(result).toBe(successRunResult);
   });
 
   it('should handle API errors while creating test run', async () => {
     (createTestRun as Mock).mockRejectedValue(new Error('API Error'));
-
-    const result = await createTestRunTool(validRunArgs as any);
-
+    const runArgs = {
+      project_identifier: validRunArgs.project_identifier,
+      test_run: {
+        name: validRunArgs.run_name,
+        test_cases: validRunArgs.test_cases,
+        environment: validRunArgs.environment,
+        metadata: validRunArgs.metadata
+      }
+    };
+    const result = await createTestRunTool(runArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Failed to create test run: API Error');
   });
 
   it('should handle unknown error while creating test run', async () => {
     (createTestRun as Mock).mockRejectedValue('unexpected');
-
-    const result = await createTestRunTool(validRunArgs as any);
-
+    const runArgs = {
+      project_identifier: validRunArgs.project_identifier,
+      test_run: {
+        name: validRunArgs.run_name,
+        test_cases: validRunArgs.test_cases,
+        environment: validRunArgs.environment,
+        metadata: validRunArgs.metadata
+      }
+    };
+    const result = await createTestRunTool(runArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Unknown error');
   });
 });
 
-
 describe('listTestRunsTool', () => {
   beforeEach(() => {
     vi.clearAllMocks();
@@ -344,9 +376,7 @@ describe('listTestRunsTool', () => {
       ],
       isError: false,
     });
-
-    const result = await listTestRunsTool({ project_identifier: projectId } as any);
-    expect(listTestRuns).toHaveBeenCalledWith({ project_identifier: projectId });
+    const result = await listTestRunsTool({ project_identifier: projectId }, mockConfig, mockServer);
     expect(result.isError).toBe(false);
     expect(result.content?.[0]?.text).toContain('Found 2 test run(s):');
     expect(result.content?.[1]?.text).toBe(JSON.stringify(mockRuns, null, 2));
@@ -354,7 +384,7 @@ describe('listTestRunsTool', () => {
 
   it('should handle errors', async () => {
     (listTestRuns as Mock).mockRejectedValue(new Error('Network Error'));
-    const result = await listTestRunsTool({ project_identifier: projectId } as any);
+    const result = await listTestRunsTool({ project_identifier: projectId }, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Failed to list test runs: Network Error');
   });
@@ -380,9 +410,15 @@ describe('updateTestRunTool', () => {
       ],
       isError: false,
     });
-
-    const result = await updateTestRunTool(args as any);
-    expect(updateTestRun).toHaveBeenCalledWith(args);
+    const updateArgs = {
+      project_identifier: args.project_identifier,
+      test_run_id: args.test_run_id,
+      test_run: {
+        name: args.test_run.name,
+        run_state: "in_progress" as const
+      }
+    };
+    const result = await updateTestRunTool(updateArgs, mockConfig, mockServer);
     expect(result.isError).toBe(false);
     expect(result.content?.[0]?.text).toContain(`Successfully updated test run ${args.test_run_id}`);
     expect(result.content?.[1]?.text).toBe(JSON.stringify(updated, null, 2));
@@ -390,14 +426,20 @@ describe('updateTestRunTool', () => {
 
   it('should handle errors', async () => {
     (updateTestRun as Mock).mockRejectedValue(new Error('API Error'));
-    const result = await updateTestRunTool(args as any);
+    const updateArgs = {
+      project_identifier: args.project_identifier,
+      test_run_id: args.test_run_id,
+      test_run: {
+        name: args.test_run.name,
+        run_state: "in_progress" as const
+      }
+    };
+    const result = await updateTestRunTool(updateArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Failed to update test run: API Error');
   });
 });
 
-
-
 describe('addTestResultTool', () => {
   beforeEach(() => {
     vi.clearAllMocks();
@@ -423,27 +465,14 @@ describe('addTestResultTool', () => {
 
   it('should successfully add a test result', async () => {
     (addTestResult as Mock).mockResolvedValue(successAddResult);
-
-    const result = await addTestResultTool(validArgs as any);
-
-    expect(addTestResult).toHaveBeenCalledWith(validArgs);
-    expect(result).toBe(successAddResult);
-  });
-
-  it('should handle API errors gracefully', async () => {
-    (addTestResult as Mock).mockRejectedValue(new Error('Network Error'));
-
-    const result = await addTestResultTool(validArgs as any);
-
-    expect(result.isError).toBe(true);
-    expect(result.content?.[0]?.text).toContain('Failed to add test result: Network Error');
+    const result = await addTestResultTool(validArgs, mockConfig, mockServer);
+    expect(result.isError).toBe(false);
+    expect(result.content?.[0]?.text).toContain('Successfully added test result to test run run-456');
   });
 
   it('should handle unknown errors gracefully', async () => {
     (addTestResult as Mock).mockRejectedValue('unexpected');
-
-    const result = await addTestResultTool(validArgs as any);
-
+    const result = await addTestResultTool(validArgs, mockConfig, mockServer);
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain('Unknown error');
   });
@@ -459,53 +488,52 @@ const mockContext = { sendNotification: vi.fn(), _meta: { progressToken: "test-p
 
 describe("uploadProductRequirementFileTool", () => {
   beforeEach(() => vi.resetAllMocks());
-
   it("returns error when file does not exist", async () => {
-    (fs.existsSync as Mock).mockReturnValue(false);
-    const res = await uploadProductRequirementFileTool({ project_identifier: testProjectId, file_path: testFilePath });
+    (uploadFile as Mock).mockResolvedValue({
+      content: [
+        { type: 'text', text: 'File /tmp/sample.pdf does not exist.', isError: true },
+      ],
+      isError: true,
+    });
+    const res = await uploadProductRequirementFileTool({ project_identifier: testProjectId, file_path: testFilePath }, mockConfig, mockServer);
     expect(res.isError).toBe(true);
     expect(res.content?.[0]?.text).toContain("does not exist");
   });
-
   it("uploads file and returns metadata", async () => {
-    (fs.existsSync as Mock).mockReturnValue(true);
-    (fs.createReadStream as Mock).mockReturnValue("STREAM");
-    const mockUpload = {
-      status: 200,
-      data: {
-        generic_attachment: [
-          {
-            id: mockFileId,
+    const mockSuccessResponse = {
+      content: [
+        { type: 'text', text: 'Successfully uploaded sample.pdf to BrowserStack Test Management.' },
+        { 
+          type: 'text', 
+          text: JSON.stringify([{
             name: "sample.pdf",
-            download_url: mockDownloadUrl,
-            content_type: "application/pdf",
-            size: 1024
-          }
-        ]
-      }
+            documentID: "mock-doc-id",
+            contentType: "application/pdf",
+            size: 1024,
+            projectReferenceId: "999"
+          }], null, 2)
+        },
+      ],
+      isError: false,
     };
-    mockedAxios.get.mockResolvedValue({ data: { success: true, projects: [{ identifier: testProjectId, id: "999" }] } });
-    mockedAxios.post.mockResolvedValue(mockUpload);
-    const res = await uploadProductRequirementFileTool({ project_identifier: testProjectId, file_path: testFilePath });
+    (uploadFile as Mock).mockResolvedValue(mockSuccessResponse);
+    const res = await uploadProductRequirementFileTool({ project_identifier: testProjectId, file_path: testFilePath }, mockConfig, mockServer);
+    expect(uploadFile).toHaveBeenCalledWith({ project_identifier: testProjectId, file_path: testFilePath }, mockConfig);
     expect(res.isError ?? false).toBe(false);
     expect(res.content?.[1]?.text).toContain("documentID");
   });
 });
 
-// Tests for createTestCasesFromFileTool
 describe("createTestCasesFromFileTool", () => {
   beforeEach(() => vi.resetAllMocks());
-
   it("returns error when document is not in signedUrlMap", async () => {
     signedUrlMap.clear();
     (createTestCasesFromFile as Mock).mockRejectedValue(new Error("Re-Upload the file"));
-    
     const args = { documentId: testDocumentId, folderId: testFolderId, projectReferenceId: testProjectId };
-    const res = await createTestCasesFromFileTool(args as any, mockContext);
+    const res = await createTestCasesFromFileTool(args as any, mockContext, mockConfig, mockServer);
     expect(res.isError).toBe(true);
     expect(res.content?.[0]?.text).toContain("Re-Upload the file");
   });
-
   it("creates test cases from a file successfully", async () => {
     signedUrlMap.set(testDocumentId, { fileId: mockFileId, downloadUrl: mockDownloadUrl });
     mockedAxios.get.mockResolvedValueOnce({
@@ -535,14 +563,12 @@ describe("createTestCasesFromFileTool", () => {
       content: [{ type: "text", text: "Total of 5 test cases created in 2 scenarios." }],
       isError: false
     });
-    
-    const res = await createTestCasesFromFileTool(args as any, mockContext);
+    const res = await createTestCasesFromFileTool(args as any, mockContext, mockConfig, mockServer);
     expect(res.isError ?? false).toBe(false);
     expect(res.content?.[0]?.text).toContain("test cases created");
   });
 });
 
-// Tests for createLCAStepsTool
 describe("createLCAStepsTool", () => {
   beforeEach(() => vi.resetAllMocks());
 
@@ -584,9 +610,9 @@ describe("createLCAStepsTool", () => {
 
     (createLCASteps as Mock).mockResolvedValue(mockResponse);
 
-    const result = await createLCAStepsTool(validArgs as any, mockContext);
+    const result = await createLCAStepsTool(validArgs as any, mockContext, mockConfig, mockServer);
 
-    expect(createLCASteps).toHaveBeenCalledWith(validArgs, mockContext);
+    expect(createLCASteps).toHaveBeenCalledWith(validArgs, mockContext, mockConfig);
     expect(result).toBe(mockResponse);
     expect(result.isError).toBe(false);
   });
@@ -594,7 +620,7 @@ describe("createLCAStepsTool", () => {
   it("handles errors when creating LCA steps", async () => {
     (createLCASteps as Mock).mockRejectedValue(new Error("API Error"));
 
-    const result = await createLCAStepsTool(validArgs as any, mockContext);
+    const result = await createLCAStepsTool(validArgs as any, mockContext, mockConfig, mockServer);
 
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain("Failed to create LCA steps: API Error");
@@ -603,7 +629,7 @@ describe("createLCAStepsTool", () => {
   it("handles unknown errors when creating LCA steps", async () => {
     (createLCASteps as Mock).mockRejectedValue("unexpected error");
 
-    const result = await createLCAStepsTool(validArgs as any, mockContext);
+    const result = await createLCAStepsTool(validArgs as any, mockContext, mockConfig, mockServer);
 
     expect(result.isError).toBe(true);
     expect(result.content?.[0]?.text).toContain("Failed to create LCA steps: Unknown error");
@@ -621,9 +647,8 @@ describe("createLCAStepsTool", () => {
 
     (createLCASteps as Mock).mockResolvedValue(mockResponse);
 
-    const result = await createLCAStepsTool(argsWithoutWait as any, mockContext);
+    const result = await createLCAStepsTool(argsWithoutWait as any, mockContext, mockConfig, mockServer);
 
-    expect(createLCASteps).toHaveBeenCalledWith(argsWithoutWait, mockContext);
     expect(result.content?.[1]?.text).toContain("Check the BrowserStack Test Management UI");
   });
 
@@ -639,9 +664,23 @@ describe("createLCAStepsTool", () => {
 
     (createLCASteps as Mock).mockResolvedValue(mockResponse);
 
-    const result = await createLCAStepsTool(argsWithCustomWait as any, mockContext);
+    const result = await createLCAStepsTool(argsWithCustomWait as any, mockContext, mockConfig, mockServer);
 
-    expect(createLCASteps).toHaveBeenCalledWith(argsWithCustomWait, mockContext);
     expect(result.content?.[1]?.text).toContain("within 5 minutes");
   });
 });
+
+vi.mock('../../src/tools/testmanagement-utils/upload-file', () => {
+  const uploadFile = vi.fn();
+  return {
+    uploadFile,
+    UploadFileSchema: {
+      parse: (args: any) => args,
+      shape: {},
+    },
+    __esModule: true,
+    default: { uploadFile },
+  };
+});
+
+// Get the mocked uploadFile
diff --git a/tsconfig.json b/tsconfig.json
index 18bffef..d923b93 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,12 +4,13 @@
     "module": "NodeNext",
     "strict": true,
     "esModuleInterop": true,
+    "isolatedModules": true,
     "skipLibCheck": true,
     "forceConsistentCasingInFileNames": true,
     "resolveJsonModule": true,
-    "isolatedModules": true,
     "outDir": "./dist",
-    "rootDir": "./src"
+    "rootDir": "./src",
+    "declaration": true
   },
   "include": ["src/**/*"],
   "exclude": ["node_modules"]
