You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using HTTP/SSE transport (with `MCP_PORT` set), the server expects authentication via the `Authorization` header in each HTTP request. This is the recommended approach for server deployments.
260
+
261
+
**Important:** Since `ENABLE_LOCAL_OAUTH` defaults to `true`, you **must explicitly set it to `false`** when using HTTP/SSE mode:
262
+
263
+
```bash
264
+
# Start server with HTTP transport (OAuth must be disabled)
**Configuration validation:** The server will raise an error if both `MCP_PORT` and `ENABLE_LOCAL_OAUTH=true` are set, as HTTP/SSE mode requires per-request authentication for security reasons.
184
275
185
276
## Configuration for Different GitGuardian Instances
186
277
@@ -197,7 +288,9 @@ The following environment variables can be configured:
197
288
|`GITGUARDIAN_SCOPES`| OAuth scopes to request | Auto-detected based on instance type |`scan,incidents:read,sources:read,honeytokens:read,honeytokens:write`|
198
289
|`GITGUARDIAN_TOKEN_NAME`| Name for the OAuth token | Auto-generated based on server type |`"Developer MCP Token"`|
199
290
|`GITGUARDIAN_TOKEN_LIFETIME`| Token lifetime in days |`30`|`60` or `never`|
200
-
|`MCP_PORT`| Port for HTTP/SSE transport (when set, enables HTTP transport instead of stdio) | Not set (uses stdio) |`8000`|
291
+
|`GITGUARDIAN_PERSONAL_ACCESS_TOKEN`| Personal Access Token for authentication (alternative to OAuth) | Not set |`YOUR_PAT_TOKEN`|
292
+
|`ENABLE_LOCAL_OAUTH`| Enable local OAuth flow (stdio mode only, cannot be used with `MCP_PORT`) |`true` (enabled by default for local-first usage) |`false`|
293
+
|`MCP_PORT`| Port for HTTP/SSE transport (when set, enables HTTP transport instead of stdio, requires `ENABLE_LOCAL_OAUTH=false`) | Not set (uses stdio) |`8000`|
201
294
|`MCP_HOST`| Host address for HTTP/SSE transport |`127.0.0.1`|`0.0.0.0`|
202
295
203
296
### HTTP/SSE Transport
@@ -206,7 +299,7 @@ By default, the MCP server uses **stdio transport** for local IDE integrations.
206
299
207
300
#### Enabling HTTP Transport
208
301
209
-
To enable HTTP/SSE transport, set the `MCP_PORT` environment variable:
302
+
To enable HTTP/SSE transport, set the `MCP_PORT` environment variable. **Important:** You must also set `ENABLE_LOCAL_OAUTH=false` since OAuth defaults to enabled:
210
303
211
304
```json
212
305
{
@@ -219,6 +312,7 @@ To enable HTTP/SSE transport, set the `MCP_PORT` environment variable:
219
312
"developer-mcp-server"
220
313
],
221
314
"env": {
315
+
"ENABLE_LOCAL_OAUTH": "false",
222
316
"MCP_PORT": "8000",
223
317
"MCP_HOST": "127.0.0.1"
224
318
}
@@ -232,15 +326,15 @@ To enable HTTP/SSE transport, set the `MCP_PORT` environment variable:
232
326
You can also run the server directly with HTTP transport:
The server will automatically start on `http://127.0.0.1:8000` and be accessible for remote integrations.
240
334
241
335
#### Authentication via Authorization Header
242
336
243
-
When using HTTP/SSE transport, you can authenticate using a Personal Access Token (PAT) via the `Authorization` header. This is useful for remote integrations where environment variables or OAuth flows are not practical.
337
+
When using HTTP/SSE transport, authentication is done via the `Authorization` header on each request. See the [Per-Request Authentication](#per-request-authentication-httpsse-transport) section for detailed configuration.
244
338
245
339
**Supported header formats:**
246
340
-`Authorization: Bearer <token>`
@@ -285,11 +379,10 @@ async with httpx.AsyncClient() as client:
285
379
**Authentication Priority:**
286
380
287
381
When using HTTP transport, the authentication priority is:
288
-
1.**Authorization header** (if present in the HTTP request)
This allows different clients to use different authentication methods when connecting to the same HTTP server instance.
385
+
Note that OAuth (`ENABLE_LOCAL_OAUTH=true`) is not supported in HTTP/SSE mode for security reasons. Each HTTP request must include its own authentication credentials.
293
386
294
387
**Notes:**
295
388
-`uvicorn` is included as a dependency - no additional installation needed.
@@ -388,17 +481,19 @@ This project includes a comprehensive test suite to ensure functionality and pre
388
481
389
482
2. Run the test suite:
390
483
```bash
391
-
uv run pytest
484
+
ENABLE_LOCAL_OAUTH=false uv run pytest
392
485
```
393
486
487
+
Note: Tests disable OAuth by default via the `ENABLE_LOCAL_OAUTH=false` environment variable to prevent OAuth prompts during test execution.
488
+
394
489
3. Run tests with verbose output:
395
490
```bash
396
-
uv run pytest -v
491
+
ENABLE_LOCAL_OAUTH=false uv run pytest -v
397
492
```
398
493
399
494
4. Run tests with coverage:
400
495
```bash
401
-
uv run pytest --cov=packages --cov-report=html
496
+
ENABLE_LOCAL_OAUTH=false uv run pytest --cov=packages --cov-report=html
402
497
```
403
498
404
499
This will run all tests and generate a coverage report showing which parts of the codebase are covered by tests.
0 commit comments