bugzilla-mcp 0.6.0__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.
@@ -0,0 +1,192 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (which shall not include Communications that are clearly marked or
39
+ otherwise designated in writing by the copyright owner as "Not a Work").
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is clearly marked or otherwise designated
61
+ in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2025
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
192
+
@@ -0,0 +1,467 @@
1
+ Metadata-Version: 2.4
2
+ Name: bugzilla-mcp
3
+ Version: 0.6.0
4
+ Summary: MCP server for Bugzilla: search, read, triage and update bugs from AI assistants. Read-only by default.
5
+ Keywords: mcp,bugzilla,bug-tracking,model-context-protocol,fastmcp
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Environment :: Console
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Topic :: Software Development :: Bug Tracking
17
+ Requires-Dist: fastmcp>=4.0.11,<5
18
+ Requires-Dist: python-dotenv
19
+ Requires-Dist: httpx
20
+ Requires-Dist: pytest>=8.0.0 ; extra == 'test'
21
+ Requires-Dist: pytest-asyncio>=0.24.0 ; extra == 'test'
22
+ Requires-Dist: pytest-httpx>=0.30.0 ; extra == 'test'
23
+ Requires-Dist: pytest-cov>=4.1.0 ; extra == 'test'
24
+ Requires-Python: >=3.12
25
+ Project-URL: Homepage, https://github.com/SanthoshSiddegowda/bugzilla-mcp
26
+ Project-URL: Documentation, https://github.com/SanthoshSiddegowda/bugzilla-mcp#readme
27
+ Project-URL: Issues, https://github.com/SanthoshSiddegowda/bugzilla-mcp/issues
28
+ Project-URL: Changelog, https://github.com/SanthoshSiddegowda/bugzilla-mcp/releases
29
+ Provides-Extra: test
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Bugzilla MCP Server
33
+
34
+ ![Tests](https://github.com/SanthoshSiddegowda/bugzilla-mcp/actions/workflows/tests.yml/badge.svg)
35
+
36
+ A Model Context Protocol (MCP) server that enables secure interaction with Bugzilla instances. This server facilitates communication between AI applications and Bugzilla bug tracking systems through a controlled interface.
37
+
38
+ ## Install
39
+
40
+ The server runs on your machine, so your Bugzilla API key never leaves it. It starts **read-only**: tools that change Bugzilla stay off until you turn them on.
41
+
42
+ ### Claude Desktop: one click
43
+
44
+ 1. Download **[bugzilla-mcp.mcpb](https://github.com/SanthoshSiddegowda/bugzilla-mcp/releases/latest/download/bugzilla-mcp.mcpb)** from the latest release.
45
+ 2. Double-click it (or open **Settings → Extensions** and install it there).
46
+ 3. Enter your Bugzilla URL and [API key](#api-key). Leave **Read-only** ticked unless you want Claude to update bugs.
47
+
48
+ No Python or terminal needed. The API key is stored as a secret by Claude Desktop.
49
+
50
+ ### Claude Code
51
+
52
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/) once, then:
53
+
54
+ ```bash
55
+ claude mcp add bugzilla --scope user \
56
+ -e BUGZILLA_URL=https://bugzilla.example.com \
57
+ -e BUGZILLA_API_KEY=your-api-key \
58
+ -- uvx bugzilla-mcp
59
+ ```
60
+
61
+ Add `--allow-writes` after `bugzilla-mcp` to enable write tools. Check it with `claude mcp list`.
62
+
63
+ ### Cursor, VS Code and other MCP clients
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "bugzilla": {
69
+ "command": "uvx",
70
+ "args": ["bugzilla-mcp"],
71
+ "env": {
72
+ "BUGZILLA_URL": "https://bugzilla.example.com",
73
+ "BUGZILLA_API_KEY": "your-api-key"
74
+ }
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ If the client can't find `uvx` (desktop apps don't always load your shell's `PATH`), use the full path from `which uvx`.
81
+
82
+ ### pip
83
+
84
+ ```bash
85
+ pip install bugzilla-mcp
86
+ bugzilla-mcp --help
87
+ ```
88
+
89
+ ### Options
90
+
91
+ | Setting | How | Default |
92
+ |---|---|---|
93
+ | Bugzilla URL | `BUGZILLA_URL` | required |
94
+ | API key | `BUGZILLA_API_KEY` (environment or `.env` only, never a flag) | required |
95
+ | Write tools | `--allow-writes` or `BUGZILLA_READ_ONLY=false` | off |
96
+ | Remove tools | `BUGZILLA_DISABLED_TOOLS=update_bug,create_bug` | none |
97
+ | Run as an HTTP server for several users | `bugzilla-mcp --transport http --host 0.0.0.0 --port 8000` (credentials then come from each request's headers) | stdio |
98
+
99
+ ### API key
100
+
101
+ Create one in Bugzilla under **Preferences → API Keys** (`https://your-bugzilla/userprefs.cgi?tab=apikey`). The key has the same permissions as your account, so a dedicated account with limited access is safest.
102
+
103
+
104
+ ## Features
105
+
106
+ This MCP server provides a comprehensive interface for AI agents to interact with Bugzilla, exposing **28 specialized tools** categorized into:
107
+
108
+ - **🔍 Advanced Search & Discovery**:
109
+ - Full-text search with Bugzilla's fast `bugs_quicksearch` syntax.
110
+ - Multi-criteria `bugs_advanced_search` (filter by product, component, status, severity, keywords, and more).
111
+ - Browse accessible products (`list_products`) and component schemas (`get_product_components`).
112
+ - Read a bug (`bug_info`) in compact form by default: empty fields (e.g. unused `cf_*` custom fields) and the `update_token` are dropped. Pass `full=True` for every field.
113
+
114
+ - **✏️ Write & Comprehensive Updates**:
115
+ - File new bugs (`create_bug`) with assignees, keywords, severities, and descriptions.
116
+ - Tools carry MCP hints (`readOnlyHint` / `destructiveHint`), so clients can auto-approve reads and ask before `update_bug` changes a bug.
117
+ - Atomically update any bug property (`update_bug`) — supports status, resolution, assignments, priority/severity, milestone, version, CC list, keywords, and any custom fields (e.g. `cf_qatouch_id`).
118
+ - Append public or private comments (`add_comment`) and tag comments semantically (`tag_comment`).
119
+
120
+ - **📊 Bulk Triage & Analytics**:
121
+ - Parallel batch retrieval of metadata (`bugs_info`) and comments (`bugs_comments`).
122
+ - Compress long discussion threads dynamically (`bugs_analysis_context`) to fit in standard LLM context windows.
123
+ - Categorize bug batches automatically (`classify_bugs_heuristics`) and generate statistical metrics (`analyze_bugs_statistics`). Rules use status and resolution only: closed as INVALID/WONTFIX/DUPLICATE/WORKSFORME/NOTABUG → `invalid`; NEW/ASSIGNED/REOPENED/UNCONFIRMED → `to_fix`; anything else → `review_needed`.
124
+ - Preview bulk changes with `update_bug(dry_run=True)`, which returns the planned changes and current values without writing.
125
+
126
+ - **📎 Robust Attachment Handling**:
127
+ - List a bug's attachments (`bug_attachments`) and read one (`get_attachment`): screenshots come back as images, logs and patches as text.
128
+ - Attach logs, patches or files (`upload_attachment`) by passing `text` or `data_base64`, with automatic content-type detection.
129
+ - **Local server only** (`server_local.py`): save attachments to disk (`download_attachments`, `download_attachment`) and upload from a `file_path`. The hosted server doesn't offer the download tools and refuses `file_path`, so callers can't read or write files on the shared machine.
130
+
131
+ - **👤 User Management & Auditing**:
132
+ - Audit full change histories (`bug_history`) with time and field filters.
133
+ - Fetch detailed user profiles (`get_user`) and search user databases (`search_users`).
134
+ - Traverse dependency/blocker trees (`bug_dependencies`) and resolve duplicate bug chains (`duplicate_chain`).
135
+
136
+ ## HTTP Server Headers
137
+
138
+ The server requires HTTP headers for authentication. Configure your MCP client with the following headers:
139
+
140
+ - **`api_key`** (Required) - Your Bugzilla API key
141
+ - Get your API key from: `https://your-bugzilla-instance.com/userprefs.cgi?tab=apikey`
142
+ - **`bugzilla_url`** (Required) - The base URL of your Bugzilla instance (Bugzilla 5.0+)
143
+ - Example: `https://bugzilla.test.org`
144
+
145
+ - **`read_only`** (Optional, default `true`) - The server starts in **read-only mode**: tools that change Bugzilla (`update_bug`, `create_bug`, `add_comment`, `upload_attachment`, `tag_comment`) are hidden and refused. Send `read_only: false` to enable them. For the local stdio server, set `BUGZILLA_READ_ONLY=false` instead.
146
+
147
+ Self-hosting? `BUGZILLA_READ_ONLY` sets the server's default, and `BUGZILLA_DISABLED_TOOLS=update_bug,create_bug` removes individual tools entirely.
148
+
149
+ > **How the key is sent**: the server forwards your key to Bugzilla in the `X-BUGZILLA-API-KEY` header. Stock Bugzilla 5.0/5.2 don't support that header, so for them it falls back to `?api_key=` (deprecated, see [Deprecations](#deprecations)).
150
+ >
151
+ > **Hosted server**: when you use `https://bugzilla.fastmcp.app/mcp`, your API key passes through that server on its way to your Bugzilla instance. If you don't want a third party to handle your key, [run the server locally](#running-the-server-locally).
152
+
153
+ ## Try the Hosted Server
154
+
155
+ Want to try it before installing? A hosted server runs at `https://bugzilla.fastmcp.app/mcp`. Your API key passes through that server on its way to your Bugzilla, so for real use, [install it locally](#install).
156
+
157
+ ### With Claude Code
158
+
159
+ ```bash
160
+ claude mcp add --transport http bugzilla https://bugzilla.fastmcp.app/mcp \
161
+ --scope user \
162
+ --header "api_key: your-api-key-here" \
163
+ --header "bugzilla_url: https://bugzilla.example.com"
164
+ ```
165
+
166
+ `--scope user` makes the server available in all projects and keeps your key out of the repo. Verify with `claude mcp list`, then start a new session.
167
+
168
+ To share the config with a team via a project `.mcp.json`, reference environment variables instead of hardcoding the key:
169
+
170
+ ```json
171
+ {
172
+ "mcpServers": {
173
+ "bugzilla": {
174
+ "type": "http",
175
+ "url": "https://bugzilla.fastmcp.app/mcp",
176
+ "headers": {
177
+ "api_key": "${BUGZILLA_API_KEY}",
178
+ "bugzilla_url": "${BUGZILLA_URL}"
179
+ }
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ ### With Claude Desktop
186
+
187
+ Claude Desktop's `claude_desktop_config.json` only supports local (stdio) servers, so connect through the [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) bridge (requires Node.js):
188
+
189
+ ```json
190
+ {
191
+ "mcpServers": {
192
+ "bugzilla": {
193
+ "command": "npx",
194
+ "args": [
195
+ "-y",
196
+ "mcp-remote",
197
+ "https://bugzilla.fastmcp.app/mcp",
198
+ "--header",
199
+ "api_key:your-api-key-here",
200
+ "--header",
201
+ "bugzilla_url:https://bugzilla.example.com"
202
+ ]
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ Restart Claude Desktop after saving.
209
+
210
+ > **Note**: For local development, use `http://127.0.0.1:8000/mcp` instead.
211
+
212
+ ### With Cursor IDE
213
+
214
+ Add this to your `.cursor/mcp.json`:
215
+
216
+ ```json
217
+ {
218
+ "mcpServers": {
219
+ "bugzilla": {
220
+ "url": "https://bugzilla.fastmcp.app/mcp",
221
+ "headers": {
222
+ "api_key": "your-api-key-here",
223
+ "bugzilla_url": "https://bugzilla.example.com"
224
+ }
225
+ }
226
+ }
227
+ }
228
+ ```
229
+
230
+ > **Note**: For local development, use `http://127.0.0.1:8000/mcp` instead.
231
+
232
+ ### With Visual Studio Code
233
+
234
+ Add this to your `mcp.json`:
235
+
236
+ ```json
237
+ {
238
+ "servers": {
239
+ "bugzilla": {
240
+ "type": "http",
241
+ "url": "https://bugzilla.fastmcp.app/mcp",
242
+ "headers": {
243
+ "api_key": "your-api-key-here",
244
+ "bugzilla_url": "https://bugzilla.example.com"
245
+ }
246
+ }
247
+ }
248
+ }
249
+ ```
250
+
251
+ > **Note**: For local development, use `http://127.0.0.1:8000/mcp` instead.
252
+
253
+ ## Run from a Source Checkout
254
+
255
+ For local development, testing, or self-hosting, you can run the Bugzilla MCP server in two modes: **Local stdio Server** (recommended for personal use/single user) or **Local HTTP Server** (best for multi-user or remote setups).
256
+
257
+ #### 🛠️ Environment Configuration
258
+
259
+ Before running either server type, you should configure your Bugzilla credentials. We provide a `.env.example` file in the root of the project to help you get started.
260
+
261
+ 1. **Create your `.env` file**:
262
+ ```bash
263
+ cp .env.example .env
264
+ ```
265
+ 2. **Configure your credentials**:
266
+ Open the `.env` file in your preferred editor and fill in your details:
267
+ ```ini
268
+ BUGZILLA_URL=https://bugzilla.example.com
269
+ BUGZILLA_API_KEY=your-api-key-here
270
+ ```
271
+ > [!NOTE]
272
+ > - **`BUGZILLA_URL`**: The base URL of your Bugzilla instance (e.g. `https://bugzilla.mozilla.org`).
273
+ > - **`BUGZILLA_API_KEY`**: Your Bugzilla API key. You can generate one from your Bugzilla User Preferences page (usually under `https://your-bugzilla-instance.com/userprefs.cgi?tab=apikey`).
274
+
275
+ ---
276
+
277
+ #### 1. Local stdio Server (Recommended)
278
+
279
+ This runs as a background process managed directly by your MCP client (such as Claude Desktop or Cursor) using standard input/output (stdio) transport. It reads credentials securely from your environment variables or the `.env` file.
280
+
281
+ ##### Step 1: Install Dependencies
282
+
283
+ ```bash
284
+ # Using uv (highly recommended)
285
+ uv sync
286
+
287
+ # Or using standard Python virtual environment
288
+ python -m venv .venv
289
+ source .venv/bin/activate
290
+ pip install .
291
+ ```
292
+
293
+ ##### Step 2: Configure MCP Client
294
+
295
+ Make sure to replace `/absolute/path/to/bugzilla-mcp` with the actual absolute path to this project directory on your machine.
296
+
297
+ ###### **With Claude Desktop**
298
+ Add the following to your `claude_desktop_config.json` (typically located at `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS or `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
299
+
300
+ ```json
301
+ {
302
+ "mcpServers": {
303
+ "bugzilla-local": {
304
+ "command": "uv",
305
+ "args": [
306
+ "run",
307
+ "--directory",
308
+ "/absolute/path/to/bugzilla-mcp",
309
+ "python",
310
+ "server_local.py"
311
+ ],
312
+ "env": {
313
+ "BUGZILLA_URL": "https://bugzilla.example.com",
314
+ "BUGZILLA_API_KEY": "your-api-key-here"
315
+ }
316
+ }
317
+ }
318
+ }
319
+ ```
320
+
321
+ ###### **With Cursor IDE**
322
+ You can configure the server in **Cursor Settings -> Features -> MCP** as a `command` type:
323
+
324
+ - **Name**: `bugzilla-local`
325
+ - **Type**: `command`
326
+ - **Command**: `uv run --directory /absolute/path/to/bugzilla-mcp python server_local.py`
327
+
328
+ Or add it directly to your `.cursor/mcp.json` or `mcp.json` if configured programmatically:
329
+
330
+ ```json
331
+ {
332
+ "mcpServers": {
333
+ "bugzilla-local": {
334
+ "command": "uv",
335
+ "args": [
336
+ "run",
337
+ "--directory",
338
+ "/absolute/path/to/bugzilla-mcp",
339
+ "python",
340
+ "server_local.py"
341
+ ],
342
+ "env": {
343
+ "BUGZILLA_URL": "https://bugzilla.example.com",
344
+ "BUGZILLA_API_KEY": "your-api-key-here"
345
+ }
346
+ }
347
+ }
348
+ }
349
+ ```
350
+
351
+ ###### **With Claude Code (CLI)**
352
+ To add the Bugzilla MCP server to Claude Code, run the following command in your terminal:
353
+
354
+ ```bash
355
+ # Add as a project-scoped server (available only in current project)
356
+ claude mcp add bugzilla-local --scope project -- uv run --directory /absolute/path/to/bugzilla-mcp python server_local.py
357
+
358
+ # Or add as a user-scoped server (available across all projects)
359
+ claude mcp add bugzilla-local --scope user -- uv run --directory /absolute/path/to/bugzilla-mcp python server_local.py
360
+ ```
361
+
362
+ > [!TIP]
363
+ > - By configuring the `.env` file in `/absolute/path/to/bugzilla-mcp`, the server automatically loads your `BUGZILLA_URL` and `BUGZILLA_API_KEY` on startup without needing to pass them explicitly as CLI flags.
364
+ > - You can check the server status in Claude Code using `claude mcp list` or by running the `/mcp` command inside Claude Code. Remember to restart your Claude Code session after adding or modifying the server!
365
+
366
+ ---
367
+
368
+ #### 2. Local HTTP Server
369
+
370
+ This runs a local HTTP server with Server-Sent Events (SSE) transport. It's dynamic and validates credentials per-request, meaning clients must supply headers on each call.
371
+
372
+ ##### Step 1: Start the HTTP Server
373
+
374
+ ```bash
375
+ # Start local HTTP server
376
+ uv run python server.py
377
+ ```
378
+ The server will start at `http://127.0.0.1:8000/mcp`.
379
+
380
+ ##### Step 2: Configure Client to Use HTTP Server
381
+
382
+ Configure your MCP clients to use this local URL and provide authentication headers dynamically:
383
+
384
+ ###### **With Claude Desktop or Cursor**
385
+ ```json
386
+ {
387
+ "mcpServers": {
388
+ "bugzilla-local-http": {
389
+ "url": "http://127.0.0.1:8000/mcp",
390
+ "headers": {
391
+ "api_key": "your-api-key-here",
392
+ "bugzilla_url": "https://bugzilla.example.com"
393
+ }
394
+ }
395
+ }
396
+ }
397
+ ```
398
+
399
+ ###### **With Visual Studio Code**
400
+ Add this to your `mcp.json`:
401
+ ```json
402
+ {
403
+ "servers": {
404
+ "bugzilla-local-http": {
405
+ "type": "http",
406
+ "url": "http://127.0.0.1:8000/mcp",
407
+ "headers": {
408
+ "api_key": "your-api-key-here",
409
+ "bugzilla_url": "https://bugzilla.example.com"
410
+ }
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ ## Development
417
+
418
+ ```bash
419
+ git clone https://github.com/SanthoshSiddegowda/bugzilla-mcp.git
420
+ cd bugzilla-mcp
421
+
422
+ # Install dependencies (uv creates the virtual environment)
423
+ uv sync --all-extras
424
+
425
+ # Run the tests
426
+ uv run pytest tests
427
+
428
+ # Inspect the server
429
+ uv run fastmcp inspect server.py:mcp
430
+ ```
431
+
432
+ ## Deprecations
433
+
434
+ ### API key in the query string (Bugzilla 5.0 / 5.2)
435
+
436
+ The server sends your API key to Bugzilla in the `X-BUGZILLA-API-KEY` header, which keeps it out of URLs and access logs. Stock Bugzilla **5.0 and 5.2 don't read that header**, so for those instances the server falls back to sending the key as `?api_key=` (the previous behaviour) and logs a deprecation warning.
437
+
438
+ - **Nothing breaks**: existing setups keep working with no config changes.
439
+ - The server detects support automatically, once per Bugzilla URL, using a probe that never sends your real key.
440
+ - bugzilla.mozilla.org and Bugzilla `master` already use the header.
441
+ - The query-string fallback will be removed once a stable Bugzilla release supports the header. Until then, if your Bugzilla runs 5.0/5.2, make sure its web server and any proxies don't keep query strings in access logs.
442
+
443
+ ## Security Considerations
444
+
445
+ - Never commit API keys or credentials
446
+ - Use API keys with minimal required permissions
447
+ - Consider implementing rate limiting for production use
448
+ - Use HTTPS for the Bugzilla URL in production
449
+
450
+ ## Security Best Practices
451
+
452
+ This MCP implementation requires Bugzilla API access to function. For security:
453
+
454
+ 1. **Use a dedicated Bugzilla account**. A Bugzilla API key has the same permissions as the account that created it, so limit the account (group membership, product access) rather than the key
455
+ 2. **Never use administrative accounts**
456
+ 3. **Be aware the server can write**: the `add_comment` tool posts comments as that account
457
+ 4. **Revoke and rotate keys** regularly from `userprefs.cgi?tab=apikey`
458
+
459
+ ⚠️ **IMPORTANT**: Always follow the principle of least privilege when configuring API access.
460
+
461
+ ## Acknowledgments
462
+
463
+ This project was inspired by [Sai Karthik's mcp-bugzilla](https://kskarthik.gitlab.io/logs/mcp-server-bugzilla/) project. His work on building an MCP server for Bugzilla using FastMCP provided valuable insights and inspiration. Thank you for sharing your experience and contributing to the MCP ecosystem!
464
+
465
+ ## License
466
+
467
+ Apache 2.0 License - see LICENSE file for details.