@testomatio/mcp 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +28 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -8,9 +8,29 @@ import {
8
8
  } from '@modelcontextprotocol/sdk/types.js';
9
9
  import { program } from 'commander';
10
10
 
11
+ function normalizeString(value) {
12
+ return typeof value === 'string' ? value.trim() : value;
13
+ }
14
+
15
+ function normalizeBaseUrl(value) {
16
+ if (typeof value !== 'string') {
17
+ return value;
18
+ }
19
+
20
+ const trimmed = value.trim();
21
+ // Remove any internal whitespace characters that may appear when the URL
22
+ // gets broken across lines (e.g. "http://\n localhost:3000").
23
+ return trimmed.replace(/\s+/g, '');
24
+ }
25
+
11
26
  class TestomatioMCPServer {
12
27
  constructor(config) {
13
- this.config = config;
28
+ this.config = {
29
+ ...config,
30
+ token: normalizeString(config.token),
31
+ projectId: normalizeString(config.projectId),
32
+ baseUrl: normalizeBaseUrl(config.baseUrl),
33
+ };
14
34
  this.jwtToken = null;
15
35
  this.server = new Server(
16
36
  {
@@ -1285,9 +1305,13 @@ function parseArgs() {
1285
1305
 
1286
1306
  const options = program.opts();
1287
1307
 
1288
- const token = options.token || process.env.TESTOMATIO_API_TOKEN;
1289
- const projectId = options.project || process.env.TESTOMATIO_PROJECT_ID;
1290
- const baseUrl = options.baseUrl || process.env.TESTOMATIO_BASE_URL || 'https://app.testomat.io';
1308
+ const token = normalizeString(options.token || process.env.TESTOMATIO_API_TOKEN);
1309
+ const projectId = normalizeString(options.project || process.env.TESTOMATIO_PROJECT_ID);
1310
+ const baseUrl = normalizeBaseUrl(
1311
+ options.baseUrl ||
1312
+ process.env.TESTOMATIO_BASE_URL ||
1313
+ 'https://app.testomat.io'
1314
+ );
1291
1315
 
1292
1316
  if (!token) {
1293
1317
  console.error('Error: API token is required. Use --token <token> or set TESTOMATIO_API_TOKEN environment variable');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/mcp",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Model Context Protocol server for Testomatio API",
5
5
  "main": "index.js",
6
6
  "bin": {