chore: mcp-proxmox README and index updates
Made-with: Cursor
This commit is contained in:
15
index.js
15
index.js
@@ -48,6 +48,13 @@ if (!loadEnvFile(envPath)) {
|
||||
}
|
||||
}
|
||||
|
||||
function formatProxmoxAuthHeader(user, tokenName, tokenValue) {
|
||||
if (tokenName.includes('!')) {
|
||||
return `PVEAPIToken=${tokenName}=${tokenValue}`;
|
||||
}
|
||||
return `PVEAPIToken=${user}!${tokenName}=${tokenValue}`;
|
||||
}
|
||||
|
||||
class ProxmoxServer {
|
||||
constructor() {
|
||||
this.server = new Server(
|
||||
@@ -139,7 +146,11 @@ class ProxmoxServer {
|
||||
const url = `${baseUrl}${endpoint}`;
|
||||
|
||||
const headers = {
|
||||
'Authorization': `PVEAPIToken=${this.proxmoxUser}!${this.proxmoxTokenName}=${this.proxmoxTokenValue}`,
|
||||
'Authorization': formatProxmoxAuthHeader(
|
||||
this.proxmoxUser,
|
||||
this.proxmoxTokenName,
|
||||
this.proxmoxTokenValue
|
||||
),
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
|
||||
@@ -3159,4 +3170,4 @@ class ProxmoxServer {
|
||||
}
|
||||
|
||||
const server = new ProxmoxServer();
|
||||
server.run().catch(console.error);
|
||||
server.run().catch(console.error);
|
||||
|
||||
Reference in New Issue
Block a user