Skip to content
Open
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
0f0e501
feat: Add MCP Gateway with persistent session management
roh26it Aug 17, 2025
44d8a4a
Using session state flags and getter/setters
roh26it Aug 17, 2025
1f75837
Moved handler function into it's own file
roh26it Aug 17, 2025
58e10cd
Adding OAuth support to the MCP Gateway
roh26it Aug 18, 2025
abf2034
Simplified client registration flow
roh26it Aug 18, 2025
f46eda7
Improved consent dialog box
roh26it Aug 18, 2025
6020dce
Refactored to move all data objects in the root of the repo
roh26it Aug 18, 2025
c1748f2
Better Security
roh26it Aug 22, 2025
25dd48c
Implemented refresh_token
roh26it Aug 22, 2025
2f861eb
Running it on 8789 by default now
roh26it Aug 25, 2025
1b3a3aa
Abstracted caches into a single handler. Minor cleanup
roh26it Aug 25, 2025
8293b76
http <> sse, sse<>sse, sse<>http and oauth local work now
roh26it Sep 1, 2025
a6ec4b5
Implemented prompts, resources, resource templates, logging, ping
roh26it Sep 1, 2025
ecdda4c
Control Plane is now attached as a middleware
roh26it Sep 2, 2025
f6f3833
feat: workspace id scoping to mcp server ids
roh26it Sep 3, 2025
bfa872d
chore: cache improvements
roh26it Sep 3, 2025
4ed6602
chore: start-server now manages both llm and mcp gateways using minimist
roh26it Sep 3, 2025
2eb7336
fix: build now works
roh26it Sep 3, 2025
ad5842d
fix: add .js extension to MCP SDK type imports for proper module reso…
roh26it Sep 3, 2025
0b8d74c
chore: start-server starts mcp server as well
roh26it Sep 4, 2025
fb7e885
feat: support control plane for upstreamAuth
roh26it Sep 4, 2025
33fd796
Cache changes to make it work with workerd
roh26it Sep 4, 2025
6a1f577
Error logging on wrangler
roh26it Sep 4, 2025
b5cb4bc
chore: minor cache fixes
roh26it Sep 4, 2025
f30f7d7
fix: remove graceful stop for now
roh26it Sep 4, 2025
c989209
chore: cleanup hydrateContext
roh26it Sep 4, 2025
108b245
chore: better auth window
roh26it Sep 4, 2025
b357e70
chore: better caching
roh26it Sep 4, 2025
65b8777
chore: default logger to info
roh26it Sep 4, 2025
a1b6940
chore: reorg files
roh26it Sep 4, 2025
155aaa4
chore:Verify code challenge through oidc
roh26it Sep 5, 2025
bb68cbd
chore: moved upstream manager to its own file
roh26it Sep 5, 2025
adb14ce
chore: simpler sessionstatemanager
roh26it Sep 5, 2025
5726649
chore: cleanup code
roh26it Sep 6, 2025
e20cdad
chore: refactored for better readability
roh26it Sep 7, 2025
3b60ca4
chore: update WWW-Authenticate header to include resource metadata
roh26it Sep 8, 2025
5b85b64
chore: update import paths to include file extensions for consistency
roh26it Sep 8, 2025
4ce0b59
chore: generate unique client ID by hashing clientData if not provided
roh26it Sep 8, 2025
cca02b0
chore: update .gitignore to include cursor files
roh26it Sep 8, 2025
5c789cf
feat: enhance SSE endpoint and add new well-known route for protected…
roh26it Sep 8, 2025
89abf3e
feat: add Redis cache backend support and refactor cache service for …
roh26it Sep 8, 2025
3b55fe8
fix: remove unnecessary TTL parameter from loadLocalServerConfigs and…
roh26it Sep 8, 2025
6aaa380
refactor: simplify capabilities handling and improve logging in MCPSe…
roh26it Sep 8, 2025
310474a
feat: enhance OAuth redirection flow with intermediate pages for auth…
roh26it Sep 8, 2025
0f63b89
refactor: clean up unused TODO comments and improve OAuthGateway scop…
roh26it Sep 10, 2025
3352b0b
fix: update WWW-Authenticate header to include path in resource metadata
roh26it Sep 10, 2025
46e742d
refactor: remove error parameters from createWWWAuthenticateHeader an…
roh26it Sep 10, 2025
ec03ff1
fix: improve error handling and logging during token exchange in OAut…
roh26it Sep 10, 2025
92974fd
fix: enhance error handling and logging for token exchange failures i…
roh26it Sep 10, 2025
e3b9c14
feat: add saveMCPServerTokens method to ControlPlane and integrate wi…
roh26it Sep 10, 2025
5fd585e
fix: temporarily disable state parameter removal in OAuthGateway and …
roh26it Sep 10, 2025
21cac17
fix: update MCP server API endpoints to use serverId as a primary ide…
roh26it Sep 11, 2025
b619052
fix: update authorization headers in ControlPlane middleware for impr…
roh26it Sep 11, 2025
b18eee5
fix: streamline authorization header construction in ControlPlane mid…
roh26it Sep 11, 2025
a6871f4
refactor: update transport types from 'streamable-http' to 'http' acr…
roh26it Sep 11, 2025
cfa30fe
feat: add getMCPServerClientInfo method to ControlPlane and enhance c…
roh26it Sep 11, 2025
cb653af
fix: update MCP server configuration retrieval to use mcp_integration…
roh26it Sep 11, 2025
3921f06
chore: remove example OAuth configuration and token cache files to st…
roh26it Sep 11, 2025
4533b7a
fix: update ControlPlane request URL to include versioning for API co…
roh26it Sep 11, 2025
97a8fbe
feat: integrate GatewayOAuthProvider for improved OAuth handling and …
roh26it Sep 11, 2025
26c1936
feat: enhance OAuth error handling and token purging logic in MCP ser…
roh26it Sep 11, 2025
8fef84d
fix: update import path for auth module in oauthGateway to ensure com…
roh26it Sep 11, 2025
7ad20ae
refactor: simplify redirect handling in OAuthGateway by removing unne…
roh26it Sep 11, 2025
8cbff00
fix: update default auth type to 'none' and transport type to 'http' …
roh26it Sep 12, 2025
052436c
feat: implement OAuth token revocation utilities and enhance MCP toke…
roh26it Sep 12, 2025
0edc410
refactor: update revokeAllClientTokens to accept tokenInfo object for…
roh26it Sep 12, 2025
a28e416
chore: remove unused dotenv import from mcp-index.ts to clean up code
roh26it Sep 12, 2025
1d8fd24
feat: add admin routes for managing MCP servers and cache, including …
roh26it Sep 12, 2025
ea5c36b
refactor: restructure MCP Gateway by moving start-mcp.ts logic to mcp…
roh26it Sep 15, 2025
7833985
chore: lint checks
roh26it Sep 16, 2025
ac5835b
refactor: update cache backend configuration to reduce default TTL fr…
roh26it Sep 16, 2025
13521bf
refactor: remove sessionMiddleware from MCP request handling to strea…
roh26it Sep 16, 2025
c66fc00
refactor: centralize base URL retrieval in MCP routes and middleware …
roh26it Sep 16, 2025
ea8315b
refactor: enhance revokeAllClientTokens function by simplifying refre…
roh26it Sep 18, 2025
eb2db4d
merge main into feat/mcp
VisargD Sep 22, 2025
10b0506
chore: remove unnecessary session and uptime information from health …
VisargD Sep 22, 2025
bd02b8b
feat: add controlPlane check in OAuth middleware
VisargD Sep 22, 2025
8b93fa7
fix: keep default llm gateway as default if no args are passed in sta…
VisargD Sep 23, 2025
6c15eee
fix: correct syntax in createWWWAuthenticateHeader function by adding…
VisargD Sep 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@ plugins/**/.creds.json
plugins/**/creds.json
plugins/**/.parameters.json
src/handlers/tests/.creds.json

data/**/*.json
.cursor/*
11 changes: 11 additions & 0 deletions data/servers.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"servers": {
"default/deepwiki": {
"name": "DeepWiki MCP Server",
"url": "https://mcp.deepwiki.com/mcp",
"description": "GitHub repository documentation and Q&A",
"auth_type": "none",
"type": "http"
}
}
}
133 changes: 133 additions & 0 deletions docs/logging-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Logging Configuration

The MCP Gateway uses a configurable logging system optimized for production environments.

## Production Default

**In production (`NODE_ENV=production`), only ERROR and CRITICAL logs are shown by default.**

## Configuration

Logging can be configured through environment variables:

### `LOG_LEVEL`
Controls the verbosity of logs. Available levels:
- `ERROR` (0) - Only errors (default in production)
- `CRITICAL` (1) - Critical information and errors
- `WARN` (2) - Warnings, critical info, and errors
- `INFO` (3) - General info, warnings, critical, and errors (default in development)
- `DEBUG` (4) - All logs including debug information

### `NODE_ENV`
When set to `production`:
- Default log level is `ERROR`
- Colors are disabled by default
- Only critical information is logged

Example:
```bash
# Production mode - minimal logging
NODE_ENV=production npm start

# Development mode with debug logs
LOG_LEVEL=DEBUG npm start

# Production with critical info
NODE_ENV=production LOG_LEVEL=CRITICAL npm start
```

### `LOG_TIMESTAMP`
Controls whether timestamps are included in logs.
- Default: `true`
- Set to `false` to disable timestamps

Example:
```bash
LOG_TIMESTAMP=false npm start
```

### `LOG_COLORS`
Controls whether logs are colorized.
- Default: `true`
- Set to `false` to disable colors (useful for log files)

Example:
```bash
LOG_COLORS=false npm start > logs.txt
```

## Log Format

Logs follow this format:
```
[timestamp] [prefix] [level] message
```

Example:
```
[2024-01-20T10:30:45.123Z] [MCP-Gateway] [INFO] Creating new session for server: linear
[2024-01-20T10:30:45.456Z] [Session:abc12345] [INFO] Connected to upstream with sse transport
```

## Log Levels Guide

### ERROR
- Connection failures
- Critical errors that prevent operation
- Unhandled exceptions
- Session initialization failures

### CRITICAL
- Server startup/shutdown events
- Session recovery status
- Important lifecycle events that should always be logged

### WARN
- Session not found
- Rate limiting triggered
- Invalid requests
- Non-critical failures

### INFO
- Session creation/restoration
- Transport connections established
- Tool filtering applied
- General operational events

### DEBUG
- Request/response details
- Transport state changes
- Detailed operation flow
- Capability discovery

## Usage in Code

The logger is automatically created with appropriate prefixes:
- `MCP-Gateway` - Main gateway operations
- `Session:{id}` - Session-specific operations (truncated ID for readability)

## Production Recommendations

For production environments (automatic minimal logging):
```bash
NODE_ENV=production npm start
# Only shows errors by default
```

For production with critical events:
```bash
NODE_ENV=production LOG_LEVEL=CRITICAL npm start
# Shows errors + critical lifecycle events
```

For debugging in development:
```bash
LOG_LEVEL=DEBUG npm start
# Shows everything
```

For debugging in production (temporary):
```bash
NODE_ENV=production LOG_LEVEL=INFO npm start
# Override production defaults for troubleshooting
```
Loading