@20baht/elysia-openapi-mcp 0.0.0-stage → 0.2.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/CHANGELOG.md +154 -0
- package/README.md +628 -2
- package/dist/auth/access.d.ts +13 -0
- package/dist/auth/access.d.ts.map +1 -0
- package/dist/auth/authenticate.d.ts +24 -0
- package/dist/auth/authenticate.d.ts.map +1 -0
- package/dist/auth/bearer.d.ts +3 -0
- package/dist/auth/bearer.d.ts.map +1 -0
- package/dist/auth/prm.d.ts +4 -0
- package/dist/auth/prm.d.ts.map +1 -0
- package/dist/auth/resolve.d.ts +110 -0
- package/dist/auth/resolve.d.ts.map +1 -0
- package/dist/auth/resource.d.ts +2 -0
- package/dist/auth/resource.d.ts.map +1 -0
- package/dist/auth/verify.d.ts +3 -0
- package/dist/auth/verify.d.ts.map +1 -0
- package/dist/execute.d.ts +43 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1404 -0
- package/dist/index.js.map +24 -0
- package/dist/openapi/derive.d.ts +61 -0
- package/dist/openapi/derive.d.ts.map +1 -0
- package/dist/openapi/naming.d.ts +21 -0
- package/dist/openapi/naming.d.ts.map +1 -0
- package/dist/openapi/schema.d.ts +83 -0
- package/dist/openapi/schema.d.ts.map +1 -0
- package/dist/openapi/types.d.ts +79 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/plugin.d.ts +143 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/transport.d.ts +32 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/warnings.d.ts +14 -0
- package/dist/warnings.d.ts.map +1 -0
- package/package.json +64 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this package are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This package uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/); before 1.0, a minor bump may break.
|
|
6
|
+
|
|
7
|
+
## 0.2.0
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- The token verifier and the RFC 6750 / 8707 / 9728 helpers moved to the new `@20baht/elysia-resource-server`,
|
|
12
|
+
which this package now depends on (instead of `jose` directly) and re-exports: `createJwksVerifier`,
|
|
13
|
+
`verifyWithOAuthProvider`, `metadataCandidates`, `bearerChallenge`, `extractBearer`, `audienceMatches`,
|
|
14
|
+
`normalizeResource`, `resourcesEqual`, `validateResourceUri` and their types are the same functions under the
|
|
15
|
+
same names. `authenticate` runs the shared `checkBearer`; every status, header and message is unchanged. Two
|
|
16
|
+
error messages thrown at configuration time now begin `[resource-server]` instead of `[mcpify]` (a resource
|
|
17
|
+
that is not an absolute http(s) URI, and a `jwks_uri` that cannot be discovered).
|
|
18
|
+
|
|
19
|
+
## 0.1.0
|
|
20
|
+
|
|
21
|
+
First release as `@20baht/elysia-openapi-mcp`, the same code as `elysia-openapi-mcp` 0.4.0 (the last version under the old name, which gets deprecated in favour of this one). Every 20baht library moved into one repo ([bank20baht/20baht](https://github.com/bank20baht/20baht)) and the `@20baht` npm scope, and restarted at 0.1.0. Change the dependency and the imports from `elysia-openapi-mcp` to `@20baht/elysia-openapi-mcp`; nothing else changes.
|
|
22
|
+
|
|
23
|
+
## 0.4.0
|
|
24
|
+
|
|
25
|
+
### Breaking
|
|
26
|
+
|
|
27
|
+
- **CORS is off by default in request mode.** With `auth: { verify }`, `cors`
|
|
28
|
+
now defaults to `false`: no `Access-Control-*` headers, so a page on another
|
|
29
|
+
origin cannot read answers (or get its preflight approved). Before, any
|
|
30
|
+
`Origin` was reflected, which next to a cookie-trusting `verify` and an
|
|
31
|
+
app-wide `allow-credentials` let any site call the tools from a signed-in
|
|
32
|
+
browser. To keep browser access, list your front ends:
|
|
33
|
+
`cors: { origins: ['https://app.example'] }`. `cors: true` still reflects
|
|
34
|
+
every origin, and now warns in request mode (`cors-reflects-origin`). OAuth
|
|
35
|
+
mode and `unsafeNoAuth` keep the `true` default.
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- `cors: { origins: string[] | (origin) => boolean }`: CORS for listed origins
|
|
40
|
+
only. Any other origin gets no `Access-Control-Allow-Origin`, just
|
|
41
|
+
`Vary: Origin`. `McpifyCorsOption` type export.
|
|
42
|
+
- **Request-mode results.** `auth.verify` may return, besides a boolean:
|
|
43
|
+
- a refusal `{ status, code?, message }`, answered as that JSON-RPC error
|
|
44
|
+
with that HTTP status (`code` defaults to `-32001`);
|
|
45
|
+
- an admission `{ scopes?, tools?, readOnly? }`, which filters `tools/list`
|
|
46
|
+
and `tools/call` for that request. `scopes` checks each tool's
|
|
47
|
+
`detail.mcp.scopes` as OAuth mode does, `readOnly: true` keeps the
|
|
48
|
+
`readOnlyHint` tools, `tools` is a predicate. A tool left out answers
|
|
49
|
+
`Tool <name> not found`, like a name that does not exist.
|
|
50
|
+
- Malformed results fail closed (`401`) with a `verify-error` warning.
|
|
51
|
+
- `RequestAuthResult`, `RequestAuthRefusal` and `RequestAuthAdmission` type
|
|
52
|
+
exports.
|
|
53
|
+
- `onToolCall({ tool, args, request, response, durationMs })`: awaited after
|
|
54
|
+
each tool call that reached the app, with a copy of the response. A throw is
|
|
55
|
+
reported as `on-tool-call-error` and does not fail the call. `OnToolCall`
|
|
56
|
+
and `ToolCallEvent` type exports.
|
|
57
|
+
- `isToolCall(request)`: `true` for the synthetic request a tool call runs
|
|
58
|
+
through the app, in every hook and handler. Backed by a module `WeakSet`, so
|
|
59
|
+
there is no header to forge or strip.
|
|
60
|
+
- `detail.mcp.output`: a JSON Schema (TypeBox works) used as the tool's
|
|
61
|
+
`outputSchema` in place of the one derived from `response`. Elysia does not
|
|
62
|
+
enforce it.
|
|
63
|
+
- New warning kinds `cors-reflects-origin` and `on-tool-call-error`.
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
|
|
67
|
+
- **Guarded OpenAPI route.** When `specPath` exists but does not serve the
|
|
68
|
+
document to a caller without credentials, the document is built in-process
|
|
69
|
+
with `toOpenAPISchema(app)` instead of answering every MCP request with a
|
|
70
|
+
`500`. That build lacks the `openapi()` plugin's own options. The served
|
|
71
|
+
document is still read first. `@elysiajs/openapi` is now an optional peer
|
|
72
|
+
dependency, loaded with a dynamic `import()` for this fallback only.
|
|
73
|
+
- `initialize` reports the document's `info.title` / `info.version` when
|
|
74
|
+
`name` / `version` are not set. `@elysiajs/openapi`'s placeholder
|
|
75
|
+
(`Elysia Documentation`, `0.0.0`) is ignored, leaving the old defaults.
|
|
76
|
+
- A property without a description that is an `anyOf` / `oneOf` with one
|
|
77
|
+
non-null member takes that member's description
|
|
78
|
+
(`t.Optional(t.Nullable(t.Integer({ description })))`), so it no longer
|
|
79
|
+
warns `argument-description`.
|
|
80
|
+
- The default `warn` sink (`console.warn`) prints each distinct message once
|
|
81
|
+
per process, across `mcpify()` instances. A custom `warn` still gets every
|
|
82
|
+
warning of its instance.
|
|
83
|
+
- In request mode `scopes-not-enforced` fires when a request is admitted
|
|
84
|
+
without `{ scopes }`, not at startup. With `unsafeNoAuth` it is unchanged.
|
|
85
|
+
- `verify-error` also covers malformed `verify` results and a throwing
|
|
86
|
+
admission `tools` predicate (that tool is hidden).
|
|
87
|
+
|
|
88
|
+
## 0.3.1
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
|
|
92
|
+
- **Request-mode auth:** `auth: { verify(request) => boolean | Promise<boolean> }`
|
|
93
|
+
for apps guarded by an API key or a session cookie. It counts as `auth` for
|
|
94
|
+
the 0.3.0 auth-or-`unsafeNoAuth` rule. It gates the whole endpoint
|
|
95
|
+
(`initialize` and `tools/list` included); only a literal `true` admits, and
|
|
96
|
+
a throw rejects. A rejection is a `401` JSON-RPC error with
|
|
97
|
+
`Cache-Control: no-store` and no `WWW-Authenticate` challenge, so clients are
|
|
98
|
+
not sent into an OAuth flow that cannot succeed. No PRM document is served.
|
|
99
|
+
OAuth mode (`resource` + `authorizationServers`) is unchanged; OAuth-only
|
|
100
|
+
keys without `resource` throw at setup.
|
|
101
|
+
- **Warning kinds:** every warning has a kind (`MCPIFY_WARNING_KINDS`), passed
|
|
102
|
+
as the second argument to `warn(message, kind)`. `warnings: { kind: false }`
|
|
103
|
+
silences one kind, e.g. `{ unauthenticated: false }` for the `unsafeNoAuth`
|
|
104
|
+
banner or `{ 'path-param-description': false }` for undocumented path
|
|
105
|
+
parameters. Unknown kinds throw.
|
|
106
|
+
- `deriveTools()` and `flattenOperation()` return
|
|
107
|
+
`diagnostics: { kind, message }[]` next to `warnings`.
|
|
108
|
+
- `McpifyRequestAuthOptions`, `McpifyWarning` and `McpifyWarningKind` type
|
|
109
|
+
exports.
|
|
110
|
+
|
|
111
|
+
### Changed
|
|
112
|
+
|
|
113
|
+
- Missing descriptions on path parameters are reported apart from other
|
|
114
|
+
arguments (`path-param-description` vs `argument-description`), so a tool can
|
|
115
|
+
log two lines where it logged one.
|
|
116
|
+
- The `unsafeNoAuth` banner names `auth: { verify }` and how to silence it.
|
|
117
|
+
- `McpifyAuthMode['auth']` is now `McpifyAuthOptions | McpifyRequestAuthOptions`;
|
|
118
|
+
code typing OAuth options as `Partial<McpifyOptions['auth']>` should use
|
|
119
|
+
`Partial<McpifyAuthOptions>`.
|
|
120
|
+
|
|
121
|
+
## 0.3.0 (unreleased)
|
|
122
|
+
|
|
123
|
+
### Breaking
|
|
124
|
+
|
|
125
|
+
- `mcpify()` throws at setup unless it gets exactly one of `auth` or
|
|
126
|
+
`unsafeNoAuth: true`. Before, omitting `auth` mounted an open endpoint and
|
|
127
|
+
only printed a warning. To keep an unauthenticated development setup, pass
|
|
128
|
+
`unsafeNoAuth: true`. The options type enforces the same rule.
|
|
129
|
+
- The default JWKS verifier requires the `typ: at+jwt` JOSE header
|
|
130
|
+
(RFC 9068 §4). `application/at+jwt` also matches. Tokens without it are
|
|
131
|
+
rejected with `401 invalid_token`. Set `auth.jwks.typ` to require another
|
|
132
|
+
value, or `false` to skip the check.
|
|
133
|
+
- The `elysia` peer range is `^1.4.0` (was `>=1.4.0`, which also accepted 2.x).
|
|
134
|
+
|
|
135
|
+
### Added
|
|
136
|
+
|
|
137
|
+
- `auth.requireToolScopes`: expose only tools that declare `detail.mcp.scopes`
|
|
138
|
+
or `detail.mcp: { public: true }`. Other tools are left out, with a warning.
|
|
139
|
+
Default `false`.
|
|
140
|
+
- `McpifyBaseOptions` and `McpifyAuthMode` type exports.
|
|
141
|
+
|
|
142
|
+
### Documentation
|
|
143
|
+
|
|
144
|
+
- The README warns that with the default `allRoutes: true`, a tool without
|
|
145
|
+
`detail.mcp.scopes` is callable by any token issued for the resource.
|
|
146
|
+
|
|
147
|
+
## 0.2.0
|
|
148
|
+
|
|
149
|
+
- Serve protocol `2026-07-28` through SDK v2, add per-tool scopes and
|
|
150
|
+
anonymous access.
|
|
151
|
+
|
|
152
|
+
## 0.1.0
|
|
153
|
+
|
|
154
|
+
- Harden tool execution and derivation. First release.
|