greenline-works-mcp-server 0.2.0 → 0.2.1
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.
- package/package.json +1 -1
- package/src/client.js +12 -3
- package/src/constants.js +1 -1
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -62,18 +62,27 @@ const makeApiRequest = async (endpoint, { method = 'GET', body, query } = {}) =>
|
|
|
62
62
|
? Object.fromEntries(Object.entries(query).filter(([, value]) => value !== undefined && value !== null))
|
|
63
63
|
: undefined;
|
|
64
64
|
|
|
65
|
-
const
|
|
65
|
+
const requestConfig = {
|
|
66
66
|
method,
|
|
67
67
|
url: buildUrl(config.baseUrl, endpoint),
|
|
68
68
|
data: body,
|
|
69
69
|
params: cleanedQuery,
|
|
70
70
|
timeout: REQUEST_TIMEOUT_MS,
|
|
71
|
-
auth: { username: config.accessId, password: config.secret },
|
|
72
71
|
headers: {
|
|
73
72
|
'Content-Type': 'application/json',
|
|
74
73
|
Accept: 'application/json',
|
|
75
74
|
},
|
|
76
|
-
}
|
|
75
|
+
};
|
|
76
|
+
// A multi-tenant host may bind an OAuth bearer token instead of an accessId/secret pair
|
|
77
|
+
// (runWithCredentials) — forward it as a Bearer header. Otherwise authenticate with HTTP Basic,
|
|
78
|
+
// exactly as the stdio path always has.
|
|
79
|
+
if (config.bearerToken) {
|
|
80
|
+
requestConfig.headers.Authorization = `Bearer ${config.bearerToken}`;
|
|
81
|
+
} else {
|
|
82
|
+
requestConfig.auth = { username: config.accessId, password: config.secret };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const response = await axios.request(requestConfig);
|
|
77
86
|
return response.data;
|
|
78
87
|
};
|
|
79
88
|
|