@jupiterone/jupiterone-mcp
Version:
Model Context Protocol server for JupiterOne account rules and rule details
150 lines • 6.03 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JupiterOneClient = void 0;
const graphql_request_1 = require("graphql-request");
const alert_service_js_1 = require("./services/alert-service.js");
const rule_service_js_1 = require("./services/rule-service.js");
const dashboard_service_js_1 = require("./services/dashboard-service.js");
const account_service_js_1 = require("./services/account-service.js");
const integration_service_js_1 = require("./services/integration-service.js");
const j1ql_service_js_1 = require("./services/j1ql-service.js");
class JupiterOneClient {
client;
config;
alertService;
ruleService;
dashboardService;
accountService;
integrationService;
j1qlService;
constructor(config) {
this.config = config;
const headers = {
Authorization: `Bearer ${config.oauthToken || config.apiKey}`,
'Content-Type': 'application/json',
};
if (config.accountId) {
headers['LifeOmic-Account'] = config.accountId;
}
this.client = new graphql_request_1.GraphQLClient(config.baseUrl || 'https://graphql.us.jupiterone.io', {
headers,
});
this.alertService = new alert_service_js_1.AlertService(this.client);
this.ruleService = new rule_service_js_1.RuleService(this.client);
this.dashboardService = new dashboard_service_js_1.DashboardService(this.client);
this.accountService = new account_service_js_1.AccountService(this.client);
this.integrationService = new integration_service_js_1.IntegrationService(this.client);
this.j1qlService = new j1ql_service_js_1.J1qlService(this.client);
}
cloneWithAccountId(accountId) {
const newConfig = { ...this.config, accountId };
return new JupiterOneClient(newConfig);
}
// Alert methods
async listAlertInstances(...args) {
return this.alertService.listAlertInstances(...args);
}
async getAllAlertInstances(...args) {
return this.alertService.getAllAlertInstances(...args);
}
// Rule methods
async listRuleInstances(...args) {
return this.ruleService.listRuleInstances(...args);
}
async getAllRuleInstances(...args) {
return this.ruleService.getAllRuleInstances(...args);
}
async createInlineQuestionRuleInstance(...args) {
return this.ruleService.createInlineQuestionRuleInstance(...args);
}
async updateInlineQuestionRuleInstance(...args) {
return this.ruleService.updateInlineQuestionRuleInstance(...args);
}
async createReferencedQuestionRuleInstance(...args) {
return this.ruleService.createReferencedQuestionRuleInstance(...args);
}
async updateReferencedQuestionRuleInstance(...args) {
return this.ruleService.updateReferencedQuestionRuleInstance(...args);
}
async deleteRuleInstance(...args) {
return this.ruleService.deleteRuleInstance(...args);
}
async evaluateRuleInstance(...args) {
return this.ruleService.evaluateRuleInstance(...args);
}
async listRuleEvaluations(...args) {
return this.ruleService.listRuleEvaluations(...args);
}
async getAllRuleEvaluations(...args) {
return this.ruleService.getAllRuleEvaluations(...args);
}
async getRuleEvaluationDetails(...args) {
return this.ruleService.getRuleEvaluationDetails(...args);
}
async getRawDataDownloadUrl(...args) {
return this.ruleService.getRawDataDownloadUrl(...args);
}
async getRawDataResults(...args) {
return this.ruleService.getRawDataResults(...args);
}
// Dashboard methods
async getDashboards() {
return this.dashboardService.getDashboards();
}
async createDashboard(...args) {
return this.dashboardService.createDashboard(...args);
}
async getDashboard(...args) {
return this.dashboardService.getDashboard(...args);
}
async createDashboardWidget(...args) {
return this.dashboardService.createDashboardWidget(...args);
}
async updateDashboard(...args) {
return this.dashboardService.updateDashboard(...args);
}
// Account methods
async getAccountInfo() {
return this.accountService.getAccountInfo();
}
async testConnection() {
return this.accountService.testConnection();
}
// Integration methods
async getIntegrationDefinitions(...args) {
return this.integrationService.getIntegrationDefinitions(...args);
}
async getIntegrationInstances(...args) {
return this.integrationService.getIntegrationInstances(...args);
}
async getIntegrationJobs(...args) {
return this.integrationService.getIntegrationJobs(...args);
}
/**
* Get details for a specific integration job
* @param integrationJobId ID of the job to get
* @param integrationInstanceId ID of the instance the job belongs to
*/
async getIntegrationJob(integrationJobId, integrationInstanceId) {
return this.integrationService.getIntegrationJob(integrationJobId, integrationInstanceId);
}
/**
* Get events for a specific integration job
* @param jobId ID of the job to get events for
* @param integrationInstanceId ID of the instance the job belongs to
* @param cursor Optional cursor for pagination
* @param size Optional size limit for number of events to return
*/
async getIntegrationEvents(jobId, integrationInstanceId, cursor, size) {
return this.integrationService.getIntegrationEvents(jobId, integrationInstanceId, cursor, size);
}
// J1QL methods
async createJ1qlFromNaturalLanguage(...args) {
return this.j1qlService.createJ1qlFromNaturalLanguage(...args);
}
async executeJ1qlQuery(...args) {
return this.j1qlService.executeJ1qlQuery(...args);
}
}
exports.JupiterOneClient = JupiterOneClient;
//# sourceMappingURL=jupiterone-client.js.map