mcp-instana 0.1.0__tar.gz → 0.1.1__tar.gz

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 (99) hide show
  1. mcp_instana-0.1.1/.github/dco.yml +4 -0
  2. mcp_instana-0.1.1/.github/workflows/ci.yml +37 -0
  3. mcp_instana-0.1.1/.gitignore +180 -0
  4. mcp_instana-0.1.1/CONTRIBUTING.md +167 -0
  5. mcp_instana-0.1.0/LICENSE → mcp_instana-0.1.1/LICENSE.md +3 -3
  6. mcp_instana-0.1.1/PKG-INFO +908 -0
  7. mcp_instana-0.1.1/README.md +785 -0
  8. mcp_instana-0.1.1/images/architecture.png +0 -0
  9. mcp_instana-0.1.1/images/call_tools.png +0 -0
  10. mcp_instana-0.1.1/images/claudeResponse.png +0 -0
  11. mcp_instana-0.1.1/images/claudeTools.png +0 -0
  12. mcp_instana-0.1.1/images/copilot.png +0 -0
  13. mcp_instana-0.1.1/images/copilotResponse.png +0 -0
  14. mcp_instana-0.1.1/images/kubernetesEvents.png +0 -0
  15. mcp_instana-0.1.1/images/mcpInstanaFlow.png +0 -0
  16. mcp_instana-0.1.1/images/query_events.png +0 -0
  17. mcp_instana-0.1.1/pyproject.toml +218 -0
  18. mcp_instana-0.1.1/pyrightconfig.json +36 -0
  19. mcp_instana-0.1.1/run_ruff_check.sh +42 -0
  20. mcp_instana-0.1.1/src/application/__init__.py +1 -0
  21. mcp_instana-0.1.0/src/client/application_alert_config_mcp_tools.py → mcp_instana-0.1.1/src/application/application_alert_config.py +251 -273
  22. mcp_instana-0.1.1/src/application/application_analyze.py +415 -0
  23. mcp_instana-0.1.1/src/application/application_catalog.py +153 -0
  24. mcp_instana-0.1.0/src/client/application_metrics_mcp_tools.py → mcp_instana-0.1.1/src/application/application_metrics.py +107 -129
  25. mcp_instana-0.1.0/src/client/application_resources_mcp_tools.py → mcp_instana-0.1.1/src/application/application_resources.py +128 -150
  26. mcp_instana-0.1.1/src/application/application_settings.py +1135 -0
  27. mcp_instana-0.1.1/src/application/application_topology.py +107 -0
  28. mcp_instana-0.1.1/src/core/__init__.py +1 -0
  29. mcp_instana-0.1.1/src/core/server.py +436 -0
  30. mcp_instana-0.1.1/src/core/utils.py +213 -0
  31. mcp_instana-0.1.1/src/event/__init__.py +1 -0
  32. mcp_instana-0.1.0/src/client/events_mcp_tools.py → mcp_instana-0.1.1/src/event/events_tools.py +128 -136
  33. mcp_instana-0.1.1/src/infrastructure/__init__.py +1 -0
  34. mcp_instana-0.1.0/src/client/infrastructure_analyze_mcp_tools.py → mcp_instana-0.1.1/src/infrastructure/infrastructure_analyze.py +200 -203
  35. mcp_instana-0.1.0/src/client/infrastructure_catalog_mcp_tools.py → mcp_instana-0.1.1/src/infrastructure/infrastructure_catalog.py +194 -264
  36. mcp_instana-0.1.1/src/infrastructure/infrastructure_metrics.py +167 -0
  37. mcp_instana-0.1.0/src/client/infrastructure_resources_mcp_tools.py → mcp_instana-0.1.1/src/infrastructure/infrastructure_resources.py +192 -223
  38. mcp_instana-0.1.0/src/client/infrastructure_topology_mcp_tools.py → mcp_instana-0.1.1/src/infrastructure/infrastructure_topology.py +105 -106
  39. mcp_instana-0.1.1/src/log/__init__.py +1 -0
  40. mcp_instana-0.1.1/src/log/log_alert_configuration.py +331 -0
  41. mcp_instana-0.1.1/src/prompts/mcp_prompts.py +900 -0
  42. mcp_instana-0.1.1/src/prompts/prompt_loader.py +29 -0
  43. mcp_instana-0.1.1/src/prompts/prompt_registry.json +21 -0
  44. mcp_instana-0.1.1/tests/README.md +512 -0
  45. mcp_instana-0.1.1/tests/__init__.py +5 -0
  46. mcp_instana-0.1.1/tests/application/__init__.py +1 -0
  47. mcp_instana-0.1.1/tests/application/test_application_alert_config.py +400 -0
  48. mcp_instana-0.1.1/tests/application/test_application_analyze.py +571 -0
  49. mcp_instana-0.1.1/tests/application/test_application_catalog.py +274 -0
  50. mcp_instana-0.1.1/tests/application/test_application_metrics.py +467 -0
  51. mcp_instana-0.1.1/tests/application/test_application_resources.py +594 -0
  52. mcp_instana-0.1.1/tests/application/test_application_settings.py +367 -0
  53. mcp_instana-0.1.1/tests/application/test_application_topology.py +224 -0
  54. mcp_instana-0.1.1/tests/core/__init__.py +1 -0
  55. mcp_instana-0.1.1/tests/core/test_server.py +694 -0
  56. mcp_instana-0.1.1/tests/core/test_utils.py +756 -0
  57. mcp_instana-0.1.1/tests/e2e/README.md +520 -0
  58. mcp_instana-0.1.1/tests/e2e/__init__.py +5 -0
  59. mcp_instana-0.1.1/tests/e2e/application/test_application_alert_config.py +1820 -0
  60. mcp_instana-0.1.1/tests/e2e/application/test_application_analyze.py +978 -0
  61. mcp_instana-0.1.1/tests/e2e/application/test_application_catalog.py +830 -0
  62. mcp_instana-0.1.1/tests/e2e/application/test_application_metrics.py +1090 -0
  63. mcp_instana-0.1.1/tests/e2e/application/test_application_resources.py +697 -0
  64. mcp_instana-0.1.1/tests/e2e/application/test_application_topology.py +422 -0
  65. mcp_instana-0.1.1/tests/e2e/conftest.py +139 -0
  66. mcp_instana-0.1.1/tests/e2e/event/test_events_tools.py +742 -0
  67. mcp_instana-0.1.1/tests/e2e/infrastructure/test_infrastructure_analyze.py +1999 -0
  68. mcp_instana-0.1.1/tests/e2e/infrastructure/test_infrastructure_catalog.py +1232 -0
  69. mcp_instana-0.1.1/tests/e2e/infrastructure/test_infrastructure_metrics.py +1081 -0
  70. mcp_instana-0.1.1/tests/e2e/infrastructure/test_infrastructure_resources.py +1240 -0
  71. mcp_instana-0.1.1/tests/e2e/infrastructure/test_infrastructure_topology.py +650 -0
  72. mcp_instana-0.1.1/tests/e2e/pytest.ini +29 -0
  73. mcp_instana-0.1.1/tests/e2e/run_e2e_tests.py +139 -0
  74. mcp_instana-0.1.1/tests/e2e/server/test_server_integration.py +1116 -0
  75. mcp_instana-0.1.1/tests/e2e/utils/test_base_instana_client.py +641 -0
  76. mcp_instana-0.1.1/tests/event/__init__.py +1 -0
  77. mcp_instana-0.1.1/tests/event/test_events_tools.py +460 -0
  78. mcp_instana-0.1.1/tests/infrastructure/__init__.py +1 -0
  79. mcp_instana-0.1.1/tests/infrastructure/test_infrastructure_analyze.py +679 -0
  80. mcp_instana-0.1.1/tests/infrastructure/test_infrastructure_catalog.py +207 -0
  81. mcp_instana-0.1.1/tests/infrastructure/test_infrastructure_metrics.py +312 -0
  82. mcp_instana-0.1.1/tests/infrastructure/test_infrastructure_resources.py +213 -0
  83. mcp_instana-0.1.1/tests/infrastructure/test_infrastructure_topology.py +219 -0
  84. mcp_instana-0.1.1/tests/log/__init__.py +1 -0
  85. mcp_instana-0.1.1/tests/log/test_log_alert_configuration.py +653 -0
  86. mcp_instana-0.1.1/tests/prompts/__init__.py +1 -0
  87. mcp_instana-0.1.1/tests/prompts/test_mcp_prompts.py +414 -0
  88. mcp_instana-0.1.1/tests/run_all_tests.py +431 -0
  89. mcp_instana-0.1.1/tests/run_all_tests_with_coverage.py +105 -0
  90. mcp_instana-0.1.1/uv.lock +3113 -0
  91. mcp_instana-0.1.0/PKG-INFO +0 -649
  92. mcp_instana-0.1.0/README.md +0 -628
  93. mcp_instana-0.1.0/pyproject.toml +0 -41
  94. mcp_instana-0.1.0/src/client/What is the sum of queue depth for all q +0 -55
  95. mcp_instana-0.1.0/src/client/instana_client_base.py +0 -93
  96. mcp_instana-0.1.0/src/client/log_alert_configuration_mcp_tools.py +0 -316
  97. mcp_instana-0.1.0/src/client/show the top 5 services with the highest +0 -28
  98. mcp_instana-0.1.0/src/mcp_server.py +0 -343
  99. {mcp_instana-0.1.0 → mcp_instana-0.1.1}/src/__init__.py +0 -0
@@ -0,0 +1,4 @@
1
+ # This enables DCO bot for you, please take a look https://github.com/probot/dco
2
+ # for more details.
3
+ require:
4
+ members: false
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main, test-ci ]
8
+
9
+ jobs:
10
+ lint-and-test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ['3.11']
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install uv
25
+ run: pip install uv
26
+
27
+ - name: Install dependencies
28
+ run: uv sync
29
+
30
+ - name: Run ruff check
31
+ run: uv run ruff check .
32
+
33
+ - name: Run tests with verbose output
34
+ run: uv run test -v
35
+
36
+ - name: Run tests with coverage
37
+ run: uv run test-coverage
@@ -0,0 +1,180 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+ .DS_Store
176
+ .venv
177
+
178
+ # Ignore tooling dirs
179
+ .Bob/
180
+ .vscode/
@@ -0,0 +1,167 @@
1
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
+ **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4
+
5
+ - [Contributing to MCP-Instana](#contributing-to-mcp-instana)
6
+ - [Prerequisites](#prerequisites)
7
+ - [Steps to Build a New MCP Tool](#steps-to-build-a-new-mcp-tool)
8
+ - [1. Set Up Your Development Environment](#1-set-up-your-development-environment)
9
+ - [3. Create a New MCP Tools Module](#3-create-a-new-mcp-tools-module)
10
+ - [4. Implement the MCP Tools class](#4-implement-the-mcp-tools-class)
11
+ - [5. Write API tool Description precisely](#5-write-api-tool-description-precisely)
12
+ - [6. Update the Main Server File](#6-update-the-main-server-file)
13
+ - [7. Test Your MCP Tool](#7-test-your-mcp-tool)
14
+ - [8. Add Documentation](#8-add-documentation)
15
+ - [9. Code Linting](#9-code-linting)
16
+ - [Troubleshooting](#troubleshooting)
17
+ - [Getting Help](#getting-help)
18
+
19
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
20
+
21
+ ### Contributing to MCP-Instana
22
+
23
+ This guide provides step-by-step instructions for building a new MCP (Model Context Protocol) tool for the [Instana API](https://developer.ibm.com/apis/catalog/instana--instana-rest-api/Introduction) within the mcp-instana project.
24
+
25
+ ### Prerequisites
26
+
27
+ - Python 3.11 or higher
28
+ - Access to Instana API (API token and base URL)
29
+ - Access to Instana python SDK [git+https://github.ibm.com/instana/instana-python-sdk](https://github.ibm.com/instana/instana-python-sdk)
30
+ - Basic understanding of the [Instana API endpoints](https://developer.ibm.com/apis/catalog/instana--instana-rest-api/Introduction)
31
+ - Familiarity with Python async programming
32
+
33
+ ### Steps to Build a New MCP Tool
34
+
35
+ #### 1. Set Up Your Development Environment
36
+
37
+ ```bash
38
+ # Clone the repository
39
+ git clone https://github.com/instana/mcp-instana.git
40
+ cd mcp-instana
41
+
42
+ # Set up the environment
43
+ uv sync
44
+ ```
45
+ #### 3. Create a New MCP Tools Module
46
+
47
+ Create a new file in the src/client directory with a descriptive name following the pattern: <api_name>_mcp_tools.py
48
+
49
+ #### 4. Implement the MCP Tools class
50
+
51
+ Follow any existing tools class under src/clinet to know the template structure for your new class.
52
+
53
+ #### 5. Write API tool Description precisely
54
+
55
+ For each tool, provide a clear description as per the prompt engineering guidelines that helps the LLM understand when to use this tool:
56
+
57
+
58
+ ```bash
59
+
60
+ @register_as_tool
61
+ async def get_example_data(self, query: str, ctx=None) -> Dict[str, Any]:
62
+ """
63
+ Retrieve example data from Instana based on the provided query.
64
+
65
+ This tool is useful when you need to get information about [specific use case].
66
+ You can filter by [parameters] to narrow down results. Use this when you want
67
+ to [common user intent], understand [specific information], or analyze [metrics/data].
68
+
69
+ For example, use this tool when asked about '[example query 1]', '[example query 2]',
70
+ or when someone wants to '[example intent]'.
71
+
72
+ Args:
73
+ query: Query string to filter results
74
+ ctx: The MCP context (optional)
75
+
76
+ Returns:
77
+ Dictionary containing example data or error information
78
+ """
79
+ ```
80
+
81
+
82
+ #### 6. Update the Main Server File
83
+
84
+ update src/mcp_server.py to register your new tools:
85
+
86
+ #### 7. Test Your MCP Tool
87
+
88
+ build the mcp-instana with
89
+
90
+ ```bash
91
+ uv pip install -e .
92
+ ```
93
+
94
+ Now open/restart the mcp host like claude desktop/github copilot and then run the query to test your new tool.
95
+
96
+ To run the MCP server locally for testing:
97
+
98
+ ```bash
99
+ # Run in Streamable HTTP mode
100
+ uv run src/core/server.py --transport streamable-http --debug
101
+
102
+ # Run with specific tool categories
103
+ uv run src/core/server.py --tools app,infra --transport streamable-http
104
+
105
+ # List all available tool categories
106
+ uv run src/core/server.py --list-tools
107
+ ```
108
+
109
+ #### 8. Add Documentation
110
+ Update the README.md file to include your new tool in the tools table:
111
+
112
+ ```bash
113
+
114
+ | Tool | Category | Description |
115
+ |---------------------------|-------------------|------------------------------------------|
116
+ | `[method_name]` | [API Category] | [Brief description of what the tool does]|
117
+ ```
118
+
119
+ #### 9. Code Linting
120
+
121
+ This project uses [Ruff](https://github.com/astral-sh/ruff) for code linting. Ruff is a fast Python linter written in Rust that helps maintain code quality and consistency.
122
+
123
+ The project ignores several linting rules to accommodate the existing codebase. See the `ignore` list in `pyproject.toml` for the complete list of ignored rules, which includes:
124
+
125
+ - `E501`: Line too long
126
+ - `SIM117`: Use a single `with` statement with multiple contexts
127
+ - `PLR0912`: Too many branches
128
+ - `E402`: Module level import not at top of file
129
+ - `ARG001`, `ARG002`, `ARG005`: Unused function/method/lambda arguments
130
+ - `PLR2004`: Magic value comparison
131
+ - `PLR0915`: Too many statements
132
+ - `PLR0911`: Too many return statements
133
+ - `B904`: Within an except clause, raise exceptions with raise from
134
+ - And others as needed for the codebase
135
+
136
+ To run the linter locally:
137
+
138
+ ```bash
139
+ # Run linter to check for issues
140
+ ./run_ruff_check.sh
141
+
142
+ # Run linter and automatically fix issues
143
+ ./run_ruff_check.sh --fix
144
+
145
+ # Run linter and automatically fix issues (including unsafe fixes)
146
+ ./run_ruff_check.sh --fix --unsafe-fixes
147
+ ```
148
+
149
+ The project also includes CI integration via GitHub Actions that automatically runs linting checks on all pull requests and pushes to the main branch. The workflow configuration is located in `.github/workflows/lint.yml`.
150
+
151
+ For pull requests, the CI will:
152
+ 1. Check for linting issues
153
+ 2. Automatically fix safe linting issues
154
+ 3. Commit the fixes back to your branch
155
+
156
+ Before submitting your code, make sure to run the linter and fix any issues. Many common issues can be automatically fixed using the `--fix` option. The CI pipeline will also verify that your code passes all linting checks.
157
+
158
+ #### Troubleshooting
159
+
160
+ If you encounter import errors, check that you're using the correct import paths.
161
+ If API calls fail, verify your API token and base URL.
162
+ Use debug printing to trace the execution flow and identify issues.
163
+ Check the Instana API documentation for any specific requirements or limitations.
164
+
165
+ #### Getting Help
166
+
167
+ If you need assistance, please open an issue on the GitHub repository or contact the project maintainers.
@@ -1,4 +1,4 @@
1
- Apache License
1
+ Apache License
2
2
  Version 2.0, January 2004
3
3
  http://www.apache.org/licenses/
4
4
 
@@ -178,7 +178,7 @@
178
178
  APPENDIX: How to apply the Apache License to your work.
179
179
 
180
180
  To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
182
  replaced with your own identifying information. (Don't include
183
183
  the brackets!) The text should be enclosed in the appropriate
184
184
  comment syntax for the file format. We also recommend that a
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2017 Solo.io, Inc.
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.