@decnutz/mcpgateway 0.0.0-stage → 0.2.1
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.
- package/LICENSE +21 -0
- package/README.md +339 -2
- package/dist/src/admin.d.ts +32 -0
- package/dist/src/admin.js +123 -0
- package/dist/src/audit.d.ts +62 -0
- package/dist/src/audit.js +185 -0
- package/dist/src/cli.d.ts +34 -0
- package/dist/src/cli.js +374 -0
- package/dist/src/config.d.ts +124 -0
- package/dist/src/config.js +599 -0
- package/dist/src/downstream.d.ts +59 -0
- package/dist/src/downstream.js +279 -0
- package/dist/src/gateway.d.ts +44 -0
- package/dist/src/gateway.js +194 -0
- package/dist/src/hiddenchars.d.ts +31 -0
- package/dist/src/hiddenchars.js +77 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +7 -0
- package/dist/src/metrics.d.ts +58 -0
- package/dist/src/metrics.js +138 -0
- package/dist/src/namespace.d.ts +65 -0
- package/dist/src/namespace.js +131 -0
- package/dist/src/pinning.d.ts +35 -0
- package/dist/src/pinning.js +131 -0
- package/dist/src/policy.d.ts +31 -0
- package/dist/src/policy.js +116 -0
- package/dist/src/ratelimit.d.ts +19 -0
- package/dist/src/ratelimit.js +62 -0
- package/dist/src/upstream.d.ts +107 -0
- package/dist/src/upstream.js +546 -0
- package/dist/src/util.d.ts +19 -0
- package/dist/src/util.js +47 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.js +16 -0
- package/mcpgateway.example.yaml +90 -0
- package/package.json +49 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# mcpgateway.yaml — one process fronting all your MCP servers.
|
|
2
|
+
# The config file is TRUSTED operator input (like sshd_config): it names the
|
|
3
|
+
# commands to spawn and the URLs to call. Keep it readable only by you
|
|
4
|
+
# (chmod 600) — it holds the credentials your servers need.
|
|
5
|
+
|
|
6
|
+
gateway:
|
|
7
|
+
name: mcpgateway
|
|
8
|
+
|
|
9
|
+
servers:
|
|
10
|
+
# stdio server: spawned with shell:false and an argv array (never a shell
|
|
11
|
+
# string). The child inherits a small safe-default env (PATH, HOME, ...) plus
|
|
12
|
+
# everything under `env` below.
|
|
13
|
+
- name: github
|
|
14
|
+
transport: stdio
|
|
15
|
+
command: npx
|
|
16
|
+
args: ["-y", "@modelcontextprotocol/server-github"]
|
|
17
|
+
env:
|
|
18
|
+
GITHUB_TOKEN: "${GITHUB_TOKEN}" # ${VAR} and ${VAR:-default} supported
|
|
19
|
+
concurrency: 1 # stdio servers are usually single-threaded
|
|
20
|
+
timeoutMs: 60000 # per tool-call timeout
|
|
21
|
+
|
|
22
|
+
# Streamable HTTP server.
|
|
23
|
+
- name: docs
|
|
24
|
+
transport: http
|
|
25
|
+
url: http://localhost:8080/mcp
|
|
26
|
+
headers:
|
|
27
|
+
Authorization: "Bearer ${DOCS_TOKEN:-changeme}"
|
|
28
|
+
concurrency: 8
|
|
29
|
+
|
|
30
|
+
namespace:
|
|
31
|
+
strategy: prefix # prefix | priority | explicit
|
|
32
|
+
separator: "__" # github + create_issue -> github__create_issue
|
|
33
|
+
priority: [github] # priority strategy: earlier wins the bare name
|
|
34
|
+
mappings: {} # explicit strategy: {"toolName": "winningServer"}
|
|
35
|
+
aliases: {} # {"server:tool": "friendlyName"}
|
|
36
|
+
|
|
37
|
+
rateLimits:
|
|
38
|
+
default: { rps: 10, burst: 20 }
|
|
39
|
+
tools:
|
|
40
|
+
github__search_code: { rps: 2, burst: 4 }
|
|
41
|
+
|
|
42
|
+
policy:
|
|
43
|
+
mode: enforce # enforce | observe (observe logs would-be verdicts, forwards everything)
|
|
44
|
+
allowTools: ["*"] # glob patterns; deny wins over allow
|
|
45
|
+
denyTools: []
|
|
46
|
+
hideTools: [] # hidden from tools/list AND denied on call
|
|
47
|
+
argRules: {} # {"tool*": {deny: ["substring"], allow: ["substring"]}} — substring, not regex
|
|
48
|
+
responseRedact: [] # substrings replaced with [REDACTED] in results
|
|
49
|
+
responseBlock: [] # substrings that block the result entirely
|
|
50
|
+
responseWarn: [] # substrings that only audit-log a warning
|
|
51
|
+
hideSuspicious: false # true: hide + deny tools whose metadata has invisible characters (always audited)
|
|
52
|
+
|
|
53
|
+
auth:
|
|
54
|
+
disabled: false
|
|
55
|
+
keys:
|
|
56
|
+
- id: agent-1
|
|
57
|
+
key: "${GATEWAY_KEY:-changeme-to-a-long-random-secret}"
|
|
58
|
+
scopes: ["tools:call", "tools:list"] # + resources:*, prompts:*, admin
|
|
59
|
+
# tools: ["github__*"] # optional: this key may only list/call these (HTTP upstream only)
|
|
60
|
+
|
|
61
|
+
audit:
|
|
62
|
+
path: ./mcpgateway-audit.jsonl
|
|
63
|
+
logArgs: true # false -> only a sha256 of args is logged
|
|
64
|
+
redactKeys: [token, secret, password] # key-name substrings, case-insensitive
|
|
65
|
+
maxArgsChars: 8192
|
|
66
|
+
maxSizeMB: 100
|
|
67
|
+
keepFiles: 5
|
|
68
|
+
|
|
69
|
+
admin:
|
|
70
|
+
enabled: true
|
|
71
|
+
host: 127.0.0.1 # never 0.0.0.0 without allowPublicAdmin: true
|
|
72
|
+
port: 3001
|
|
73
|
+
|
|
74
|
+
upstream:
|
|
75
|
+
stdio: { enabled: true } # drop-in: swap the agent's server command
|
|
76
|
+
http:
|
|
77
|
+
enabled: false
|
|
78
|
+
host: 127.0.0.1
|
|
79
|
+
port: 3000
|
|
80
|
+
maxSessions: 128 # abandoned SSE sessions can't grow this table forever
|
|
81
|
+
allowedOrigins: [] # browser Origins allowed (exact); any other Origin -> 403
|
|
82
|
+
# allowedHosts: [localhost, 127.0.0.1, "[::1]"] # default on a loopback bind;
|
|
83
|
+
# set it when binding non-loopback (Host header check, DNS-rebinding guard)
|
|
84
|
+
|
|
85
|
+
pinning:
|
|
86
|
+
mode: warn # off | warn | quarantine (hide + deny changed/unpinned tools)
|
|
87
|
+
# file: ./mcpgateway.pins.json # from `mcpgateway pin`; without it, pins are taken at startup (in memory)
|
|
88
|
+
|
|
89
|
+
globalMaxInflight: 256 # hard cap on concurrent tool calls gateway-wide
|
|
90
|
+
maxResultChars: 10000000 # drop tool results larger than this (OOM guard)
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decnutz/mcpgateway",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "One gateway in front of all your MCP servers: a unified tool namespace, fleet-wide allow/deny policy, rate limits, an audit log, Prometheus metrics and bearer-key auth.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"model-context-protocol",
|
|
8
|
+
"gateway",
|
|
9
|
+
"proxy",
|
|
10
|
+
"ai-agents",
|
|
11
|
+
"policy",
|
|
12
|
+
"audit-log",
|
|
13
|
+
"prometheus"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/calasdan-sketch/mcpgateway#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/calasdan-sketch/mcpgateway/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/calasdan-sketch/mcpgateway.git"
|
|
22
|
+
},
|
|
23
|
+
"author": "Calas Automations Inc. <office@calasautomations.com>",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"bin": {
|
|
27
|
+
"mcpgateway": "./dist/src/index.js"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist/src",
|
|
34
|
+
"mcpgateway.example.yaml",
|
|
35
|
+
"!dist/src/*.map"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc",
|
|
39
|
+
"lint": "tsc --noEmit",
|
|
40
|
+
"prepack": "npm run build",
|
|
41
|
+
"test": "npm run build && node --test dist/tests/*.test.js"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@modelcontextprotocol/sdk": "1.17.0",
|
|
45
|
+
"yaml": "2.9.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "24.3.0",
|
|
49
|
+
"typescript": "5.9.2"
|
|
50
|
+
}
|
|
51
|
+
}
|