|
| 1 | +# Example MCP Gateway Configuration with Payload Size Threshold |
| 2 | +# This demonstrates the configurable payload size threshold feature |
| 3 | + |
| 4 | +[gateway] |
| 5 | +port = 3000 |
| 6 | +api_key = "your-api-key-here" |
| 7 | + |
| 8 | +# Payload directory for storing large tool responses |
| 9 | +# Default: /tmp/jq-payloads |
| 10 | +payload_dir = "/tmp/jq-payloads" |
| 11 | + |
| 12 | +# Payload size threshold (in bytes) for storing responses to disk |
| 13 | +# Payloads LARGER than this threshold are stored to disk and return metadata |
| 14 | +# Payloads SMALLER than or equal to this threshold are returned inline |
| 15 | +# Default: 1024 bytes (1KB) |
| 16 | +# |
| 17 | +# Examples: |
| 18 | +# payload_size_threshold = 1024 # 1KB - default, good for most use cases |
| 19 | +# payload_size_threshold = 512 # 512 bytes - more aggressive file storage |
| 20 | +# payload_size_threshold = 2048 # 2KB - fewer files, more inline responses |
| 21 | +# payload_size_threshold = 10240 # 10KB - minimal file storage |
| 22 | +payload_size_threshold = 1024 |
| 23 | + |
| 24 | +[servers.github] |
| 25 | +command = "docker" |
| 26 | +args = ["run", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "-i", "ghcr.io/github/github-mcp-server:latest"] |
| 27 | + |
| 28 | +[servers.filesystem] |
| 29 | +command = "docker" |
| 30 | +args = ["run", "--rm", "-i", "ghcr.io/github/filesystem-mcp-server:latest"] |
| 31 | + |
| 32 | +# How it works: |
| 33 | +# |
| 34 | +# 1. Tool returns response data |
| 35 | +# 2. Middleware marshals data to JSON |
| 36 | +# 3. If JSON size <= payload_size_threshold: |
| 37 | +# - Return response inline (no file storage) |
| 38 | +# - Original data preserved |
| 39 | +# 4. If JSON size > payload_size_threshold: |
| 40 | +# - Save full payload to {payload_dir}/{sessionID}/{queryID}/payload.json |
| 41 | +# - Return metadata response with: |
| 42 | +# * queryID: unique query identifier |
| 43 | +# * payloadPath: full path to saved file |
| 44 | +# * preview: first 500 characters |
| 45 | +# * schema: jq-inferred schema of the data |
| 46 | +# * originalSize: size in bytes |
| 47 | +# * truncated: whether preview was truncated |
| 48 | +# |
| 49 | +# Benefits: |
| 50 | +# - Small responses (errors, status messages, simple data) are fast and inline |
| 51 | +# - Large responses (file contents, lists, search results) are saved to disk |
| 52 | +# - Clients can access full payloads via filesystem when needed |
| 53 | +# - Reduces memory pressure and network overhead |
0 commit comments