- MCP Server for IBM Instana
- Architecture Overview
- Workflow
- Prerequisites
- Option 1: Install from PyPI (Recommended)
- Option 2: Development Installation
- Installing uv
- Setting Up the Environment
- Header-Based Authentication for Streamable HTTP Mode
- Starting the Local MCP Server
- Server Command Options
- Using the CLI (PyPI Installation)
- Using Development Installation
- Starting in Streamable HTTP Mode
- Using CLI (PyPI Installation)
- Using Development Installation
- Starting in Stdio Mode
- Using CLI (PyPI Installation)
- Using Development Installation
- Tool Categories
- Using CLI (PyPI Installation)
- Using Development Installation
- Verifying Server Status
- Common Startup Issues
- Setup and Usage
- Claude Desktop
- Streamable HTTP Mode
- Stdio Mode
- GitHub Copilot
- Streamable HTTP Mode
- Stdio Mode
- Supported Features
- Available Tools
- Tool Filtering
- Available Tool Categories
- Usage Examples
- Using CLI (PyPI Installation)
- Using Development Installation
- Benefits of Tool Filtering
- Example Prompts
- Docker Deployment
- Docker Architecture
- pyproject.toml (Development)
- pyproject-runtime.toml (Production)
- Building the Docker Image
- Prerequisites
- Build Command
- Troubleshooting
- Docker Issues
- Container Won't Start
- Connection Issues
- Performance Issues
- General Issues
MCP Server for IBM Instana
The Instana MCP server enables seamless interaction with the Instana observability platform, allowing you to access real-time observability data directly within your development workflow.
It serves as a bridge between clients (such as AI agents or custom tools) and the Instana REST APIs, converting user queries into Instana API requests and formatting the responses into structured, easily consumable formats.
The server supports both Streamable HTTP and Stdio transport modes for maximum compatibility with different MCP clients. For more details, refer to the MCP Transport Modes specification.
Architecture Overview```mermaid
graph LR
subgraph "Application Host Process"
MH[MCP Host]
MSI[Instana MCP Server]
MST[ProductA MCP Server]
MSC[ProductB MCP Server]
MH <--> MSI
MH <--> MSC
MH <--> MST
end
subgraph "Remote Service"
II[Instana Instance]
TI[ProductA Instance]
CI[ProductB Instance]
MSI <--> II
MST <--> TI
MSC <--> CI
end
subgraph "LLM"
L[LLM]
MH <--> L
end
## Workflow
Consider a simple example: You're using an MCP Host (such as Claude Desktop, VS Code, or another client) connected to the Instana MCP Server. When you request information about Instana alerts, the following process occurs:
1. The MCP client retrieves the list of available tools from the Instana MCP server
2. Your query is sent to the LLM along with tool descriptions
3. The LLM analyzes the available tools and selects the appropriate one(s) for retrieving Instana alerts
4. The client executes the chosen tool(s) through the Instana MCP server
5. Results (latest alerts) are returned to the LLM
6. The LLM formulates a natural language response
7. The response is displayed to you```mermaid
sequenceDiagram
participant User
participant ChatBot as MCP Host
participant MCPClient as MCP Client
participant MCPServer as Instana MCP Server
participant LLM
participant Instana as Instana Instance
ChatBot->>MCPClient: Load available tools from MCP Server
MCPClient->>MCPServer: Request available tool list
MCPServer->>MCPClient: Return list of available tools
User->>ChatBot: Ask "Show me the latest alerts from Instana for application robot-shop"
ChatBot->>MCPClient: Forward query
MCPClient->>LLM: Send query and tool description
LLM->>MCPClient: Select appropriate tool(s) for Instana alert query
MCPClient->>MCPServer: Execute selected tool(s)
MCPServer->>Instana: Retrieve alerts for application robot-shop
MCPServer->>MCPClient: Send alerts of Instana result
MCPClient->>LLM: Forward alerts of Instana
LLM->>ChatBot: Generate natural language response for Instana alerts
ChatBot->>User: Show Instana alert response
Prerequisites
Option 1: Install from PyPI (Recommended)
The easiest way to use mcp-instana is to install it directly from PyPI:```shell
pip install mcp-instana
After installation, you can run the server using the `mcp-instana` command directly.
### Option 2: Development Installation
For development or local customization, you can clone and set up the project locally.
#### Installing uv
This project uses `uv`, a fast Python package installer and resolver. To install `uv`, you have several options:
**Using pip:**```shell
pip install uv
Using Homebrew (macOS):```shell
brew install uv
For more installation options and detailed instructions, visit the uv documentation.
#### Setting Up the Environment
After installing `uv`, set up the project environment by running:```shell
uv sync
Header-Based Authentication for Streamable HTTP Mode
When using Streamable HTTP mode, you must pass Instana credentials via HTTP headers. This approach enhances security and flexibility by:
- Avoiding credential storage in environment variables
- Enabling the use of different credentials for different requests
- Supporting shared environments where environment variable modification is restricted
Required Headers:
- instana-base-url: Your Instana instance URL
- instana-api-token: Your Instana API token
Authentication Flow:
1. HTTP headers (instana-base-url, instana-api-token) must be present in each request
2. Requests without these headers will fail
This design ensures secure credential transmission where credentials are only sent via headers for each request, making it suitable for scenarios requiring different credentials or avoiding credential storage in environment variables.
Starting the Local MCP Server
Before configuring any MCP client (Claude Desktop, GitHub Copilot, or custom MCP clients), you need to start the local MCP server. The server supports two transport modes: Streamable HTTP and Stdio.
Server Command Options
Using the CLI (PyPI Installation)
If you installed mcp-instana from PyPI, use the mcp-instana command:```bash
mcp-instana [OPTIONS]
#### Using Development Installation
For local development, use the `uv run` command:```bash
uv run src/core/server.py [OPTIONS]
Available Options:
- --transport: Transport mode (choices: streamable-http, stdio)
- --debug: Enable debug mode with additional logging
- --log-level: Set the logging level (choices: DEBUG, INFO, WARNING, ERROR, CRITICAL)
- --tools: Comma-separated list of tool categories to enable (e.g., infra,app,events,automation,website). Enabling a category will also enable its related prompts. For example: --tools infra enables the infra tools and all infra-related prompts.
- --list-tools: List all available tool categories and exit
- --port: Port to listen on (default: 8080)
- --help: Show help message and exit
Starting in Streamable HTTP Mode
Streamable HTTP mode provides a REST API interface and is recommended for most use cases.
Using CLI (PyPI Installation)```bash
Start with all tools enabled (default)
mcp-instana --transport streamable-http
Start with debug logging
mcp-instana --transport streamable-http --debug
Start with a specific log level
mcp-instana --transport streamable-http --log-level WARNING
Start with specific tool categories only
mcp-instana --transport streamable-http --tools infra,events
Combine options (specific log level, custom tools)
mcp-instana --transport streamable-http --log-level DEBUG --tools app,events
#### Using Development Installation```bash
# Start with all tools enabled (default)
uv run src/core/server.py --transport streamable-http
# Start with debug logging
uv run src/core/server.py --transport streamable-http --debug
# Start with a specific log level
uv run src/core/server.py --transport streamable-http --log-level WARNING
# Start with specific tool and prompts categories only
uv run src/core/server.py --transport streamable-http --tools infra,events
# Combine options (specific log level, custom tools and prompts)
uv run src/core/server.py --transport streamable-http --log-level DEBUG --tools app,events
Key Features of Streamable HTTP Mode:
- Uses HTTP headers for authentication (no environment variables needed)
- Supports different credentials per request
- Better suited for shared environments
- Default port: 8080
- Endpoint: http://0.0.0.0:8080/mcp/
Starting in Stdio Mode
Stdio mode uses standard input/output for communication and requires environment variables for authentication.
Using CLI (PyPI Installation)```bash
Set environment variables first
export INSTANA_BASE_URL="https://your-instana-instance.instana.io"
export INSTANA_API_TOKEN="your_instana_api_token"
Start the server (stdio is the default if no transport specified)
mcp-instana
Or explicitly specify stdio mode
mcp-instana --transport stdio
#### Using Development Installation```bash
# Set environment variables first
export INSTANA_BASE_URL="https://your-instana-instance.instana.io"
export INSTANA_API_TOKEN="your_instana_api_token"
# Start the server (stdio is the default if no transport specified)
uv run src/core/server.py
# Or explicitly specify stdio mode
uv run src/core/server.py --transport stdio
Key Features of Stdio Mode:
- Uses environment variables for authentication
- Direct communication via stdin/stdout
- Required for certain MCP client configurations
Tool Categories
You can optimize server performance by enabling only the tools and prompts categories you need:
Using CLI (PyPI Installation)```bash
List all available categories
mcp-instana --list-tools
Enable specific categories
mcp-instana --transport streamable-http --tools infra,app
mcp-instana --transport streamable-http --tools events
#### Using Development Installation```bash
# List all available categories
uv run src/core/server.py --list-tools
# Enable specific categories
uv run src/core/server.py --transport streamable-http --tools infra,app
uv run src/core/server.py --transport streamable-http --tools events
Available Categories:
- infra: Infrastructure monitoring tools and prompts (resources, catalog, topology, analyze, metrics)
- app: Application performance tools and prompts (resources, metrics, alerts, catalog, topology, analyze, settings, global alerts)
- events: Event monitoring tools and prompts (Kubernetes events, agent monitoring)
- automation: Automation-related tools and prompts (action catalog, action history)
- website: Website monitoring tools and prompts (metrics, catalog, analyze, configuration)
Verifying Server Status
Once started, you can verify the server is running:
For Streamable HTTP mode:```bash
Check server health
curl http://0.0.0.0:8080/mcp/
Or with custom port
curl http://0.0.0.0:9000/mcp/
**For Stdio mode:**
The server will start and wait for stdin input from MCP clients.
### Common Startup Issues
**Certificate Issues:**
If you encounter SSL certificate errors, ensure your Python environment has access to system certificates:```bash
# macOS - Install certificates for Python
/Applications/Python\ 3.13/Install\ Certificates.command
Port Already in Use:
If port 8080 is already in use, specify a different port:```bash
uv run src/core/server.py --transport streamable-http --port 9000
**Missing Dependencies:**
Ensure all dependencies are installed:```bash
uv sync
Setup and Usage
Claude Desktop
Claude Desktop supports both Streamable HTTP and Stdio modes for MCP integration.
Configure Claude Desktop by editing the configuration file:
File Locations:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
- Windows: %APPDATA%\Claude\claude_desktop_config.json
Streamable HTTP Mode
The Streamable HTTP mode provides a REST API interface for MCP communication using JSON-RPC over HTTP.
Step 1: Start the MCP Server in Streamable HTTP Mode
Before configuring Claude Desktop, you need to start the MCP server in Streamable HTTP mode. Please refer to the Starting the Local MCP Server section for detailed instructions.
Step 2: Configure Claude Desktop
Configure Claude Desktop to pass Instana credentials via headers:```json:claude_desktop_config.json
{
"mcpServers": {
"Instana MCP Server": {
"command": "npx",
"args": [
"mcp-remote", "http://0.0.0.0:8080/mcp/",
"--allow-http",
"--header", "instana-base-url: https://your-instana-instance.instana.io",
"--header", "instana-api-token: your_instana_api_token"
]
}
}
}
**Note:** To use npx, we recommend first installing NVM (Node Version Manager), then using it to install Node.js.
Installation instructions are available at: https://nodejs.org/en/download
**Step 3: Test the Connection**
Restart Claude Desktop. You should now see Instana MCP Server in the Claude Desktop interface as shown below:
You can now run queries in Claude Desktop:```
get me all endpoints from Instana
Stdio Mode
Configuration using CLI (PyPI Installation - Recommended):```json
{
"mcpServers": {
"Instana MCP Server": {
"command": "mcp-instana",
"args": ["--transport", "stdio"],
"env": {
"INSTANA_BASE_URL": "https://your-instana-instance.instana.io",
"INSTANA_API_TOKEN": "your_instana_api_token"
}
}
}
}
**Note:** If you encounter "command not found" errors, use the full path to mcp-instana. Find it with `which mcp-instana` and use that path instead.
**Configuration using Development Installation:**```json
{
"mcpServers": {
"Instana MCP Server": {
"command": "uv",
"args": [
"--directory",
"<path-to-mcp-instana-folder>",
"run",
"src/core/server.py"
],
"env": {
"INSTANA_BASE_URL": "https://your-instana-instance.instana.io",
"INSTANA_API_TOKEN": "your_instana_api_token"
}
}
}
}
GitHub Copilot
GitHub Copilot supports MCP integration through VS Code configuration.
For GitHub Copilot integration with VS Code, refer to this setup guide.
Streamable HTTP Mode
Step 1: Start the MCP Server in Streamable HTTP Mode
Before configuring VS Code, you need to start the MCP server in Streamable HTTP mode. Please refer to the Starting the Local MCP Server section for detailed instructions.
Step 2: Configure VS Code
Refer to Use MCP servers in VS Code for detailed configuration.
You can directly create or update .vscode/mcp.json with the following configuration:```json:.vscode/mcp.json
{
"servers": {
"Instana MCP Server": {
"command": "npx",
"args": [
"mcp-remote", "http://0.0.0.0:8080/mcp/",
"--allow-http",
"--header", "instana-base-url: https://your-instana-instance.instana.io",
"--header", "instana-api-token: your_instana_api_token"
],
"env": {
"PATH": "/usr/local/bin:/bin:/usr/bin",
"SHELL": "/bin/sh"
}
}
}
}
**Note:** Replace the following values with your actual configuration:
- `instana-base-url`: Your Instana instance URL
- `instana-api-token`: Your Instana API token
- `command`: Update the npx path to match your system's Node.js installation (e.g., `/path/to/your/node/bin/npx`)
- Environment variables: Adjust PATH and other environment variables as needed for your system
#### Stdio Mode
**Step 1: Create VS Code MCP Configuration**
**Using CLI (PyPI Installation - Recommended):**
Create `.vscode/mcp.json` in your project root:```json:.vscode/mcp.json
{
"servers": {
"Instana MCP Server": {
"command": "mcp-instana",
"args": ["--transport", "stdio"],
"env": {
"INSTANA_BASE_URL": "https://your-instana-instance.instana.io",
"INSTANA_API_TOKEN": "your_instana_api_token"
}
}
}
}
Using Development Installation:
Create .vscode/mcp.json in your project root:```json:.vscode/mcp.json
{
"servers": {
"Instana MCP Server": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/your/project/mcp-instana",
"run",
"src/core/server.py"
],
"env": {
"INSTANA_BASE_URL": "https://your-instana-instance.instana.io",
"INSTANA_API_TOKEN": "your_instana_api_token"
}
}
}
}
**Note:** Replace the following values with your actual configuration:
- For CLI installation: Ensure `mcp-instana` is in your PATH
- For development installation:
- `command`: Update the uv path to match your system's uv installation (e.g., `/path/to/your/uv/bin/uv` or `/usr/local/bin/uv`)
- `--directory`: Update with the absolute path to your mcp-instana project directory
- `INSTANA_BASE_URL`: Your Instana instance URL
- `INSTANA_API_TOKEN`: Your Instana API token
**Step 2: Manage Server in VS Code**
1. **Open `.vscode/mcp.json`** - you'll see server management controls at the top
2. **Click `Start`** next to `Instana MCP Server` to start the server
3. Running status along with the number of tools indicates the server is running
**Step 3: Test Integration**
Switch to Agent Mode in GitHub Copilot and reload tools.
Here is an example of a GitHub Copilot response:
## Supported Features
- [ ] Application
- [ ] Application Metrics
- [ ] Application Metrics
- [ ] Endpoint Metrics
- [ ] Service Metrics
- [ ] Data Metrics
- [x] Application Resources
- [x] Get Applications Endpoints
- [x] Get Applications
- [x] Get Services
- [x] Get Application Services
- [x] Application Alert Configuration
- [x] Get All Smart Alert Configurations
- [x] Get Smart Alert Configuration
- [x] Get Smart Alert Config Versions
- [ ] Create Smart Alert Configuration
- [ ] Update Smart Alert Configuration
- [x] Delete Smart Alert Configuration
- [ ] Recalculate Smart Alert Config Baseline
- [x] Enable Application Alert Config
- [x] Disable Smart Alert Config
- [x] Restore Smart Alert Config
- [ ] Infrastructure
- [ ] Infrastructure Analyze
- [x] Get Available Metrics
- [ ] Get infrastructure entities
- [ ] Get grouped entities with aggregated metrics
- [x] Get available plugins/entity types
- [x] Infrastructure Catalog
- [x] Get Payload Keys By plugin ID
- [x] Get Infrastructure Catalog Metrics
- [x] Get Infrastructure Catalog Plugins
- [x] Get Infrastructure Catalog Plugins with Custom Metrics
- [x] Get Infrastructure Catalog Search Fields
- [x] Get Infrastructure Catalog Search Fields with Custom Metrics
- [x] Get Tag Catalog
- [x] Get Tag Catalog ALL
- [ ] Infrastructure Resources
- [x] Get Monitoring State
- [ ] Get plugin Payload
- [x] Search Snapshots
- [x] Get Snapshot Details for single Snapshot ID
- [x] Get Details for Multiple Snapshot IDs
- [x] Software Versions
- [x] Infrastructure Topology
- [x] Get Hosts for Snapshot
- [x] Get Topology
- [x] Events
- [x] Events
- [x] Get Event
- [x] Get Events by IDs
- [x] Get Agent Monitoring Events
- [x] Get Kubernetes Info Events
- [x] Get Issues
- [x] Get Incidents
- [x] Get Changes
## Available Tools
| Tool | Category | Description |
|---------------------------------------------------------------|--------------------------------|------------------------------------------------------- |
| `get_application_metrics` | Application Metrics | Get ApplicationMetrics |
| `get_endpoints_metrics` | Application Metrics | Get Endpoint metrics |
| `get_services_metrics` | Application Metrics | Get Service metrics |
| `get_application_data_metrics_v2` | Application Metrics | Get Application Data Metrics |
| `get_applications` | Application Resources | Get applications |
| `get_application_services` | Application Resources | Get applications/services |
| `get_application_endpoints` | Application Resources | Get endpoints |
| `get_services` | Application Resources | Get services |
| `get_monitoring_state` | Infrastructure Resources | Monitored host count |
| `get_plugin_payload` | Infrastructure Resources | Get a payload for a snapshot |
| `get_snapshots` | Infrastructure Resources | Search snapshots |
| `post_snapshots` | Infrastructure Resources | Get snapshot details for multiple snapshots |
| `get_snapshot` | Infrastructure Resources | Get snapshot details |
| `software_versions` | Infrastructure Resources | Get installed software |
| `get_available_payload_keys_by_plugin_id` | Infrastructure Catalog | Get Payload Keys By plugin ID |
| `get_infrastructure_catalog_metrics` | Infrastructure Catalog | Get Infrastructure Catalog Metrics |
| `get_infrastructure_catalog_plugins` | Infrastructure Catalog | Get Infrastructure Catalog Plugins |
| `get_infrastructure_catalog_plugins_with_custom_metrics` | Infrastructure Catalog | Get Infrastructure Catalog Plugins with Custom Metrics |
| `get_infrastructure_catalog_search_fields` | Infrastructure Catalog | Get Infrastructure Catalog Search Fields |
| `get_tag_catalog` | Infrastructure Catalog | Get Tag Catalog |
| `get_tag_catalog_all` | Infrastructure Catalog | Get Tag Catalog ALL |
| `get_related_hosts` | Infrastructure Topology | Get Related Hosts |
| `get_topology` | Infrastructure Topology | Get Topology |
| `get_available_metrics` | Infrastructure Analyze | Get Available Metrics |
| `get_entities` | Infrastructure Analyze | Get infrastructure entities |
| `get_aggregated_entity_groups` | Infrastructure Analyze | Get grouped entities with aggregated metrics |
| `get_available_plugins` | Infrastructure Analyze | Get available entity types |
| `get_application_alert_configs` | Application Alert Configuration| Get All Smart Alert Configurations |
| `find_application_alert_config` | Application Alert Configuration| Get Smart Alert Configuration |
| `find_application_alert_config_versions` | Application Alert Configuration| Get Smart Alert Config Versions |
| `create_application_alert_config` | Application Alert Configuration| Create Smart Alert Configuration |
| `update_application_alert_config` | Application Alert Configuration| Update Smart Alert Configuration |
| `delete_application_alert_config` | Application Alert Configuration| Delete Smart Alert Configuration |
| `update_application_historic_baseline` | Application Alert Configuration| Recalculate Smart Alert Config Baseline |
| `enable_application_alert_config` | Application Alert Configuration| Enable Application Alert Config |
| `disable_application_alert_config` | Application Alert Configuration| Disable Smart Alert Config |
| `restore_application_alert_config` | Application Alert Configuration| Restore Smart Alert Config |
| `get_event` | Events | Get Specific Event by ID |
| `get_kubernetes_info_events` | Events | Get Kubernetes Info Events |
| `get_agent_monitoring_events` | Events | Get Agent Monitoring Events |
| `get_issues` | Events | Get Issues |
| `get_incidents` | Events | Get Incidents |
| `get_changes` | Events | Get Changes |
| `get_events_by_ids` | Events | Get Events by IDs |
## Tool Filtering
The MCP server supports selective tool loading to optimize performance and reduce resource usage. You can enable only the tool categories you need for your specific use case.
### Available Tool Categories
- **`infra`**: Infrastructure monitoring tools
- Infrastructure Resources: Host monitoring, snapshot management, software inventory
- Infrastructure Catalog: Plugin metadata, metrics definitions, tag management
- Infrastructure Topology: Host relationships and system topology visualization
- Infrastructure Analyze: Entity metrics, aggregation, and plugin discovery
- Infrastructure Metrics: Performance data collection
- **`app`**: Application performance tools
- Application Resources: Service and endpoint discovery
- Application Metrics: Performance measurement across application components
- Application Alert Configuration: Smart alert management
- Application Catalog: Metadata and definitions
- Application Topology: Service dependency mapping
- Application Analyze: Application performance analysis
- Application Settings: Configuration management
- Application Global Alert: Global alert management
- **`events`**: Event monitoring tools
- Events: Kubernetes events, agent monitoring, incidents, issues, changes and system event tracking
- **`automation`**: Automation-related tools
- Action Catalog: Automation action discovery and management
- Action History: Tracking and managing automation action history
- **`website`**: Website monitoring tools
- Website Metrics: Performance measurement for websites
- Website Catalog: Website metadata and definitions
- Website Analyze: Website performance analysis
- Website Configuration: Website configuration management
### Usage Examples
#### Using CLI (PyPI Installation)```bash
# Enable only infrastructure and events tools
mcp-instana --tools infra,events --transport streamable-http
# Enable only application tools
mcp-instana --tools app --transport streamable-http
# Enable automation and website tools
mcp-instana --tools automation,website --transport streamable-http
# Enable all tools (default behavior)
mcp-instana --transport streamable-http
# List all available tool categories and their tools
mcp-instana --list-tools
Using Development Installation```bash
Enable only infrastructure and events tools
uv run src/core/server.py --tools infra,events --transport streamable-http
Enable only application tools
uv run src/core/server.py --tools app --transport streamable-http
Enable automation and website tools
uv run src/core/server.py --tools automation,website --transport streamable-http
Enable all tools (default behavior)
uv run src/core/server.py --transport streamable-http
List all available tool categories and their tools
uv run src/core/server.py --list-tools
```
Benefits of Tool Filtering
…(正文过长,页面只展示前面部分,完整内容见仓库)
