@kieksme/mcp-http-kit 0.0.0-stage → 0.1.0
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 +177 -2
- package/SECURITY.md +19 -0
- package/dist/auth/bearer.d.ts +14 -0
- package/dist/auth/bearer.d.ts.map +1 -0
- package/dist/auth/bearer.js +43 -0
- package/dist/auth/bearer.js.map +1 -0
- package/dist/auth/context.d.ts +7 -0
- package/dist/auth/context.d.ts.map +1 -0
- package/dist/auth/context.js +46 -0
- package/dist/auth/context.js.map +1 -0
- package/dist/auth/index.d.ts +25 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +34 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth.d.ts +25 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/oauth.js +161 -0
- package/dist/auth/oauth.js.map +1 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +178 -0
- package/dist/config.js.map +1 -0
- package/dist/http/app.d.ts +27 -0
- package/dist/http/app.d.ts.map +1 -0
- package/dist/http/app.js +125 -0
- package/dist/http/app.js.map +1 -0
- package/dist/http/host-guard.d.ts +22 -0
- package/dist/http/host-guard.d.ts.map +1 -0
- package/dist/http/host-guard.js +46 -0
- package/dist/http/host-guard.js.map +1 -0
- package/dist/http/index.d.ts +4 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +4 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/node.d.ts +36 -0
- package/dist/http/node.d.ts.map +1 -0
- package/dist/http/node.js +74 -0
- package/dist/http/node.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/start.d.ts +16 -0
- package/dist/start.d.ts.map +1 -0
- package/dist/start.js +83 -0
- package/dist/start.js.map +1 -0
- package/dist/test/helpers.d.ts +35 -0
- package/dist/test/helpers.d.ts.map +1 -0
- package/dist/test/helpers.js +169 -0
- package/dist/test/helpers.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +2 -0
- package/dist/test/index.js.map +1 -0
- package/dist/types.d.ts +112 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/upstream.d.ts +17 -0
- package/dist/upstream.d.ts.map +1 -0
- package/dist/upstream.js +49 -0
- package/dist/upstream.js.map +1 -0
- package/docs/migration.md +110 -0
- package/package.json +94 -4
- package/templates/Dockerfile +46 -0
- package/templates/railway.json +13 -0
- package/templates/server.json +79 -0
- package/templates/smithery.yaml +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,96 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kieksme/mcp-http-kit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared Streamable HTTP transport, auth (bearer + OAuth 2.1 resource server), and deploy tooling for kieksme MCP servers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./test": {
|
|
14
|
+
"types": "./dist/test/index.d.ts",
|
|
15
|
+
"import": "./dist/test/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"templates",
|
|
22
|
+
"docs",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"SECURITY.md"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.14.0"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/kieksme/mcp-http-kit.git"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/kieksme/mcp-http-kit#readme",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/kieksme/mcp-http-kit/issues"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"keywords": [
|
|
40
|
+
"mcp",
|
|
41
|
+
"model-context-protocol",
|
|
42
|
+
"streamable-http",
|
|
43
|
+
"oauth",
|
|
44
|
+
"railway",
|
|
45
|
+
"kieksme"
|
|
46
|
+
],
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public",
|
|
49
|
+
"provenance": true
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"prebuild": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
|
|
53
|
+
"build": "tsc -p tsconfig.build.json",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:watch": "vitest",
|
|
57
|
+
"lint": "eslint .",
|
|
58
|
+
"lint:fix": "eslint . --fix",
|
|
59
|
+
"pack:check": "node scripts/pack-check.mjs",
|
|
60
|
+
"example:echo": "tsx examples/echo-server/src/index.ts"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"jose": "^6.2.13"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@modelcontextprotocol/node": "^2.1.0",
|
|
67
|
+
"@modelcontextprotocol/server": "^2.3.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@modelcontextprotocol/node": {
|
|
71
|
+
"optional": false
|
|
72
|
+
},
|
|
73
|
+
"@modelcontextprotocol/server": {
|
|
74
|
+
"optional": false
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@eslint/js": "^9.39.5",
|
|
79
|
+
"@modelcontextprotocol/client": "^2.3.1",
|
|
80
|
+
"@modelcontextprotocol/node": "^2.1.1",
|
|
81
|
+
"@modelcontextprotocol/server": "^2.3.1",
|
|
82
|
+
"@types/node": "^22.0.0",
|
|
83
|
+
"eslint": "^9.39.2",
|
|
84
|
+
"tsx": "^4.20.0",
|
|
85
|
+
"typescript": "^5.9.3",
|
|
86
|
+
"typescript-eslint": "^8.71.1",
|
|
87
|
+
"vitest": "^3.2.4",
|
|
88
|
+
"zod": "^4.6.7"
|
|
89
|
+
},
|
|
90
|
+
"pnpm": {
|
|
91
|
+
"onlyBuiltDependencies": [
|
|
92
|
+
"esbuild"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"packageManager": "pnpm@10.33.2"
|
|
96
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
#
|
|
3
|
+
# Template Dockerfile for a kieksme MCP server using @kieksme/mcp-http-kit.
|
|
4
|
+
# Copy next to your server package.json and adjust COPY paths / labels.
|
|
5
|
+
#
|
|
6
|
+
# Runtime secrets (never bake into the image):
|
|
7
|
+
# MCP_AUTH_TOKEN — bearer token(s), comma-separated for rotation
|
|
8
|
+
# <SERVICE>_API_KEY — upstream API credentials
|
|
9
|
+
#
|
|
10
|
+
# Railway / containers: PORT is honored by the kit (fallback MCP_HTTP_PORT).
|
|
11
|
+
|
|
12
|
+
ARG NODE_VERSION=22-alpine
|
|
13
|
+
ARG PNPM_VERSION=10.33.2
|
|
14
|
+
|
|
15
|
+
# ---- build ----
|
|
16
|
+
FROM node:${NODE_VERSION} AS build
|
|
17
|
+
ARG PNPM_VERSION
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
RUN npm install -g pnpm@${PNPM_VERSION}
|
|
20
|
+
COPY package.json pnpm-lock.yaml ./
|
|
21
|
+
RUN pnpm install --frozen-lockfile
|
|
22
|
+
COPY tsconfig.json tsconfig.build.json ./
|
|
23
|
+
COPY src ./src
|
|
24
|
+
RUN pnpm build && pnpm prune --prod
|
|
25
|
+
|
|
26
|
+
# ---- runtime ----
|
|
27
|
+
FROM node:${NODE_VERSION} AS runtime
|
|
28
|
+
LABEL org.opencontainers.image.title="REPLACE_WITH_SERVER_NAME" \
|
|
29
|
+
org.opencontainers.image.description="MCP server (Streamable HTTP)" \
|
|
30
|
+
org.opencontainers.image.source="https://github.com/kieksme/REPLACE_WITH_REPO" \
|
|
31
|
+
org.opencontainers.image.licenses="MIT"
|
|
32
|
+
ENV NODE_ENV=production \
|
|
33
|
+
MCP_TRANSPORT=http \
|
|
34
|
+
MCP_HTTP_HOST=0.0.0.0 \
|
|
35
|
+
PORT=3000 \
|
|
36
|
+
MCP_ALLOWED_HOSTS=localhost,127.0.0.1
|
|
37
|
+
WORKDIR /app
|
|
38
|
+
COPY --from=build --chown=node:node /app/package.json ./package.json
|
|
39
|
+
COPY --chown=node:node LICENSE ./LICENSE
|
|
40
|
+
COPY --from=build --chown=node:node /app/dist ./dist
|
|
41
|
+
COPY --from=build --chown=node:node /app/node_modules ./node_modules
|
|
42
|
+
USER node
|
|
43
|
+
EXPOSE 3000
|
|
44
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
45
|
+
CMD node -e "fetch('http://127.0.0.1:'+(process.env.PORT||process.env.MCP_HTTP_PORT||3000)+'/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
|
|
46
|
+
CMD ["node", "dist/index.js"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://railway.com/railway.schema.json",
|
|
3
|
+
"build": {
|
|
4
|
+
"builder": "DOCKERFILE",
|
|
5
|
+
"dockerfilePath": "Dockerfile"
|
|
6
|
+
},
|
|
7
|
+
"deploy": {
|
|
8
|
+
"healthcheckPath": "/health",
|
|
9
|
+
"healthcheckTimeout": 30,
|
|
10
|
+
"restartPolicyType": "ON_FAILURE",
|
|
11
|
+
"restartPolicyMaxRetries": 3
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.kieksme/REPLACE_WITH_SERVER_NAME",
|
|
4
|
+
"title": "REPLACE_WITH_TITLE",
|
|
5
|
+
"description": "REPLACE_WITH_DESCRIPTION",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/kieksme/REPLACE_WITH_REPO",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"websiteUrl": "https://github.com/kieksme/REPLACE_WITH_REPO#readme",
|
|
11
|
+
"version": "0.1.0",
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "npm",
|
|
15
|
+
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
|
+
"identifier": "@kieksme/REPLACE_WITH_NPM_NAME",
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"runtimeHint": "npx",
|
|
19
|
+
"transport": {
|
|
20
|
+
"type": "stdio"
|
|
21
|
+
},
|
|
22
|
+
"environmentVariables": [
|
|
23
|
+
{
|
|
24
|
+
"name": "REPLACE_WITH_UPSTREAM_API_KEY_ENV",
|
|
25
|
+
"description": "Upstream API key for the service this MCP server wraps.",
|
|
26
|
+
"isRequired": true,
|
|
27
|
+
"isSecret": true,
|
|
28
|
+
"format": "string"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"registryType": "oci",
|
|
34
|
+
"identifier": "ghcr.io/kieksme/REPLACE_WITH_REPO",
|
|
35
|
+
"version": "0.1.0",
|
|
36
|
+
"transport": {
|
|
37
|
+
"type": "streamable-http",
|
|
38
|
+
"url": "http://localhost:3000/mcp"
|
|
39
|
+
},
|
|
40
|
+
"environmentVariables": [
|
|
41
|
+
{
|
|
42
|
+
"name": "MCP_AUTH_TOKEN",
|
|
43
|
+
"description": "Bearer token MCP clients must send (Authorization: Bearer …). Comma-separated list allowed for rotation.",
|
|
44
|
+
"isRequired": true,
|
|
45
|
+
"isSecret": true,
|
|
46
|
+
"format": "string"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "REPLACE_WITH_UPSTREAM_API_KEY_ENV",
|
|
50
|
+
"description": "Upstream API key for the service this MCP server wraps.",
|
|
51
|
+
"isRequired": true,
|
|
52
|
+
"isSecret": true,
|
|
53
|
+
"format": "string"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "MCP_ALLOWED_HOSTS",
|
|
57
|
+
"description": "Comma-separated Host allowlist (required when binding beyond localhost).",
|
|
58
|
+
"isRequired": true,
|
|
59
|
+
"isSecret": false,
|
|
60
|
+
"format": "string"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"remotes": [
|
|
66
|
+
{
|
|
67
|
+
"type": "streamable-http",
|
|
68
|
+
"url": "https://REPLACE_WITH_PUBLIC_HOST/mcp",
|
|
69
|
+
"headers": [
|
|
70
|
+
{
|
|
71
|
+
"name": "Authorization",
|
|
72
|
+
"description": "Bearer token (MCP_AUTH_TOKEN). Format: Bearer <token>",
|
|
73
|
+
"isRequired": true,
|
|
74
|
+
"isSecret": true
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Smithery project config — https://smithery.ai/docs/build/project-config
|
|
2
|
+
#
|
|
3
|
+
# Container runtime: Smithery builds the Dockerfile and connects over
|
|
4
|
+
# Streamable HTTP. The kit honors PORT (Smithery sets it) and serves MCP at
|
|
5
|
+
# /mcp by default. Copy to the server repo root and fill configSchema.
|
|
6
|
+
|
|
7
|
+
runtime: container
|
|
8
|
+
|
|
9
|
+
build:
|
|
10
|
+
dockerfile: Dockerfile
|
|
11
|
+
dockerBuildPath: .
|
|
12
|
+
|
|
13
|
+
startCommand:
|
|
14
|
+
type: http
|
|
15
|
+
configSchema:
|
|
16
|
+
type: object
|
|
17
|
+
properties:
|
|
18
|
+
mcpAuthToken:
|
|
19
|
+
type: string
|
|
20
|
+
title: MCP bearer token
|
|
21
|
+
description: Value for MCP_AUTH_TOKEN (clients send Authorization: Bearer …).
|
|
22
|
+
upstreamApiKey:
|
|
23
|
+
type: string
|
|
24
|
+
title: Upstream API key
|
|
25
|
+
description: Service API key mapped to your server's env var.
|
|
26
|
+
required:
|
|
27
|
+
- mcpAuthToken
|
|
28
|
+
- upstreamApiKey
|
|
29
|
+
exampleConfig:
|
|
30
|
+
mcpAuthToken: "replace-me"
|
|
31
|
+
upstreamApiKey: "replace-me"
|