frontmcp 0.3.1 → 0.4.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.
Files changed (45) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +448 -0
  3. package/package.json +4 -4
  4. package/src/args.d.ts +8 -0
  5. package/src/args.js +19 -0
  6. package/src/args.js.map +1 -0
  7. package/src/cli.d.ts +0 -1
  8. package/src/cli.js +30 -574
  9. package/src/cli.js.map +1 -1
  10. package/src/colors.d.ts +12 -0
  11. package/src/colors.js +17 -0
  12. package/src/colors.js.map +1 -0
  13. package/src/commands/build.d.ts +2 -0
  14. package/src/commands/build.js +43 -0
  15. package/src/commands/build.js.map +1 -0
  16. package/src/commands/create.d.ts +1 -0
  17. package/src/commands/create.js +204 -0
  18. package/src/commands/create.js.map +1 -0
  19. package/src/commands/dev.d.ts +2 -0
  20. package/src/commands/dev.js +49 -0
  21. package/src/commands/dev.js.map +1 -0
  22. package/src/commands/doctor.d.ts +1 -0
  23. package/src/commands/doctor.js +87 -0
  24. package/src/commands/doctor.js.map +1 -0
  25. package/src/commands/inspector.d.ts +1 -0
  26. package/src/commands/inspector.js +10 -0
  27. package/src/commands/inspector.js.map +1 -0
  28. package/src/commands/template.d.ts +13 -0
  29. package/src/commands/template.js +179 -0
  30. package/src/commands/template.js.map +1 -0
  31. package/src/templates/3rd-party-integration/src/http-client.d.ts +20 -0
  32. package/src/templates/3rd-party-integration/src/http-client.js +101 -0
  33. package/src/templates/3rd-party-integration/src/http-client.js.map +1 -0
  34. package/src/templates/3rd-party-integration/src/mcp-http-types.d.ts +199 -0
  35. package/src/templates/3rd-party-integration/src/mcp-http-types.js +51 -0
  36. package/src/templates/3rd-party-integration/src/mcp-http-types.js.map +1 -0
  37. package/src/templates/3rd-party-integration/src/tools/example.list.d.ts +125 -0
  38. package/src/templates/3rd-party-integration/src/tools/example.list.js +85 -0
  39. package/src/templates/3rd-party-integration/src/tools/example.list.js.map +1 -0
  40. package/src/tsconfig.d.ts +34 -0
  41. package/src/tsconfig.js +103 -0
  42. package/src/tsconfig.js.map +1 -0
  43. package/src/utils/fs.d.ts +11 -0
  44. package/src/utils/fs.js +104 -0
  45. package/src/utils/fs.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,448 @@
1
+ <div align="center">
2
+
3
+ <picture>
4
+ <source width="400" media="(prefers-color-scheme: dark)" srcset="docs/assets/logo/frontmcp.dark.svg">
5
+ <source width="400" media="(prefers-color-scheme: light)" srcset="docs/assets/logo/frontmcp.light.svg">
6
+ <img width="400" alt="FrontMCP Logo" src="docs/assets/logo/frontmcp.light.svg">
7
+ </picture>
8
+ <hr>
9
+
10
+ <strong>The TypeScript way to build MCP servers with decorators, DI, and Streamable HTTP.</strong>
11
+
12
+ _Made with ❤️ for TypeScript developers_
13
+
14
+ [![NPM - @frontmcp/sdk](https://img.shields.io/npm/v/@frontmcp/sdk.svg?v=2)](https://www.npmjs.com/package/@frontmcp/sdk)
15
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-339933?logo=node.js&logoColor=white)](https://nodejs.org)
16
+ [![License](https://img.shields.io/github/license/agentfront/frontmcp.svg?v=1)](https://github.com/agentfront/frontmcp/blob/main/LICENSE)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ FrontMCP is a **TypeScript-first framework** for the [Model Context Protocol (MCP)](https://modelcontextprotocol.io).
23
+ You write clean, typed code; FrontMCP handles the protocol, transport, DI, session/auth, and execution flow.
24
+
25
+ ```ts
26
+ // src/main.ts
27
+ import 'reflect-metadata';
28
+ import { FrontMcp, LogLevel } from '@frontmcp/sdk';
29
+ import HelloApp from './hello.app';
30
+
31
+ @FrontMcp({
32
+ info: { name: 'Demo 🚀', version: '0.1.0' },
33
+ apps: [HelloApp],
34
+ http: { port: 3000 },
35
+ logging: { level: LogLevel.Info },
36
+ })
37
+ export default class Server {}
38
+ ```
39
+
40
+ ---
41
+
42
+ <!-- omit in toc -->
43
+
44
+ ## Table of Contents
45
+
46
+ - [Why FrontMCP?](#why-frontmcp)
47
+ - [Installation](#installation)
48
+ - [Quickstart](#quickstart)
49
+ - [1) Create Your FrontMCP Server](#1-create-your-frontmcp-server)
50
+ - [2) Define an App](#2-define-an-app)
51
+ - [3) Add Your First Tool](#3-add-your-first-tool)
52
+ - [4) Run It](#4-run-it)
53
+ - [Function and Class Tools](#function-and-class-tools)
54
+ - [Scripts & tsconfig](#scripts--tsconfig)
55
+ - [Inspector](#inspector)
56
+ - [Core Concepts](#core-concepts)
57
+ - [Servers](#servers)
58
+ - [Apps](#apps)
59
+ - [Tools](#tools)
60
+ - [Resources](#resources)
61
+ - [Prompts](#prompts)
62
+ - [Providers / Adapters / Plugins](#providers--adapters--plugins)
63
+ - [Authentication](#authentication)
64
+ - [Remote OAuth](#remote-oauth)
65
+ - [Local OAuth](#local-oauth)
66
+ - [Sessions & Transport](#sessions--transport)
67
+ - [Deployment](#deployment)
68
+ - [Local Dev](#local-dev)
69
+ - [Production](#production)
70
+ - [Version Alignment](#version-alignment)
71
+ - [Contributing](#contributing)
72
+ - [License](#license)
73
+
74
+ ---
75
+
76
+ ## Why FrontMCP?
77
+
78
+ - **TypeScript-native DX** — decorators, Zod, and strong typing end-to-end
79
+ - **Scoped invoker + DI** — secure, composable execution with hooks
80
+ - **Adapters & Plugins** — extend your server without boilerplate
81
+ - **Spec-aligned transport** — Streamable HTTP for modern MCP clients
82
+
83
+ ---
84
+
85
+ ## Installation
86
+
87
+ **Prereqs:** Node.js ≥ 22, npm ≥ 10. ([Installation - FrontMCP][1])
88
+
89
+ ### Option A — New project (recommended)
90
+
91
+ ```bash
92
+ npx frontmcp create my-app
93
+ ```
94
+
95
+ This scaffolds a FrontMCP project, writes a modern ESM `tsconfig.json` for decorators, adds helpful package scripts, and
96
+ installs required dev deps. ([Installation - FrontMCP][1])
97
+
98
+ ### Option B — Add to an existing project
99
+
100
+ ```bash
101
+ npm i -D frontmcp @types/node@^20
102
+ npx frontmcp init
103
+ ```
104
+
105
+ `init` adds scripts, verifies your `tsconfig.json`, and checks layout. No need to install `@frontmcp/sdk` directly—the
106
+ CLI bundles a compatible SDK for you. ([Installation - FrontMCP][1])
107
+
108
+ ---
109
+
110
+ ## Quickstart
111
+
112
+ If you haven’t installed FrontMCP yet, follow the [installation guide][1] first.
113
+
114
+ ### 1) Create Your FrontMCP Server
115
+
116
+ ```ts
117
+ // src/main.ts
118
+ import { FrontMcp, LogLevel } from '@frontmcp/sdk';
119
+ import HelloApp from './hello.app';
120
+
121
+ @FrontMcp({
122
+ info: { name: 'Hello MCP', version: '0.1.0' },
123
+ apps: [HelloApp],
124
+ http: { port: 3000 },
125
+ logging: { level: LogLevel.INFO },
126
+ })
127
+ export default class HelloServer {}
128
+ ```
129
+
130
+ ### 2) Define an App
131
+
132
+ ```ts
133
+ // src/hello.app.ts
134
+ import { App } from '@frontmcp/sdk';
135
+ import GreetTool from './tools/greet.tool';
136
+
137
+ @App({
138
+ id: 'hello',
139
+ name: 'Hello App',
140
+ tools: [GreetTool],
141
+ })
142
+ export default class HelloApp {}
143
+ ```
144
+
145
+ ### 3) Add Your First Tool
146
+
147
+ ```ts
148
+ // src/tools/greet.tool.ts
149
+ import { Tool } from '@frontmcp/sdk';
150
+ import { z } from 'zod';
151
+
152
+ @Tool({
153
+ name: 'greet',
154
+ description: 'Greets a user by name',
155
+ inputSchema: { name: z.string() },
156
+ })
157
+ export default class GreetTool {
158
+ async execute({ name }: { name: string }) {
159
+ return `Hello, ${name}!`;
160
+ }
161
+ }
162
+ ```
163
+
164
+ ### 4) Run It
165
+
166
+ Add scripts (if you didn't use `frontmcp create`):
167
+
168
+ ```json
169
+ {
170
+ "scripts": {
171
+ "dev": "frontmcp dev",
172
+ "build": "frontmcp build",
173
+ "start": "node dist/main.js"
174
+ }
175
+ }
176
+ ```
177
+
178
+ Then:
179
+
180
+ ```bash
181
+ npm run dev
182
+ # Server listening on http://localhost:3000
183
+ ```
184
+
185
+ > **Tip:** FrontMCP speaks **MCP Streamable HTTP**. Connect any MCP-capable client and call `greet` with
186
+ > `{"name": "Ada"}`. ([Quickstart - FrontMCP][2])
187
+
188
+ ### Function and Class Tools
189
+
190
+ Tools are typed actions with Zod schemas. Implement them as classes with `@Tool({...})` or inline via `tool()`. Pass
191
+ **Zod fields directly** (no `z.object({...})`). ([Tools - FrontMCP][4])
192
+
193
+ **Function tool**
194
+
195
+ ```ts
196
+ import { tool } from '@frontmcp/sdk';
197
+ import { z } from 'zod';
198
+
199
+ export default tool({
200
+ name: 'greet',
201
+ description: 'Greets a user by name',
202
+ inputSchema: { name: z.string() }, // shape, not z.object
203
+ })(({ name }) => `Hello, ${name}!`);
204
+ ```
205
+
206
+ **Class tool**
207
+
208
+ ```ts
209
+ import { Tool } from '@frontmcp/sdk';
210
+ import { z } from 'zod';
211
+
212
+ @Tool({
213
+ name: 'add',
214
+ description: 'Add two numbers',
215
+ inputSchema: { a: z.number(), b: z.number() },
216
+ })
217
+ export default class AddTool {
218
+ async execute({ a, b }: { a: number; b: number }) {
219
+ return a + b;
220
+ }
221
+ }
222
+ ```
223
+
224
+ ### Scripts & tsconfig
225
+
226
+ After `create` or `init`, you’ll have:
227
+
228
+ ```json
229
+ {
230
+ "scripts": {
231
+ "dev": "frontmcp dev",
232
+ "build": "frontmcp build",
233
+ "inspect": "frontmcp inspector",
234
+ "doctor": "frontmcp doctor"
235
+ }
236
+ }
237
+ ```
238
+
239
+ These map to dev watch, production build, zero‑setup Inspector launch, and environment checks. ([Installation -
240
+ FrontMCP][1])
241
+
242
+ **Recommended `tsconfig.json` (ESM + decorators)**
243
+
244
+ ```json
245
+ {
246
+ "compilerOptions": {
247
+ "target": "es2021",
248
+ "module": "esnext",
249
+ "lib": ["es2021"],
250
+ "moduleResolution": "bundler",
251
+ "rootDir": "src",
252
+ "outDir": "dist",
253
+ "strict": true,
254
+ "esModuleInterop": true,
255
+ "resolveJsonModule": true,
256
+ "skipLibCheck": true,
257
+ "experimentalDecorators": true,
258
+ "emitDecoratorMetadata": true,
259
+ "sourceMap": true
260
+ },
261
+ "include": ["src/**/*.ts"],
262
+ "exclude": ["**/*.test.ts", "**/__tests__/**"]
263
+ }
264
+ ```
265
+
266
+ This mirrors what `init` writes for you. ([Local Dev Server - FrontMCP][3])
267
+
268
+ **Optional `tsconfig.build.json`**
269
+
270
+ ```json
271
+ {
272
+ "extends": "./tsconfig.json",
273
+ "compilerOptions": {
274
+ "declaration": true,
275
+ "sourceMap": false
276
+ },
277
+ "exclude": ["**/*.test.ts", "**/__tests__/**", "src/**/*.dev.ts"]
278
+ }
279
+ ```
280
+
281
+ ### Inspector
282
+
283
+ Run a browser UI to exercise tools and messages:
284
+
285
+ ```bash
286
+ npm run inspect
287
+ ```
288
+
289
+ This launches the MCP Inspector; point it at your local server (e.g., `http://localhost:3000`). ([Local Dev Server -
290
+ FrontMCP][3])
291
+
292
+ ---
293
+
294
+ ## Core Concepts
295
+
296
+ ### Servers
297
+
298
+ `@FrontMcp({...})` defines **info**, **apps**, **http**, **logging**, **session**, and optional **auth**. Keep it
299
+ minimal or scale up with providers and plugins. ([The FrontMCP Server - FrontMCP][5])
300
+
301
+ ### Apps
302
+
303
+ Use `@App` to group **tools**, **resources**, **prompts**, plus **providers**, **adapters**, and **plugins**. With
304
+ `splitByApp: true`, each app gets its own scope/base path and, if needed, its own auth surface. ([Apps - FrontMCP][6])
305
+
306
+ ### Tools
307
+
308
+ Typed actions with schemas (class `@Tool` or inline `tool({...})(handler)`). Use the Zod‑field **shape** style for
309
+ `inputSchema`. ([Tools - FrontMCP][4])
310
+
311
+ ### Resources
312
+
313
+ Readable data by URI or RFC6570 template (see `@Resource` / `@ResourceTemplate`). ([Resources - FrontMCP][7])
314
+
315
+ ### Prompts
316
+
317
+ Reusable templates returning MCP `GetPromptResult`, with typed arguments. ([Prompts - FrontMCP][8])
318
+
319
+ ### Providers / Adapters / Plugins
320
+
321
+ Inject shared services, generate tools from OpenAPI, and add cross‑cutting behavior like caching and hooks. ([Add
322
+ OpenAPI Adapter - FrontMCP][9])
323
+
324
+ ---
325
+
326
+ ## Authentication
327
+
328
+ Configure auth at the **server** (shared) or **per app** (isolated). With `splitByApp: true`, define auth **per app**
329
+ (server‑level `auth` is disallowed). ([Authentication - FrontMCP][10])
330
+
331
+ ### Remote OAuth
332
+
333
+ ```ts
334
+ auth: {
335
+ type: 'remote',
336
+ name: 'frontegg',
337
+ baseUrl: 'https://idp.example.com',
338
+ dcrEnabled?: boolean,
339
+ clientId?: string | ((info: { clientId: string }) => string),
340
+ mode?: 'orchestrated' | 'transparent',
341
+ allowAnonymous?: boolean,
342
+ consent?: boolean,
343
+ scopes?: string[],
344
+ grantTypes?: ('authorization_code' | 'refresh_token')[],
345
+ authEndpoint?: string,
346
+ tokenEndpoint?: string,
347
+ registrationEndpoint?: string,
348
+ userInfoEndpoint?: string,
349
+ jwks?: JSONWebKeySet,
350
+ jwksUri?: string
351
+ }
352
+ ```
353
+
354
+ See **Authentication → Remote OAuth** for full details and DCR vs non‑DCR. ([Remote OAuth - FrontMCP][11])
355
+
356
+ ### Local OAuth
357
+
358
+ ```ts
359
+ auth: {
360
+ type: 'local',
361
+ id: 'local',
362
+ name: 'Local Auth',
363
+ scopes?: string[],
364
+ grantTypes?: ('authorization_code' | 'refresh_token')[],
365
+ allowAnonymous?: boolean, // default true
366
+ consent?: boolean,
367
+ jwks?: JSONWebKeySet,
368
+ signKey?: JWK | Uint8Array
369
+ }
370
+ ```
371
+
372
+ Use per‑app when isolating scopes. ([Local OAuth - FrontMCP][12])
373
+
374
+ ---
375
+
376
+ ## Sessions & Transport
377
+
378
+ ```ts
379
+ session: {
380
+ sessionMode?: 'stateful' | 'stateless' | ((issuer) => ...), // default 'stateless'
381
+ transportIdMode?: 'uuid' | 'jwt' | ((issuer) => ...), // default 'uuid'
382
+ }
383
+ ```
384
+
385
+ - **Stateful**: server‑side store (e.g., Redis); supports refresh; best for short‑lived upstream tokens.
386
+ - **Stateless**: embeds session in JWT; simpler but no silent refresh.
387
+ - **Transport IDs**: `uuid` (per node) or `jwt` (signed; distributed setups). ([The FrontMCP Server - FrontMCP][5])
388
+
389
+ ---
390
+
391
+ ## Deployment
392
+
393
+ ### Local Dev
394
+
395
+ ```bash
396
+ npm run dev
397
+ ```
398
+
399
+ - Default HTTP port: `3000` unless configured
400
+ - `npm run doctor` checks Node/npm versions, `tsconfig`, and scripts. ([Local Dev Server - FrontMCP][3])
401
+
402
+ ### Production
403
+
404
+ ```bash
405
+ npm run build
406
+ NODE_ENV=production PORT=8080 npm start
407
+ ```
408
+
409
+ Builds to `dist/` (uses `tsconfig.build.json`). Consider a process manager and reverse proxy; align all `@frontmcp/*`
410
+ versions. ([Production Build - FrontMCP][13])
411
+
412
+ ---
413
+
414
+ ## Version Alignment
415
+
416
+ If versions drift, the runtime will throw a clear **“version mismatch”** at boot. Keep `@frontmcp/*` versions aligned.
417
+ ([Production Build - FrontMCP][13])
418
+
419
+ ---
420
+
421
+ ## Contributing
422
+
423
+ - PRs welcome! Read the full [CONTRIBUTING.md](./CONTRIBUTING.md) for workflow details, coding standards, and the PR
424
+ checklist.
425
+ - Keep changes focused, add/adjust Jest specs, and update docs/snippets when behavior changes.
426
+ - Before opening a PR run `yarn nx run-many -t lint,test,build`, `npx frontmcp doctor`, and verify the demo/Inspector
427
+ flows relevant to your change.
428
+ - Align `@frontmcp/*` versions in examples to avoid runtime version mismatches.
429
+
430
+ ---
431
+
432
+ ## License
433
+
434
+ See [LICENSE](./LICENSE).
435
+
436
+ [1]: https://docs.agentfront.dev/docs/getting-started/installation 'Installation - FrontMCP'
437
+ [2]: https://docs.agentfront.dev/docs/getting-started/quickstart 'Quickstart - FrontMCP'
438
+ [3]: https://docs.agentfront.dev/docs/deployment/local-dev-server 'Local Dev Server - FrontMCP'
439
+ [4]: https://docs.agentfront.dev/docs/servers/tools 'Tools - FrontMCP'
440
+ [5]: https://docs.agentfront.dev/docs/servers/server 'The FrontMCP Server - FrontMCP'
441
+ [6]: https://docs.agentfront.dev/docs/servers/apps 'Apps - FrontMCP'
442
+ [7]: https://docs.agentfront.dev/docs/servers/resources 'Resources - FrontMCP'
443
+ [8]: https://docs.agentfront.dev/docs/servers/prompts 'Prompts - FrontMCP'
444
+ [9]: https://docs.agentfront.dev/docs/guides/add-openapi-adapter 'Add OpenAPI Adapter - FrontMCP'
445
+ [10]: https://docs.agentfront.dev/docs/servers/authentication/overview 'Authentication - FrontMCP'
446
+ [11]: https://docs.agentfront.dev/docs/servers/authentication/remote 'Remote OAuth - FrontMCP'
447
+ [12]: https://docs.agentfront.dev/docs/servers/authentication/local 'Local OAuth - FrontMCP'
448
+ [13]: https://docs.agentfront.dev/docs/deployment/production-build 'Production Build - FrontMCP'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontmcp",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "FrontMCP command line interface",
5
5
  "author": "AgentFront <info@agentfront.dev>",
6
6
  "homepage": "https://docs.agentfront.dev",
@@ -25,9 +25,9 @@
25
25
  "frontmcp": "./src/cli.js"
26
26
  },
27
27
  "dependencies": {
28
- "@frontmcp/sdk": "^0.3.1",
29
- "@frontmcp/plugins": "^0.3.1",
30
- "@frontmcp/adapters": "^0.3.1"
28
+ "@frontmcp/sdk": "^0.4.0",
29
+ "@frontmcp/plugins": "^0.4.0",
30
+ "@frontmcp/adapters": "^0.4.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "typescript": "^5.5.3",
package/src/args.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export type Command = 'dev' | 'build' | 'init' | 'doctor' | 'inspector' | 'create' | 'help' | 'template' | 'version';
2
+ export interface ParsedArgs {
3
+ _: string[];
4
+ outDir?: string;
5
+ entry?: string;
6
+ help?: boolean;
7
+ }
8
+ export declare function parseArgs(argv: string[]): ParsedArgs;
package/src/args.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseArgs = parseArgs;
4
+ function parseArgs(argv) {
5
+ const out = { _: [] };
6
+ for (let i = 0; i < argv.length; i++) {
7
+ const a = argv[i];
8
+ if (a === '--out-dir' || a === '-o')
9
+ out.outDir = argv[++i];
10
+ else if (a === '--entry' || a === '-e')
11
+ out.entry = argv[++i];
12
+ else if (a === '--help' || a === '-h')
13
+ out.help = true;
14
+ else
15
+ out._.push(a);
16
+ }
17
+ return out;
18
+ }
19
+ //# sourceMappingURL=args.js.map