@emseepea/create-api-backed-server 0.0.20 → 0.0.23
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/README.md +18 -0
- package/initializer-dist/template/.dockerignore +17 -0
- package/initializer-dist/template/Dockerfile +19 -0
- package/initializer-dist/template/README.md +18 -0
- package/initializer-dist/template/package.json +5 -4
- package/initializer-dist/template/src/server.ts +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -80,6 +80,24 @@ npm start
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
The endpoint is `http://127.0.0.1:3000/mcp`.
|
|
83
|
+
`PEA_API_ORIGIN` can select an operator-controlled compatible endpoint; when it
|
|
84
|
+
is unset, the server uses iNaturalist.
|
|
85
|
+
|
|
86
|
+
## Build a production container
|
|
87
|
+
|
|
88
|
+
Run `npm install` first so the project has a lockfile. Then run:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
npm run container:build
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The image is for a production deployment behind a trusted proxy. It starts with
|
|
95
|
+
the fail-closed production profile and needs a runtime-mounted deployment
|
|
96
|
+
configuration file. Keep secrets in your platform's runtime secret store, not in
|
|
97
|
+
the Dockerfile, build arguments, or deployment configuration file.
|
|
98
|
+
|
|
99
|
+
For the production proxy, runtime configuration, and hardening requirements, see
|
|
100
|
+
the [container guide](https://emseepea.github.io/emseepea/examples/#build-a-production-container).
|
|
83
101
|
|
|
84
102
|
## Add Feedback
|
|
85
103
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
FROM docker.io/library/node:24.21.0-trixie-slim@sha256:db3ae80f5d8df06e04dabdf7b44cbf008d32de168205fa0294444aabbc08c590 AS build
|
|
2
|
+
WORKDIR /app
|
|
3
|
+
COPY . .
|
|
4
|
+
RUN test "$(node --version)" = "v24.21.0" \
|
|
5
|
+
&& test -f package-lock.json \
|
|
6
|
+
&& npm ci --ignore-scripts \
|
|
7
|
+
&& npm run build \
|
|
8
|
+
&& npm prune --omit=dev --ignore-scripts
|
|
9
|
+
|
|
10
|
+
FROM gcr.io/distroless/nodejs24-debian13:nonroot@sha256:7781e8b4fccf59240bd539af6738cccf8dad4be303165c3a1fa065c48699b937
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
ENV EMSEEPEA_DEPLOYMENT_MODE=production-behind-proxy
|
|
13
|
+
COPY --from=build --chown=65532:65532 /app/package.json ./package.json
|
|
14
|
+
COPY --from=build --chown=65532:65532 /app/node_modules ./node_modules
|
|
15
|
+
COPY --from=build --chown=65532:65532 /app/dist ./dist
|
|
16
|
+
USER 65532:65532
|
|
17
|
+
EXPOSE 3000
|
|
18
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD ["/nodejs/bin/node", "-e", "const port=process.env.PORT||'3000';fetch(`http://127.0.0.1:${port}/healthz`).then((r)=>process.exit(r.ok?0:1),()=>process.exit(1));"]
|
|
19
|
+
CMD ["dist/server.js"]
|
|
@@ -61,6 +61,24 @@ npm start
|
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
The endpoint is `http://127.0.0.1:3000/mcp`.
|
|
64
|
+
`PEA_API_ORIGIN` can select an operator-controlled compatible endpoint; when it
|
|
65
|
+
is unset, the server uses iNaturalist.
|
|
66
|
+
|
|
67
|
+
## Build a production container
|
|
68
|
+
|
|
69
|
+
Run `npm install` first so the project has a lockfile. Then run:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
npm run container:build
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The image is for a production deployment behind a trusted proxy. It starts with
|
|
76
|
+
the fail-closed production profile and needs a runtime-mounted deployment
|
|
77
|
+
configuration file. Keep secrets in your platform's runtime secret store, not in
|
|
78
|
+
the Dockerfile, build arguments, or deployment configuration file.
|
|
79
|
+
|
|
80
|
+
For the production proxy, runtime configuration, and hardening requirements, see
|
|
81
|
+
the [container guide](https://emseepea.github.io/emseepea/examples/#build-a-production-container).
|
|
64
82
|
|
|
65
83
|
## Add Feedback
|
|
66
84
|
|
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
"test:built": "node --test test/*.test.mjs",
|
|
12
12
|
"test:llm": "npm run build && npm run test:llm:built",
|
|
13
13
|
"test:llm:built": "emseepea-test eval",
|
|
14
|
-
"lint": "oxlint src test eval test-support"
|
|
14
|
+
"lint": "oxlint src test eval test-support",
|
|
15
|
+
"container:build": "docker build --tag emseepea-server:local ."
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@emseepea/feedback": "0.2.
|
|
18
|
-
"@emseepea/testing": "0.9.
|
|
18
|
+
"@emseepea/feedback": "0.2.6",
|
|
19
|
+
"@emseepea/testing": "0.9.9",
|
|
19
20
|
"@modelcontextprotocol/client": "2.0.0",
|
|
20
21
|
"@types/node": "24.13.3",
|
|
21
22
|
"typescript": "6.0.3",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
},
|
|
27
28
|
"private": true,
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@emseepea/server": "0.
|
|
30
|
+
"@emseepea/server": "0.10.0",
|
|
30
31
|
"zod": "4.4.3"
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { serveEmseepea } from "@emseepea/server";
|
|
1
|
+
import { loadDeploymentProfile, serveEmseepea } from "@emseepea/server";
|
|
2
2
|
import { createJsonHttpClient } from "@emseepea/server/http";
|
|
3
3
|
import { createBackendExample } from "./app.js";
|
|
4
4
|
|
|
5
5
|
const client = createJsonHttpClient({
|
|
6
|
-
origin: "https://api.inaturalist.org",
|
|
6
|
+
origin: process.env.PEA_API_ORIGIN ?? "https://api.inaturalist.org",
|
|
7
7
|
maxResponseBytes: 128 * 1024,
|
|
8
8
|
});
|
|
9
9
|
const running = await serveEmseepea(
|
|
10
|
-
await createBackendExample(client),
|
|
10
|
+
await createBackendExample(client, { deployment: loadDeploymentProfile() }),
|
|
11
11
|
{ port: Number.parseInt(process.env.PORT ?? "3000", 10) },
|
|
12
12
|
);
|
|
13
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emseepea/create-api-backed-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Create an Em See Pea server backed by a public web API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"prepack": "npm run build:initializer"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@emseepea/feedback": "0.2.
|
|
22
|
-
"@emseepea/server": "0.
|
|
21
|
+
"@emseepea/feedback": "0.2.6",
|
|
22
|
+
"@emseepea/server": "0.10.0",
|
|
23
23
|
"zod": "4.4.3",
|
|
24
|
-
"@emseepea/testing": "0.9.
|
|
24
|
+
"@emseepea/testing": "0.9.9",
|
|
25
25
|
"@modelcontextprotocol/client": "2.0.0",
|
|
26
26
|
"@types/node": "24.13.3",
|
|
27
27
|
"typescript": "6.0.3",
|