mcp-instana 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. mcp_instana-0.1.1.dist-info/METADATA +908 -0
  2. mcp_instana-0.1.1.dist-info/RECORD +30 -0
  3. {mcp_instana-0.1.0.dist-info → mcp_instana-0.1.1.dist-info}/WHEEL +1 -1
  4. mcp_instana-0.1.1.dist-info/entry_points.txt +4 -0
  5. mcp_instana-0.1.0.dist-info/LICENSE → mcp_instana-0.1.1.dist-info/licenses/LICENSE.md +3 -3
  6. src/application/__init__.py +1 -0
  7. src/{client/application_alert_config_mcp_tools.py → application/application_alert_config.py} +251 -273
  8. src/application/application_analyze.py +415 -0
  9. src/application/application_catalog.py +153 -0
  10. src/{client/application_metrics_mcp_tools.py → application/application_metrics.py} +107 -129
  11. src/{client/application_resources_mcp_tools.py → application/application_resources.py} +128 -150
  12. src/application/application_settings.py +1135 -0
  13. src/application/application_topology.py +107 -0
  14. src/core/__init__.py +1 -0
  15. src/core/server.py +436 -0
  16. src/core/utils.py +213 -0
  17. src/event/__init__.py +1 -0
  18. src/{client/events_mcp_tools.py → event/events_tools.py} +128 -136
  19. src/infrastructure/__init__.py +1 -0
  20. src/{client/infrastructure_analyze_mcp_tools.py → infrastructure/infrastructure_analyze.py} +200 -203
  21. src/{client/infrastructure_catalog_mcp_tools.py → infrastructure/infrastructure_catalog.py} +194 -264
  22. src/infrastructure/infrastructure_metrics.py +167 -0
  23. src/{client/infrastructure_resources_mcp_tools.py → infrastructure/infrastructure_resources.py} +192 -223
  24. src/{client/infrastructure_topology_mcp_tools.py → infrastructure/infrastructure_topology.py} +105 -106
  25. src/log/__init__.py +1 -0
  26. src/log/log_alert_configuration.py +331 -0
  27. src/prompts/mcp_prompts.py +900 -0
  28. src/prompts/prompt_loader.py +29 -0
  29. src/prompts/prompt_registry.json +21 -0
  30. mcp_instana-0.1.0.dist-info/METADATA +0 -649
  31. mcp_instana-0.1.0.dist-info/RECORD +0 -19
  32. mcp_instana-0.1.0.dist-info/entry_points.txt +0 -3
  33. src/client/What is the sum of queue depth for all q +0 -55
  34. src/client/instana_client_base.py +0 -93
  35. src/client/log_alert_configuration_mcp_tools.py +0 -316
  36. src/client/show the top 5 services with the highest +0 -28
  37. src/mcp_server.py +0 -343
@@ -0,0 +1,908 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-instana
3
+ Version: 0.1.1
4
+ Summary: MCP server for Instana
5
+ Author-email: Elina Priyadarshinee <Elina.priyadarshinee1@ibm.com>, Guangya Liu <gyliu@ibm.com>, Isabell Sippli <ischwert@de.ibm.com>, Jay Sharma <Jay.Sharma3@ibm.com>, Madhu Tadiparthi <madhu.tadiparthi@ibm.com>, Riya Kumari <Riya.Kumari3@ibm.com>
6
+ License: Apache-2.0
7
+ License-File: LICENSE.md
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: accelerate==1.6.0
10
+ Requires-Dist: aiohappyeyeballs==2.6.1
11
+ Requires-Dist: aiohttp==3.12.14
12
+ Requires-Dist: aiosignal==1.4.0
13
+ Requires-Dist: altair==5.5.0
14
+ Requires-Dist: annotated-types==0.7.0
15
+ Requires-Dist: anyio==4.9.0
16
+ Requires-Dist: attrs==25.3.0
17
+ Requires-Dist: blinker==1.9.0
18
+ Requires-Dist: cachetools==5.5.2
19
+ Requires-Dist: certifi==2025.1.31
20
+ Requires-Dist: charset-normalizer==3.4.1
21
+ Requires-Dist: click==8.1.8
22
+ Requires-Dist: coverage>=7.10.1
23
+ Requires-Dist: dataclasses-json==0.6.7
24
+ Requires-Dist: fastapi==0.116.1
25
+ Requires-Dist: fastmcp==2.10.3
26
+ Requires-Dist: filelock==3.18.0
27
+ Requires-Dist: frozenlist==1.5.0
28
+ Requires-Dist: fsspec==2025.3.2
29
+ Requires-Dist: gitdb==4.0.12
30
+ Requires-Dist: gitpython==3.1.44
31
+ Requires-Dist: h11==0.16.0
32
+ Requires-Dist: httpcore==1.0.9
33
+ Requires-Dist: httpx-sse==0.4.0
34
+ Requires-Dist: httpx==0.28.1
35
+ Requires-Dist: huggingface-hub==0.33.2
36
+ Requires-Dist: ibm-cos-sdk-core==2.14.2
37
+ Requires-Dist: ibm-cos-sdk-s3transfer==2.14.2
38
+ Requires-Dist: ibm-cos-sdk==2.14.2
39
+ Requires-Dist: ibm-watsonx-ai==1.3.26
40
+ Requires-Dist: idna==3.10
41
+ Requires-Dist: instana-client==1.0.0
42
+ Requires-Dist: jinja2==3.1.6
43
+ Requires-Dist: jmespath==1.0.1
44
+ Requires-Dist: jsonpatch==1.33
45
+ Requires-Dist: jsonpointer==3.0.0
46
+ Requires-Dist: jsonschema-pydantic==0.6
47
+ Requires-Dist: jsonschema-specifications==2024.10.1
48
+ Requires-Dist: jsonschema==4.24.0
49
+ Requires-Dist: langchain-community==0.3.21
50
+ Requires-Dist: langchain-core==0.3.51
51
+ Requires-Dist: langchain-ibm==0.3.13
52
+ Requires-Dist: langchain-text-splitters==0.3.8
53
+ Requires-Dist: langchain==0.3.23
54
+ Requires-Dist: langsmith==0.3.30
55
+ Requires-Dist: lomond==0.3.3
56
+ Requires-Dist: markdown-it-py==3.0.0
57
+ Requires-Dist: markupsafe==3.0.2
58
+ Requires-Dist: marshmallow==3.26.1
59
+ Requires-Dist: mcp==1.10.1
60
+ Requires-Dist: mdurl==0.1.2
61
+ Requires-Dist: mpmath==1.3.0
62
+ Requires-Dist: multidict==6.4.3
63
+ Requires-Dist: mypy-extensions==1.0.0
64
+ Requires-Dist: narwhals==1.34.1
65
+ Requires-Dist: nest-asyncio==1.6.0
66
+ Requires-Dist: networkx==3.4.2
67
+ Requires-Dist: numpy==2.2.4
68
+ Requires-Dist: orjson==3.10.16
69
+ Requires-Dist: packaging==24.2
70
+ Requires-Dist: pandas==2.2.3
71
+ Requires-Dist: propcache==0.3.1
72
+ Requires-Dist: protobuf==5.29.5
73
+ Requires-Dist: psutil==7.0.0
74
+ Requires-Dist: pyarrow==19.0.1
75
+ Requires-Dist: pydantic-core==2.33.2
76
+ Requires-Dist: pydantic-settings==2.10.1
77
+ Requires-Dist: pydantic==2.11.7
78
+ Requires-Dist: pydeck==0.9.1
79
+ Requires-Dist: pygments==2.19.1
80
+ Requires-Dist: pytest-asyncio>=1.1.0
81
+ Requires-Dist: pytest-cov>=6.2.1
82
+ Requires-Dist: pytest-mock>=3.14.1
83
+ Requires-Dist: pytest>=8.4.1
84
+ Requires-Dist: python-dateutil==2.9.0.post0
85
+ Requires-Dist: python-dotenv==1.1.0
86
+ Requires-Dist: pytz==2025.2
87
+ Requires-Dist: pyyaml==6.0.2
88
+ Requires-Dist: referencing==0.36.2
89
+ Requires-Dist: regex==2024.11.6
90
+ Requires-Dist: requests-toolbelt==1.0.0
91
+ Requires-Dist: requests==2.32.4
92
+ Requires-Dist: rich==14.0.0
93
+ Requires-Dist: rpds-py==0.24.0
94
+ Requires-Dist: ruff==0.5.0
95
+ Requires-Dist: safetensors==0.5.3
96
+ Requires-Dist: shellingham==1.5.4
97
+ Requires-Dist: six==1.17.0
98
+ Requires-Dist: smmap==5.0.2
99
+ Requires-Dist: sniffio==1.3.1
100
+ Requires-Dist: sqlalchemy==2.0.40
101
+ Requires-Dist: sse-starlette==2.2.1
102
+ Requires-Dist: starlette==0.47.2
103
+ Requires-Dist: streamlit==1.44.1
104
+ Requires-Dist: sympy==1.13.1
105
+ Requires-Dist: tabulate==0.9.0
106
+ Requires-Dist: tenacity==9.1.2
107
+ Requires-Dist: tokenizers==0.21.1
108
+ Requires-Dist: toml==0.10.2
109
+ Requires-Dist: tornado==6.5
110
+ Requires-Dist: tqdm==4.67.1
111
+ Requires-Dist: transformers==4.53.1
112
+ Requires-Dist: typer==0.15.2
113
+ Requires-Dist: typing-extensions==4.13.2
114
+ Requires-Dist: typing-inspect==0.9.0
115
+ Requires-Dist: typing-inspection==0.4.0
116
+ Requires-Dist: tzdata==2025.2
117
+ Requires-Dist: urllib3==2.5.0
118
+ Requires-Dist: uv==0.8.6
119
+ Requires-Dist: uvicorn==0.35.0
120
+ Requires-Dist: yarl==1.19.0
121
+ Requires-Dist: zstandard==0.23.0
122
+ Description-Content-Type: text/markdown
123
+
124
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
125
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
126
+ **Table of Contents**
127
+
128
+ - [MCP Server for IBM Instana](#mcp-server-for-ibm-instana)
129
+ - [Architecture Overview](#architecture-overview)
130
+ - [Workflow](#workflow)
131
+ - [Prerequisites](#prerequisites)
132
+ - [Installing uv](#installing-uv)
133
+ - [Setting Up the Environment](#setting-up-the-environment)
134
+ - [Header-Based Authentication for Streamable HTTP Mode](#header-based-authentication-for-streamable-http-mode)
135
+ - [Starting the Local MCP Server](#starting-the-local-mcp-server)
136
+ - [Server Command Options](#server-command-options)
137
+ - [Starting in Streamable HTTP Mode](#starting-in-streamable-http-mode)
138
+ - [Starting in Stdio Mode](#starting-in-stdio-mode)
139
+ - [Tool Categories](#tool-categories)
140
+ - [Verifying Server Status](#verifying-server-status)
141
+ - [Common Startup Issues](#common-startup-issues)
142
+ - [Setup and Usage](#setup-and-usage)
143
+ - [Claude Desktop](#claude-desktop)
144
+ - [Streamable HTTP Mode](#streamable-http-mode)
145
+ - [Stdio Mode](#stdio-mode)
146
+ - [GitHub Copilot](#github-copilot)
147
+ - [Streamable HTTP Mode](#streamable-http-mode-1)
148
+ - [Stdio Mode](#stdio-mode-1)
149
+ - [Supported Features](#supported-features)
150
+ - [Available Tools](#available-tools)
151
+ - [Tool Filtering](#tool-filtering)
152
+ - [Available Tool Categories](#available-tool-categories)
153
+ - [Usage Examples](#usage-examples)
154
+ - [Benefits of Tool Filtering](#benefits-of-tool-filtering)
155
+ - [Example Prompts](#example-prompts)
156
+ - [Troubleshooting](#troubleshooting)
157
+
158
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
159
+
160
+ # MCP Server for IBM Instana
161
+
162
+ 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.
163
+
164
+ 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.
165
+
166
+ 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](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports).
167
+
168
+ ## Architecture Overview
169
+
170
+ ```mermaid
171
+ graph LR
172
+ subgraph "Application Host Process"
173
+ MH[MCP Host]
174
+ MSI[Instana MCP Server]
175
+ MST[ProductA MCP Server]
176
+ MSC[ProductB MCP Server]
177
+
178
+ MH <--> MSI
179
+ MH <--> MSC
180
+ MH <--> MST
181
+ end
182
+
183
+ subgraph "Remote Service"
184
+ II[Instana Instance]
185
+ TI[ProductA Instance]
186
+ CI[ProductB Instance]
187
+
188
+ MSI <--> II
189
+ MST <--> TI
190
+ MSC <--> CI
191
+ end
192
+
193
+ subgraph "LLM"
194
+ L[LLM]
195
+ MH <--> L
196
+ end
197
+ ```
198
+
199
+ ## Workflow
200
+
201
+ 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:
202
+
203
+ 1. The MCP client retrieves the list of available tools from the Instana MCP server
204
+ 2. Your query is sent to the LLM along with tool descriptions
205
+ 3. The LLM analyzes the available tools and selects the appropriate one(s) for retrieving Instana alerts
206
+ 4. The client executes the chosen tool(s) through the Instana MCP server
207
+ 5. Results (latest alerts) are returned to the LLM
208
+ 6. The LLM formulates a natural language response
209
+ 7. The response is displayed to you
210
+
211
+ ```mermaid
212
+ sequenceDiagram
213
+ participant User
214
+ participant ChatBot as MCP Host
215
+ participant MCPClient as MCP Client
216
+ participant MCPServer as Instana MCP Server
217
+ participant LLM
218
+ participant Instana as Instana Instance
219
+
220
+ ChatBot->>MCPClient: Load available tools from MCP Server
221
+ MCPClient->>MCPServer: Request available tool list
222
+ MCPServer->>MCPClient: Return list of available tools
223
+ User->>ChatBot: Ask "Show me the latest alerts from Instana for application robot-shop"
224
+ ChatBot->>MCPClient: Forward query
225
+ MCPClient->>LLM: Send query and tool description
226
+ LLM->>MCPClient: Select appropriate tool(s) for Instana alert query
227
+ MCPClient->>MCPServer: Execute selected tool(s)
228
+ MCPServer->>Instana: Retrieve alerts for application robot-shop
229
+ MCPServer->>MCPClient: Send alerts of Instana result
230
+ MCPClient->>LLM: Forward alerts of Instana
231
+ LLM->>ChatBot: Generate natural language response for Instana alerts
232
+ ChatBot->>User: Show Instana alert response
233
+ ```
234
+
235
+ ## Prerequisites
236
+
237
+ ### Installing uv
238
+
239
+ This project uses `uv`, a fast Python package installer and resolver. To install `uv`, you have several options:
240
+
241
+ **Using pip:**
242
+ ```shell
243
+ pip install uv
244
+ ```
245
+
246
+ **Using Homebrew (macOS):**
247
+ ```shell
248
+ brew install uv
249
+ ```
250
+
251
+ For more installation options and detailed instructions, visit the [uv documentation](https://github.com/astral-sh/uv).
252
+
253
+ ### Setting Up the Environment
254
+
255
+ After installing `uv`, set up the project environment by running:
256
+
257
+ ```shell
258
+ uv sync
259
+ ```
260
+
261
+ ### Header-Based Authentication for Streamable HTTP Mode
262
+
263
+ When using **Streamable HTTP mode**, you must pass Instana credentials via HTTP headers. This approach enhances security and flexibility by:
264
+
265
+ - Avoiding credential storage in environment variables
266
+ - Enabling the use of different credentials for different requests
267
+ - Supporting shared environments where environment variable modification is restricted
268
+
269
+ **Required Headers:**
270
+ - `instana-base-url`: Your Instana instance URL
271
+ - `instana-api-token`: Your Instana API token
272
+
273
+ **Authentication Flow:**
274
+ 1. HTTP headers (`instana-base-url`, `instana-api-token`) must be present in each request
275
+ 2. Requests without these headers will fail
276
+
277
+ 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.
278
+
279
+ ## Starting the Local MCP Server
280
+
281
+ 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**.
282
+
283
+ ### Server Command Options
284
+
285
+ The MCP server (`src/core/server.py`) supports the following command-line options:
286
+
287
+ ```bash
288
+ uv run src/core/server.py [OPTIONS]
289
+ ```
290
+
291
+ **Available Options:**
292
+ - `--transport <mode>`: Transport mode (choices: `streamable-http`, `stdio`)
293
+ - `--debug`: Enable debug mode with additional logging
294
+ - `--log-level <level>`: Set the logging level (choices: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`)
295
+ - `--tools <categories>`: Comma-separated list of tool categories to enable (e.g., `infra,app,events`)
296
+ - `--list-tools`: List all available tool categories and exit
297
+ - `--port <port>`: Port to listen on (default: 8000)
298
+ - `--help`: Show help message and exit
299
+
300
+ ### Starting in Streamable HTTP Mode
301
+
302
+ **Streamable HTTP mode** provides a REST API interface and is recommended for most use cases:
303
+
304
+ ```bash
305
+ # Start with all tools enabled (default)
306
+ uv run src/core/server.py --transport streamable-http
307
+
308
+ # Start with debug logging
309
+ uv run src/core/server.py --transport streamable-http --debug
310
+
311
+ # Start with a specific log level
312
+ uv run src/core/server.py --transport streamable-http --log-level WARNING
313
+
314
+ # Start with specific tool categories only
315
+ uv run src/core/server.py --transport streamable-http --tools infra,events
316
+
317
+ # Combine options (specific log level, custom tools)
318
+ uv run src/core/server.py --transport streamable-http --log-level DEBUG --tools app,events
319
+ ```
320
+
321
+ **Key Features of Streamable HTTP Mode:**
322
+ - Uses HTTP headers for authentication (no environment variables needed)
323
+ - Supports different credentials per request
324
+ - Better suited for shared environments
325
+ - Default port: 8000
326
+ - Endpoint: `http://0.0.0.0:8000/mcp/`
327
+
328
+ ### Starting in Stdio Mode
329
+
330
+ **Stdio mode** uses standard input/output for communication and requires environment variables for authentication:
331
+
332
+ ```bash
333
+ # Set environment variables first
334
+ export INSTANA_BASE_URL="https://your-instana-instance.instana.io"
335
+ export INSTANA_API_TOKEN="your_instana_api_token"
336
+
337
+ # Start the server (stdio is the default if no transport specified)
338
+ uv run src/core/server.py
339
+
340
+ # Or explicitly specify stdio mode
341
+ uv run src/core/server.py --transport stdio
342
+ ```
343
+
344
+ **Key Features of Stdio Mode:**
345
+ - Uses environment variables for authentication
346
+ - Direct communication via stdin/stdout
347
+ - Required for certain MCP client configurations
348
+
349
+ ### Tool Categories
350
+
351
+ You can optimize server performance by enabling only the tool categories you need:
352
+
353
+ ```bash
354
+ # List all available categories
355
+ uv run src/core/server.py --list-tools
356
+
357
+ # Enable specific categories
358
+ uv run src/core/server.py --transport streamable-http --tools infra,app
359
+ uv run src/core/server.py --transport streamable-http --tools events
360
+ ```
361
+
362
+ **Available Categories:**
363
+ - **`infra`**: Infrastructure monitoring tools (resources, catalog, topology, analyze, metrics)
364
+ - **`app`**: Application performance tools (resources, metrics, alerts, catalog, topology, analyze)
365
+ - **`events`**: Event monitoring tools (Kubernetes events, agent monitoring)
366
+
367
+ ### Verifying Server Status
368
+
369
+ Once started, you can verify the server is running:
370
+
371
+ **For Streamable HTTP mode:**
372
+ ```bash
373
+ # Check server health
374
+ curl http://0.0.0.0:8000/mcp/
375
+
376
+ # Or with custom port
377
+ curl http://0.0.0.0:9000/mcp/
378
+ ```
379
+
380
+ **For Stdio mode:**
381
+ The server will start and wait for stdin input from MCP clients.
382
+
383
+ ### Common Startup Issues
384
+
385
+ **Certificate Issues:**
386
+ If you encounter SSL certificate errors, ensure your Python environment has access to system certificates:
387
+ ```bash
388
+ # macOS - Install certificates for Python
389
+ /Applications/Python\ 3.13/Install\ Certificates.command
390
+ ```
391
+
392
+ **Port Already in Use:**
393
+ If port 8000 is already in use, specify a different port:
394
+ ```bash
395
+ uv run src/core/server.py --transport streamable-http --port 9000
396
+ ```
397
+
398
+ **Missing Dependencies:**
399
+ Ensure all dependencies are installed:
400
+ ```bash
401
+ uv sync
402
+ ```
403
+
404
+ ## Setup and Usage
405
+
406
+ ### Claude Desktop
407
+
408
+ Claude Desktop supports both Streamable HTTP and Stdio modes for MCP integration.
409
+
410
+ Configure Claude Desktop by editing the configuration file:
411
+
412
+ **File Locations:**
413
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
414
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
415
+
416
+ #### Streamable HTTP Mode
417
+
418
+ The Streamable HTTP mode provides a REST API interface for MCP communication using JSON-RPC over HTTP.
419
+
420
+ **Step 1: Start the MCP Server in Streamable HTTP Mode**
421
+
422
+ Before configuring Claude Desktop, you need to start the MCP server in Streamable HTTP mode. Please refer to the [Starting the Local MCP Server](#starting-the-local-mcp-server) section for detailed instructions.
423
+
424
+ **Step 2: Configure Claude Desktop**
425
+
426
+ Configure Claude Desktop to pass Instana credentials via headers:
427
+
428
+ ```json:claude_desktop_config.json
429
+ {
430
+ "mcpServers": {
431
+ "Instana MCP Server": {
432
+ "command": "npx",
433
+ "args": [
434
+ "mcp-remote", "http://0.0.0.0:8000/mcp/",
435
+ "--header", "instana-base-url: https://your-instana-instance.instana.io",
436
+ "--header", "instana-api-token: your_instana_api_token"
437
+ ]
438
+ }
439
+ }
440
+ }
441
+ ```
442
+
443
+ **Note:** To use npx, we recommend first installing NVM (Node Version Manager), then using it to install Node.js.
444
+ Installation instructions are available at: https://nodejs.org/en/download
445
+
446
+ **Step 3: Test the Connection**
447
+
448
+ Restart Claude Desktop. You should now see Instana MCP Server in the Claude Desktop interface as shown below:
449
+
450
+ ![](./images/claudeTools.png)
451
+
452
+ You can now run queries in Claude Desktop:
453
+
454
+ ```
455
+ get me all endpoints from Instana
456
+ ```
457
+ ![](./images/claudeResponse.png)
458
+
459
+ #### Stdio Mode
460
+
461
+ **Configuration:**
462
+
463
+ ```json
464
+ {
465
+ "mcpServers": {
466
+ "Instana MCP Server": {
467
+ "command": "uv",
468
+ "args": [
469
+ "--directory",
470
+ "<path-to-mcp-instana-folder>",
471
+ "run",
472
+ "src/core/server.py"
473
+ ],
474
+ "env": {
475
+ "INSTANA_BASE_URL": "https://your-instana-instance.instana.io",
476
+ "INSTANA_API_TOKEN": "your_instana_api_token"
477
+ }
478
+ }
479
+ }
480
+ }
481
+ ```
482
+
483
+ ### GitHub Copilot
484
+
485
+ GitHub Copilot supports MCP integration through VS Code configuration.
486
+ For GitHub Copilot integration with VS Code, refer to this [setup guide](https://code.visualstudio.com/docs/copilot/setup).
487
+
488
+ #### Streamable HTTP Mode
489
+
490
+ **Step 1: Start the MCP Server in Streamable HTTP Mode**
491
+
492
+ Before configuring VS Code, you need to start the MCP server in Streamable HTTP mode. Please refer to the [Starting the Local MCP Server](#starting-the-local-mcp-server) section for detailed instructions.
493
+
494
+ **Step 2: Configure VS Code**
495
+
496
+ Refer to [Use MCP servers in VS Code](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for detailed configuration.
497
+
498
+ You can directly create or update `.vscode/mcp.json` with the following configuration:
499
+
500
+ ```json:.vscode/mcp.json
501
+ {
502
+ "servers": {
503
+ "Instana MCP Server": {
504
+ "command": "npx",
505
+ "args": [
506
+ "mcp-remote", "http://0.0.0.0:8000/mcp/",
507
+ "--header", "instana-base-url: https://your-instana-instance.instana.io",
508
+ "--header", "instana-api-token: your_instana_api_token"
509
+ ],
510
+ "env": {
511
+ "PATH": "/usr/local/bin:/bin:/usr/bin",
512
+ "SHELL": "/bin/sh"
513
+ }
514
+ }
515
+ }
516
+ }
517
+ ```
518
+
519
+ **Note:** Replace the following values with your actual configuration:
520
+ - `instana-base-url`: Your Instana instance URL
521
+ - `instana-api-token`: Your Instana API token
522
+ - `command`: Update the npx path to match your system's Node.js installation (e.g., `/path/to/your/node/bin/npx`)
523
+ - Environment variables: Adjust PATH and other environment variables as needed for your system
524
+
525
+
526
+ #### Stdio Mode
527
+
528
+ **Step 1: Create VS Code MCP Configuration**
529
+
530
+ Create `.vscode/mcp.json` in your project root:
531
+
532
+ ```json:.vscode/mcp.json
533
+ {
534
+ "servers": {
535
+ "Instana MCP Server": {
536
+ "command": "uv",
537
+ "args": [
538
+ "--directory",
539
+ "/absolute/path/to/your/project/mcp-instana",
540
+ "run",
541
+ "src/core/server.py"
542
+ ],
543
+ "env": {
544
+ "INSTANA_BASE_URL": "https://your-instana-instance.instana.io",
545
+ "INSTANA_API_TOKEN": "your_instana_api_token"
546
+ }
547
+ }
548
+ }
549
+ }
550
+ ```
551
+
552
+ **Note:** Replace the following values with your actual configuration:
553
+ - `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`)
554
+ - `--directory`: Update with the absolute path to your mcp-instana project directory
555
+ - `INSTANA_BASE_URL`: Your Instana instance URL
556
+ - `INSTANA_API_TOKEN`: Your Instana API token
557
+
558
+ **Step 2: Manage Server in VS Code**
559
+
560
+ 1. **Open `.vscode/mcp.json`** - you'll see server management controls at the top
561
+ 2. **Click `Start`** next to `Instana MCP Server` to start the server
562
+ 3. Running status along with the number of tools indicates the server is running
563
+
564
+ **Step 3: Test Integration**
565
+
566
+ Switch to Agent Mode in GitHub Copilot and reload tools.
567
+ Here is an example of a GitHub Copilot response:
568
+
569
+ ![GitHub Copilot Response](./images/copilotResponse.png)
570
+
571
+ ## Supported Features
572
+
573
+ - [ ] Application
574
+ - [ ] Application Metrics
575
+ - [ ] Application Metrics
576
+ - [ ] Endpoint Metrics
577
+ - [ ] Service Metrics
578
+ - [ ] Data Metrics
579
+ - [x] Application Resources
580
+ - [x] Get Applications Endpoints
581
+ - [x] Get Applications
582
+ - [x] Get Services
583
+ - [x] Get Application Services
584
+ - [x] Application Alert Configuration
585
+ - [x] Get All Smart Alert Configurations
586
+ - [x] Get Smart Alert Configuration
587
+ - [x] Get Smart Alert Config Versions
588
+ - [ ] Create Smart Alert Configuration
589
+ - [ ] Update Smart Alert Configuration
590
+ - [x] Delete Smart Alert Configuration
591
+ - [ ] Recalculate Smart Alert Config Baseline
592
+ - [x] Enable Application Alert Config
593
+ - [x] Disable Smart Alert Config
594
+ - [x] Restore Smart Alert Config
595
+ - [ ] Infrastructure
596
+ - [ ] Infrastructure Analyze
597
+ - [x] Get Available Metrics
598
+ - [ ] Get infrastructure entities
599
+ - [ ] Get grouped entities with aggregated metrics
600
+ - [x] Get available plugins/entity types
601
+ - [x] Infrastructure Catalog
602
+ - [x] Get Payload Keys By plugin ID
603
+ - [x] Get Infrastructure Catalog Metrics
604
+ - [x] Get Infrastructure Catalog Plugins
605
+ - [x] Get Infrastructure Catalog Plugins with Custom Metrics
606
+ - [x] Get Infrastructure Catalog Search Fields
607
+ - [x] Get Infrastructure Catalog Search Fields with Custom Metrics
608
+ - [x] Get Tag Catalog
609
+ - [x] Get Tag Catalog ALL
610
+ - [ ] Infrastructure Resources
611
+ - [x] Get Monitoring State
612
+ - [ ] Get plugin Payload
613
+ - [x] Search Snapshots
614
+ - [x] Get Snapshot Details for single Snapshot ID
615
+ - [x] Get Details for Multiple Snapshot IDs
616
+ - [x] Software Versions
617
+ - [x] Infrastructure Topology
618
+ - [x] Get Hosts for Snapshot
619
+ - [x] Get Topology
620
+ - [ ] Events
621
+ - [ ] Events
622
+ - [ ] Get all Events
623
+ - [x] Get Events by IDs
624
+ - [x] Get Agent Monitoring Events
625
+ - [x] Get Kubernetes Info Events
626
+
627
+ ## Available Tools
628
+
629
+ | Tool | Category | Description |
630
+ |---------------------------------------------------------------|--------------------------------|------------------------------------------------------- |
631
+ | `get_application_metrics` | Application Metrics | Get ApplicationMetrics |
632
+ | `get_endpoints_metrics` | Application Metrics | Get Endpoint metrics |
633
+ | `get_services_metrics` | Application Metrics | Get Service metrics |
634
+ | `get_application_data_metrics_v2` | Application Metrics | Get Application Data Metrics |
635
+ | `get_applications` | Application Resources | Get applications |
636
+ | `get_application_services` | Application Resources | Get applications/services |
637
+ | `get_application_endpoints` | Application Resources | Get endpoints |
638
+ | `get_services` | Application Resources | Get services |
639
+ | `get_monitoring_state` | Infrastructure Resources | Monitored host count |
640
+ | `get_plugin_payload` | Infrastructure Resources | Get a payload for a snapshot |
641
+ | `get_snapshots` | Infrastructure Resources | Search snapshots |
642
+ | `post_snapshots` | Infrastructure Resources | Get snapshot details for multiple snapshots |
643
+ | `get_snapshot` | Infrastructure Resources | Get snapshot details |
644
+ | `software_versions` | Infrastructure Resources | Get installed software |
645
+ | `get_available_payload_keys_by_plugin_id` | Infrastructure Catalog | Get Payload Keys By plugin ID |
646
+ | `get_infrastructure_catalog_metrics` | Infrastructure Catalog | Get Infrastructure Catalog Metrics |
647
+ | `get_infrastructure_catalog_plugins` | Infrastructure Catalog | Get Infrastructure Catalog Plugins |
648
+ | `get_infrastructure_catalog_plugins_with_custom_metrics` | Infrastructure Catalog | Get Infrastructure Catalog Plugins with Custom Metrics |
649
+ | `get_infrastructure_catalog_search_fields` | Infrastructure Catalog | Get Infrastructure Catalog Search Fields |
650
+ | `get_tag_catalog` | Infrastructure Catalog | Get Tag Catalog |
651
+ | `get_tag_catalog_all` | Infrastructure Catalog | Get Tag Catalog ALL |
652
+ | `get_related_hosts` | Infrastructure Topology | Get Related Hosts |
653
+ | `get_topology` | Infrastructure Topology | Get Topology |
654
+ | `get_available_metrics` | Infrastructure Analyze | Get Available Metrics |
655
+ | `get_entities` | Infrastructure Analyze | Get infrastructure entities |
656
+ | `get_aggregated_entity_groups` | Infrastructure Analyze | Get grouped entities with aggregated metrics |
657
+ | `get_available_plugins` | Infrastructure Analyze | Get available entity types |
658
+ | `get_application_alert_configs` | Application Alert Configuration| Get All Smart Alert Configurations |
659
+ | `find_application_alert_config` | Application Alert Configuration| Get Smart Alert Configuration |
660
+ | `find_application_alert_config_versions` | Application Alert Configuration| Get Smart Alert Config Versions |
661
+ | `create_application_alert_config` | Application Alert Configuration| Create Smart Alert Configuration |
662
+ | `update_application_alert_config` | Application Alert Configuration| Update Smart Alert Configuration |
663
+ | `delete_application_alert_config` | Application Alert Configuration| Delete Smart Alert Configuration |
664
+ | `update_application_historic_baseline` | Application Alert Configuration| Recalculate Smart Alert Config Baseline |
665
+ | `enable_application_alert_config` | Application Alert Configuration| Enable Application Alert Config |
666
+ | `disable_application_alert_config` | Application Alert Configuration| Disable Smart Alert Config |
667
+ | `restore_application_alert_config` | Application Alert Configuration| Restore Smart Alert Config |
668
+ | `get_event` | Events | Get Events by IDs |
669
+ | `get_kubernetes_info_events` | Events | Get Kubernetes Info Events |
670
+ | `get_agent_monitoring_events` | Events | Get Agent Monitoring Events |
671
+
672
+ ## Tool Filtering
673
+
674
+ 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.
675
+
676
+ ### Available Tool Categories
677
+
678
+ - **`infra`**: Infrastructure monitoring tools
679
+ - Infrastructure Resources: Host monitoring, snapshot management, software inventory
680
+ - Infrastructure Catalog: Plugin metadata, metrics definitions, tag management
681
+ - Infrastructure Topology: Host relationships and system topology visualization
682
+ - Infrastructure Analyze: Entity metrics, aggregation, and plugin discovery
683
+ - Infrastructure Metrics: Performance data collection
684
+
685
+ - **`app`**: Application performance tools
686
+ - Application Resources: Service and endpoint discovery
687
+ - Application Metrics: Performance measurement across application components
688
+ - Application Alert Configuration: Smart alert management
689
+ - Application Catalog: Metadata and definitions
690
+ - Application Topology: Service dependency mapping
691
+ - Application Analyze: Application performance analysis
692
+
693
+ - **`events`**: Event monitoring tools
694
+ - Events: Kubernetes events, agent monitoring, and system event tracking
695
+
696
+ ### Usage Examples
697
+
698
+ ```bash
699
+ # Enable only infrastructure and events tools
700
+ uv run src/core/server.py --tools infra,events --transport streamable-http
701
+
702
+ # Enable only application tools
703
+ uv run src/core/server.py --tools app --transport streamable-http
704
+
705
+ # Enable all tools (default behavior)
706
+ uv run src/core/server.py --transport streamable-http
707
+
708
+ # List all available tool categories and their tools
709
+ uv run src/core/server.py --list-tools
710
+ ```
711
+
712
+ ### Benefits of Tool Filtering
713
+
714
+ - **Performance**: Reduced startup time and memory usage
715
+ - **Security**: Limit exposure to only necessary APIs
716
+ - **Clarity**: Focus on specific use cases (e.g., only infrastructure monitoring)
717
+ - **Resource Efficiency**: Lower CPU and network usage
718
+
719
+ ## Example Prompts
720
+
721
+ Here are some example prompts (with their corresponding results) that you can use to get started with the Instana Observability Platform API:
722
+
723
+ - **Query 1**
724
+ ```
725
+ We want to understand what search criteria are available in Instana so that
726
+ we can find the correct search tags for specific entities and
727
+ build complex queries to filter entities in Instana. Can you help with this?
728
+ ```
729
+
730
+ - **Result 1**
731
+ ```
732
+ Here is the list of search criteria available in Instana:
733
+
734
+ entity.jvm.dropwizard.timer
735
+ entity.otel
736
+ host.name
737
+ entity.dropwizard.meter
738
+ entity.springboot.name
739
+ entity.kubernetes.node.name
740
+ entity.tuxedoapp.tuxedoService.name
741
+ entity.ace.integrationServer.name
742
+ entity.containerd.containerIdentity.tuxedo.domain.tuxconfig
743
+ entity.host.mac
744
+ ```
745
+
746
+ - **Query 2**
747
+ ```
748
+ Our application deployments seem to be failing intermittently.
749
+ Can you fetch recent Kubernetes info events from Instana for the last 1 day
750
+ to help identify what might be causing these deployment issues?
751
+ ```
752
+
753
+ - **Result 2**
754
+ ![Kubernetes Events](./images/kubernetesEvents.png)
755
+
756
+ - **Query 3**
757
+ ```
758
+ We are seeing errors in agent logs and experiencing issues with agent behavior.
759
+ Can you fetch recent agent monitoring events from Instana
760
+ to help figure out what might be causing these issues?
761
+ ```
762
+
763
+ - **Result 3**
764
+ ```
765
+ The recent agent monitoring events from Instana indicate that there are several issues with the agent behavior, including:
766
+
767
+ JVM attach generic issues: There are 36 events related to JVM attach generic issues, affecting multiple entities such as Process (/etc/java-8-64bit-jdk/jdk8u402-b06/bin/java), Process (/etc/java-16-64bit-jdk/jdk-16.0.2+7/bin/java), and others.
768
+ Python sensor not installed: There are 7 events related to Python sensor not installed issues, affecting entities such as Process (/usr/bin/python3), Process (/usr/libexec/platform-python), and others.
769
+ PostgreSQL authentication failed: There are 2 events related to PostgreSQL authentication failed issues, affecting entities such as PostgreSQL DB (PostgreSQL) and PostgreSQL DB (PostgreSQL @5432).
770
+ PostgreSQL connection failed: There is 1 event related to PostgreSQL connection failed issues, affecting the entity PostgreSQL DB (PostgreSQL @5432).
771
+ Spring Boot actuator not configured: There is 1 event related to Spring Boot actuator not configured issues, affecting the entity Spring Boot App (sqs-demo-application 0.0.1).
772
+ These issues may be causing the errors in the agent logs and affecting the agent behavior. It is recommended to investigate and resolve these issues to ensure proper agent functionality.
773
+ ```
774
+
775
+ - **Query 4**
776
+ ```
777
+ We're setting up comprehensive application performance monitoring across our entire infrastructure.
778
+ Can you retrieve all the applications that Instana has discovered? I need to see which applications are available
779
+ so I can configure monitoring dashboards, set up alerts, and establish performance baselines for each service in our environment.
780
+ ```
781
+
782
+ - **Result 4**
783
+ ```
784
+ The discovered applications are:
785
+
786
+ Ovcharov
787
+ AWS Resources
788
+ Cedric OTel
789
+ Cedric Sein Otel
790
+ Col
791
+ Damian - Sample Go App
792
+ Fofo
793
+ INSTANA-ECOSYSTEM-SAP-CF
794
+ Kate
795
+ ```
796
+
797
+ - **Query 5**
798
+ ```
799
+ We're investigating an issue for the snapshot id "qjNuS6pmtYkxCBKwqsfxvHylisU" and
800
+ want to see which hosts might be affected. Can you get the hosts for this snapshot id?
801
+ ```
802
+
803
+ - **Result 5**
804
+ ```
805
+ The hosts related to the snapshot with ID "qjNuS6pmtYkxCBKwqsfxvHylisU" are:
806
+
807
+ XDrSHZ5iq0BV_bPxQ6FFGsbxqv4
808
+ There is 1 host related to this snapshot.
809
+ ```
810
+
811
+ - **Query 6**
812
+ ```
813
+ We want to get specific metrics for Amazon MQ in Instana. Can you show all possible tags
814
+ I can use for the plugin awsMq?
815
+ ```
816
+
817
+ - **Result 6**
818
+ ```
819
+ The following tags are available for the plugin "awsMq":
820
+
821
+ aws.accountId
822
+ aws.arn
823
+ aws.mq.brokerName
824
+ aws.mq.deploymentMode
825
+ aws.mq.engineVersion
826
+ aws.mq.instanceType
827
+ dfq.selftype
828
+ dfq.type
829
+ label
830
+ metricId
831
+ type
832
+ zone
833
+ These tags can be used to filter and group metrics for Amazon MQ in Instana.
834
+ ```
835
+
836
+ - **Query 7**
837
+ ```
838
+ We want to troubleshoot issues with custom metric collection, hence need details of the
839
+ plugins which are configured with custom metrics in Instana. Can you help us get the details?
840
+ ```
841
+
842
+ - **Result 7**
843
+ ```
844
+ JVM and OpenTelemetry SDK. The JVM plugin is identified by the label "JVM" and the plugin ID "jvmRuntimePlatform".
845
+ The OpenTelemetry SDK plugin is identified by the label "OpenTelemetry SDK" and the plugin ID "openTelemetry".
846
+ ```
847
+
848
+ - **Query 8**
849
+ ```
850
+ We want to see what kind of systems Instana is tracking. We want to explore the monitoring
851
+ capabilities of our Instana installation. Please give me the list of monitored entity types.
852
+ ```
853
+
854
+ - **Result 8**
855
+ ```
856
+ The list includes various plugins such as businessActivity, azureManagedHSM, kafkaConnectWorker, and many more.
857
+ The total number of available plugins is 395, but only the first 50 are shown in the output.
858
+ ```
859
+
860
+ - **Query 9**
861
+ ```
862
+ We're having performance issues with our db2Database. What payload keys are available for the
863
+ db2Database plugin so I can access detailed monitoring data?
864
+ ```
865
+
866
+ - **Result 9**
867
+ ```
868
+ The available payload keys for the db2Database plugin are:
869
+
870
+ tableSpaceNamesSense
871
+ topqueries
872
+ diaglogentries
873
+ dbConfig
874
+ dbmConfig
875
+ lockWaits
876
+ runstats
877
+ dbutilities
878
+ toptotalstmts
879
+ idlogdiskwait
880
+ idhadrstats
881
+ reorgtablesize
882
+ ```
883
+
884
+ - **Query 10**
885
+ ```
886
+ We have SLAs for our cryptographic services. What Azure Managed HSM metrics can help
887
+ monitor service levels using the azureManagedHSM plugin?
888
+ ```
889
+
890
+ - **Result 10**
891
+ ```
892
+ The azureManagedHSM plugin provides three metrics that can help monitor service levels for cryptographic services:
893
+ 1. Total Service Api Hits: This metric measures the total number of API hits for the service.
894
+ 2. Overall Service Api Latency: This metric measures the overall latency of service API requests.
895
+ 3. Overall Service Availability: This metric measures the availability of the service.
896
+ ```
897
+
898
+ ## Troubleshooting
899
+
900
+ - **GitHub Copilot**
901
+ - If you encounter issues with GitHub Copilot, try starting/stopping/restarting the server in the `mcp.json` file and keep only one server running at a time.
902
+
903
+ - **Certificate Issues**
904
+ - If you encounter certificate issues, such as `[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate`:
905
+ - Check that you can reach the Instana API endpoint using `curl` or `wget` with SSL verification.
906
+ - If that works, your Python environment may not be able to verify the certificate and might not have access to the same certificates as your shell or system. Ensure your Python environment uses system certificates (macOS). You can do this by installing certificates to Python:
907
+ `//Applications/Python\ 3.13/Install\ Certificates.command`
908
+ - If you cannot reach the endpoint with SSL verification, try without it. If that works, check your system's CA certificates and ensure they are up-to-date.