Skip to main content
The OCI Usage MCP server provides tools for interacting with Oracle Cloud Infrastructure Usage service, enabling tracking and analysis of resource usage and consumption.

Installation

uvx oracle.oci-usage-mcp-server

Running the Server

STDIO Transport Mode

uvx oracle.oci-usage-mcp-server

HTTP Streaming Transport Mode

ORACLE_MCP_HOST=<hostname/IP address> ORACLE_MCP_PORT=<port number> uvx oracle.oci-usage-mcp-server

Available Tools

The server provides the following tools for usage tracking:
Tool NameDescription
list_usage_reportsList usage reports in the tenancy
get_usage_reportGet usage report by ID

Usage Examples

List Usage Reports

List all usage reports for my tenancy
Retrieves all available usage reports showing resource consumption over time.

Get Specific Report

Get usage report for January 2024
Retrieves detailed usage data for a specific time period.
Show usage report ocid1.usagereport.oc1..example
Fetches a specific report by its OCID.

Understanding OCI Usage

What is Usage Reporting?

OCI Usage service provides detailed consumption data for:
  • Resource Usage - Track usage of compute, storage, network, and other services
  • Cost Analysis - Understand spending patterns
  • Trend Analysis - Monitor usage over time
  • Chargeback - Allocate costs to teams or projects
  • Budget Planning - Forecast future usage and costs

Usage Data Granularity

Usage reports provide:
  • Hourly usage data
  • Daily summaries
  • Monthly aggregations
  • Service-level breakdowns
  • Compartment-level attribution
  • Tag-based grouping

Usage Metrics

Common usage metrics include: Compute
  • Instance hours by shape
  • OCPU hours
  • Memory GB hours
  • Boot volume storage
Storage
  • Block volume GB months
  • Object storage GB hours
  • File storage GB hours
  • Backup storage
Network
  • Data transfer GB
  • Load balancer hours
  • VPN connection hours
  • FastConnect bandwidth
Database
  • Database OCPU hours
  • Storage GB months
  • Backup storage
  • Data Guard configuration hours

Authentication

The server uses OCI CLI configuration from ~/.oci/config:
oci setup config

Required Permissions

Your OCI user or instance principal needs these IAM permissions: Read Usage Reports:
Allow group UsageReaders to read usage-reports in tenancy
Allow group UsageReaders to read usage-budgets in tenancy
Manage Usage Reports:
Allow group UsageAdmins to manage usage-reports in tenancy
Allow group UsageAdmins to manage usage-budgets in tenancy
Security NoticeAll actions are performed with the permissions of the configured OCI CLI profile. We advise:
  • Least-privilege IAM setup
  • Secure credential management
  • Safe network practices
  • Secure logging
  • Never expose secrets in logs or responses

Common Use Cases

Cost Management

  • Track monthly spending
  • Identify cost trends
  • Compare usage across periods
  • Forecast future costs
  • Set budget alerts

Showback & Chargeback

  • Allocate costs by compartment
  • Tag-based cost allocation
  • Generate departmental reports
  • Track project costs
  • Invoice internal customers

Usage Optimization

  • Identify unused resources
  • Find optimization opportunities
  • Track usage efficiency
  • Right-size resources
  • Reduce waste

Capacity Planning

  • Analyze growth trends
  • Forecast resource needs
  • Plan for scaling
  • Budget for expansion
  • Avoid capacity shortages

Compliance & Auditing

  • Track resource consumption
  • Verify usage policies
  • Generate compliance reports
  • Audit spending patterns
  • Document resource usage

Best Practices

Tagging for Cost Allocation

  • Tag all resources at creation
  • Use consistent tag namespaces
  • Define cost center tags
  • Tag by project, environment, owner
  • Automate tagging policies

Regular Monitoring

  • Review usage reports weekly/monthly
  • Set up automated reporting
  • Track usage anomalies
  • Monitor cost trends
  • Investigate unexpected spikes

Budget Management

  • Set realistic budgets
  • Configure budget alerts
  • Track budget vs. actual
  • Adjust budgets based on trends
  • Plan for seasonal variations

Cost Optimization

  • Identify idle resources
  • Right-size over-provisioned resources
  • Use cheaper storage tiers
  • Delete unused resources
  • Leverage reserved capacity

Additional Resources

Build docs developers (and LLMs) love