# Captain MCP - User Guide & Feature Catalog

Welcome to **Captain MCP**, the enterprise-grade Model Context Protocol server that transforms your AI Agent (like Claude) into a fully autonomous Oracle EPM Administrator.

This guide outlines the massive suite of capabilities your AI now possesses, along with example prompts you can use to control your EPM environment.

---

## 🏗️ 1. Dynamic Architecture Discovery
Your AI Agent does not need to be spoon-fed application or cube names. It can dynamically discover your environment's architecture.

- **`discover_applications`**: Maps out all EPM applications available to the user.
- **`discover_plan_types`**: Discovers all cubes (e.g., `Plan`, `Consol`) within an application.
- **`get_application_summary`**: Generates a deep, AI-friendly markdown summary of your entire application's dimensional structure.

> **Use Case Prompt:**
> *"I just connected to a new EPM environment. Discover the applications and cubes available, and give me a high-level summary of the architecture."*

---

## 🗄️ 2. Metadata & Diagnostics
The AI can introspect your EPM hierarchies and member properties directly.

- **`get_dimension_structure`**: Fetches the full hierarchy of a specific dimension.
- **`get_member_properties`**: Deep inspection of member properties (Data Storage, Two-Pass Calculation, Aliases).
- **`fetch_dimensions`**: Retrieves valid dimensions for targeted data queries.

> **Use Case Prompt:**
> *"Look up the member properties for 'NetIncome' in the Account dimension. Is it set to Dynamic Calc?"*

---

## 🚦 3. Task Manager Orchestration
Modern EPM orchestration relies on the Task Manager. The AI can manage your month-end close schedules.

- **`deploy_tm_template`**: Automatically generates a new Schedule from a pre-defined Task Manager Template.
- **`update_tm_event`**: Updates the status of an external orchestration event (e.g., triggering a task to complete after an external ETL job finishes).

> **Use Case Prompt:**
> *"Deploy the 'Month End Close Q3' template starting on October 1st, and name the new schedule 'October 2026 Close'."*

---

## 🔄 4. Data Management & Automation (AIF)
The AI has full access to the Data Management engine.

- **`execute_job`**: Triggers Data Load Rules, Integration Pipelines, or mapping exports.
- **`export_snapshot`**: Triggers LCM back-ups.

> **Use Case Prompt:**
> *"Run the Data Management integration pipeline named 'Actuals_Load_Nightly'. Let me know when the job completes."*

---

## 📊 5. Data Slices & Business Rules
The AI can extract targeted data, import fixes, and execute calculations.

- **`export_data_slice`**: Extracts high-performance JSON data grids using exact dimensional intersections.
- **`import_data_slice`**: Pushes targeted data updates directly into the cube.
- **`execute_business_rule`**: Triggers Calculation Manager rules with Runtime Prompts (RTPs).

> **Use Case Prompt:**
> *"Extract the Q1 Actuals for the 'Sales' account in the 'NorthAmerica' entity. Then, run the 'Agg_All' business rule."*

---

## ✅ 6. Planning Approvals (Planning Units)
The AI can manage the workflow approval process for planning units.

- **`get_planning_unit_status`**: Checks who currently owns a specific Entity's budget.
- **`promote_planning_unit`**: Promotes, approves, or rejects a planning unit, passing it to the next owner with an annotation.

> **Use Case Prompt:**
> *"Check the approval status of the 'New York' entity. If it's under review, promote it to the next owner and add the annotation 'Ready for final signoff'."*

---

## ⚙️ 7. Infrastructure & Environment Admin
The absolute highest level of administrative control.

- **`get_maintenance_time` / `set_maintenance_time`**: Adjust the daily automated maintenance window.
- **`restart_epm_service`**: Forcefully restarts the EPM service, with an optional flag to auto-tune Essbase caches!
- **`clone_environment`**: Commands Oracle to replicate the current environment directly to a Target Environment URL.

> **Use Case Prompt:**
> *"We need to do some heavy data loading tonight. Change the daily maintenance window to 03:00 AM, and then restart the EPM service with auto-tuning enabled."*

---

## ⚡ 8. Essbase Optimization
Bypass the EPM layer and interact with the backend Essbase engine.

- **`generate_essbase_block_analysis`**: Generates a deep diagnostics HTML report on Block Storage (BSO) cubes to detect inefficiencies.
- **`optimize_aso_cube`**: Manages aggregate views to vastly improve ASO extraction performance.

> **Use Case Prompt:**
> *"Run an Essbase block analysis on our main BSO cube and tell me if we have an excessive amount of empty blocks."*

---

## 🛡️ 9. Security & Identity Governance
Full Identity and Access Management (IAM) capabilities natively within EPM.

- **`create_epm_group`**: Creates a new Native Directory security group.
- **`add_users_to_group` / `remove_users_from_group`**: Manages group rosters.
- **`assign_user_role`**: Assigns high-level Application Roles (e.g., Service Administrator, Power User).
- **`assign_group_roles`**: Assigns granular access permissions to groups.

> **Use Case Prompt:**
> *"Create a new security group called 'FP&A_Analysts'. Add John and Sarah to it, and then assign the 'Power User' application role to both of them."*

---

## 📈 10. Audit & Activity Telemetry
Turn your AI into a proactive environment health monitor.

- **`fetch_activity_reports`**: Dynamically scours the Migration repository, downloading up to 60 days of raw JSON telemetry (block density, DB sizes, top executing rules).
- **`export_audit_logs`**: Extracts the application's audit history (metadata changes, data changes).
- **`generate_login_reports`**: Generates security reports detailing successful and failed login attempts to detect intrusion.

> **Use Case Prompt:**
> *"Fetch the last 14 days of Activity Reports. Chart the trend of our Database Size and Block Density. Are we approaching performance degradation?"*

---

> [!IMPORTANT]  
> **Enterprise Authentication (OAuth 2.0)**  
> Captain MCP features a sophisticated Dual-Mode authentication engine. By default, it supports legacy Basic Auth (`EPM_USERNAME`). However, by entering your OCI Identity parameters (`OCI_TENANT_URL`, `OCI_CLIENT_ID`, `OCI_REFRESH_TOKEN`) in the `.env` file, the server automatically upgrades to **Enterprise OAuth 2.0 Bearer Token Authentication**, ensuring compliance with strict MFA IT policies.
