@frontmcp/skills 0.0.1 → 1.0.0-beta.10
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 +2 -2
- package/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +143 -0
- package/catalog/frontmcp-config/references/configure-auth.md +238 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
- package/catalog/frontmcp-config/references/configure-http.md +205 -0
- package/catalog/frontmcp-config/references/configure-session.md +205 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
- package/catalog/frontmcp-config/references/configure-transport.md +195 -0
- package/catalog/frontmcp-config/references/setup-redis.md +4 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
- package/catalog/frontmcp-deployment/SKILL.md +127 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +76 -63
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
- package/catalog/frontmcp-development/SKILL.md +121 -0
- package/catalog/frontmcp-development/references/create-adapter.md +165 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
- package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +96 -22
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
- package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
- package/catalog/frontmcp-development/references/official-adapters.md +194 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +96 -31
- package/catalog/frontmcp-guides/SKILL.md +420 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
- package/catalog/frontmcp-production-readiness/SKILL.md +253 -0
- package/catalog/frontmcp-setup/SKILL.md +130 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
- package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
- package/catalog/frontmcp-testing/SKILL.md +127 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
- package/catalog/skills-manifest.json +39 -378
- package/package.json +2 -2
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +3 -3
- package/src/manifest.js +2 -3
- package/src/manifest.js.map +1 -1
- package/catalog/adapters/create-adapter/SKILL.md +0 -127
- package/catalog/adapters/official-adapters/SKILL.md +0 -136
- package/catalog/auth/configure-auth/SKILL.md +0 -250
- package/catalog/auth/configure-session/SKILL.md +0 -201
- package/catalog/config/configure-elicitation/SKILL.md +0 -136
- package/catalog/config/configure-http/SKILL.md +0 -167
- package/catalog/config/configure-throttle/SKILL.md +0 -189
- package/catalog/config/configure-transport/SKILL.md +0 -151
- package/catalog/deployment/build-for-browser/SKILL.md +0 -95
- package/catalog/deployment/build-for-cli/SKILL.md +0 -100
- package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
- package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
- package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
- package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
- package/catalog/setup/project-structure-nx/SKILL.md +0 -186
- package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
- /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
- /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
- /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
- /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
- /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configure-session
|
|
3
|
-
description: Configure session storage with Redis, Vercel KV, or in-memory backends. Use when setting up sessions, choosing a storage provider, or configuring TTL and key prefixes.
|
|
4
|
-
tags:
|
|
5
|
-
- session
|
|
6
|
-
- storage
|
|
7
|
-
- redis
|
|
8
|
-
- memory
|
|
9
|
-
bundle:
|
|
10
|
-
- recommended
|
|
11
|
-
- full
|
|
12
|
-
visibility: both
|
|
13
|
-
priority: 5
|
|
14
|
-
parameters:
|
|
15
|
-
- name: provider
|
|
16
|
-
description: Session storage provider
|
|
17
|
-
type: string
|
|
18
|
-
required: false
|
|
19
|
-
default: memory
|
|
20
|
-
- name: ttl
|
|
21
|
-
description: Default session TTL in milliseconds
|
|
22
|
-
type: number
|
|
23
|
-
required: false
|
|
24
|
-
default: 3600000
|
|
25
|
-
- name: key-prefix
|
|
26
|
-
description: Redis/KV key prefix for session keys
|
|
27
|
-
type: string
|
|
28
|
-
required: false
|
|
29
|
-
default: 'mcp:session:'
|
|
30
|
-
examples:
|
|
31
|
-
- scenario: Configure Redis session store for production
|
|
32
|
-
parameters:
|
|
33
|
-
provider: redis
|
|
34
|
-
expected-outcome: Sessions are persisted in Redis with automatic TTL expiration and key prefixing
|
|
35
|
-
- scenario: Configure Vercel KV for serverless deployment
|
|
36
|
-
parameters:
|
|
37
|
-
provider: vercel-kv
|
|
38
|
-
expected-outcome: Sessions use Vercel KV with environment-based credentials
|
|
39
|
-
- scenario: Use memory store for local development
|
|
40
|
-
parameters:
|
|
41
|
-
provider: memory
|
|
42
|
-
expected-outcome: Sessions are stored in-process memory, suitable for development only
|
|
43
|
-
license: Apache-2.0
|
|
44
|
-
compatibility: Requires Node.js 18+. Redis provider requires ioredis. Vercel KV provider requires @vercel/kv.
|
|
45
|
-
metadata:
|
|
46
|
-
category: auth
|
|
47
|
-
difficulty: beginner
|
|
48
|
-
docs: https://docs.agentfront.dev/frontmcp/deployment/redis-setup
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
# Configure Session Management
|
|
52
|
-
|
|
53
|
-
This skill covers setting up session storage in FrontMCP. Sessions track authenticated user state, token storage, and request context across MCP interactions.
|
|
54
|
-
|
|
55
|
-
## Storage Providers
|
|
56
|
-
|
|
57
|
-
| Provider | Use Case | Persistence | Package Required |
|
|
58
|
-
| ----------- | ------------------- | ----------- | ---------------- |
|
|
59
|
-
| `memory` | Development/testing | None | None (default) |
|
|
60
|
-
| `redis` | Node.js production | Yes | `ioredis` |
|
|
61
|
-
| `vercel-kv` | Vercel deployments | Yes | `@vercel/kv` |
|
|
62
|
-
|
|
63
|
-
Never use the memory store in production. Sessions are lost on process restart, which breaks authentication for all connected clients.
|
|
64
|
-
|
|
65
|
-
## Redis (Production)
|
|
66
|
-
|
|
67
|
-
Configure Redis session storage via the `@FrontMcp` decorator:
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
import { FrontMcp, App } from '@frontmcp/sdk';
|
|
71
|
-
|
|
72
|
-
@App()
|
|
73
|
-
class MyApp {}
|
|
74
|
-
|
|
75
|
-
@FrontMcp({
|
|
76
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
77
|
-
apps: [MyApp],
|
|
78
|
-
redis: {
|
|
79
|
-
provider: 'redis',
|
|
80
|
-
host: process.env['REDIS_HOST'] ?? 'localhost',
|
|
81
|
-
port: Number(process.env['REDIS_PORT'] ?? 6379),
|
|
82
|
-
password: process.env['REDIS_PASSWORD'],
|
|
83
|
-
},
|
|
84
|
-
})
|
|
85
|
-
class MyServer {}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
The SDK internally calls `createSessionStore()` to create a `RedisSessionStore`. The factory lazy-loads `ioredis` so it is not bundled when you use a different provider.
|
|
89
|
-
|
|
90
|
-
## Vercel KV
|
|
91
|
-
|
|
92
|
-
For Vercel deployments, use the `vercel-kv` provider. Credentials are read from environment variables set automatically by the Vercel platform:
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
@FrontMcp({
|
|
96
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
97
|
-
apps: [MyApp],
|
|
98
|
-
redis: { provider: 'vercel-kv' },
|
|
99
|
-
})
|
|
100
|
-
class MyServer {}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Required environment variables (auto-injected when a KV store is linked to your Vercel project):
|
|
104
|
-
|
|
105
|
-
| Variable | Description |
|
|
106
|
-
| ------------------- | ------------------------------ |
|
|
107
|
-
| `KV_REST_API_URL` | Vercel KV REST endpoint |
|
|
108
|
-
| `KV_REST_API_TOKEN` | Vercel KV authentication token |
|
|
109
|
-
|
|
110
|
-
## Memory (Development Default)
|
|
111
|
-
|
|
112
|
-
When no Redis or KV configuration is provided, the SDK falls back to an in-memory store. This is suitable only for development:
|
|
113
|
-
|
|
114
|
-
```typescript
|
|
115
|
-
@FrontMcp({
|
|
116
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
117
|
-
apps: [MyApp],
|
|
118
|
-
// No redis config -- defaults to memory
|
|
119
|
-
})
|
|
120
|
-
class MyServer {}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Key Prefix
|
|
124
|
-
|
|
125
|
-
All persistent stores support a `keyPrefix` option that namespaces session keys. This is important when multiple FrontMCP servers share the same Redis instance:
|
|
126
|
-
|
|
127
|
-
```typescript
|
|
128
|
-
@FrontMcp({
|
|
129
|
-
info: { name: 'billing-server', version: '1.0.0' },
|
|
130
|
-
apps: [MyApp],
|
|
131
|
-
redis: {
|
|
132
|
-
provider: 'redis',
|
|
133
|
-
host: 'shared-redis.internal',
|
|
134
|
-
port: 6379,
|
|
135
|
-
keyPrefix: 'billing-mcp:session:',
|
|
136
|
-
},
|
|
137
|
-
})
|
|
138
|
-
class BillingServer {}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Use a unique prefix per server to prevent session key collisions.
|
|
142
|
-
|
|
143
|
-
## TTL Configuration
|
|
144
|
-
|
|
145
|
-
The `defaultTtlMs` option controls how long sessions live before expiring:
|
|
146
|
-
|
|
147
|
-
| Scenario | Recommended TTL |
|
|
148
|
-
| ---------------------------- | ----------------------- |
|
|
149
|
-
| Interactive user sessions | `3_600_000` (1 hour) |
|
|
150
|
-
| Long-running agent workflows | `86_400_000` (24 hours) |
|
|
151
|
-
| Short-lived CI/CD operations | `600_000` (10 minutes) |
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
@FrontMcp({
|
|
155
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
156
|
-
apps: [MyApp],
|
|
157
|
-
redis: {
|
|
158
|
-
provider: 'redis',
|
|
159
|
-
host: 'localhost',
|
|
160
|
-
port: 6379,
|
|
161
|
-
defaultTtlMs: 86_400_000, // 24 hours for agent workflows
|
|
162
|
-
},
|
|
163
|
-
})
|
|
164
|
-
class MyServer {}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Pub/Sub for Resource Subscriptions
|
|
168
|
-
|
|
169
|
-
If your server uses resource subscriptions (clients subscribe to resource change notifications), you need a pub/sub channel. Vercel KV does not support pub/sub, so you must use Redis for the pub/sub channel even when using Vercel KV for sessions:
|
|
170
|
-
|
|
171
|
-
```typescript
|
|
172
|
-
import { createSessionStore, createPubsubStore } from '@frontmcp/sdk/auth/session';
|
|
173
|
-
|
|
174
|
-
// Sessions in Vercel KV
|
|
175
|
-
const sessionStore = await createSessionStore({
|
|
176
|
-
provider: 'vercel-kv',
|
|
177
|
-
url: process.env['KV_REST_API_URL'],
|
|
178
|
-
token: process.env['KV_REST_API_TOKEN'],
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// Pub/sub requires Redis
|
|
182
|
-
const pubsubStore = createPubsubStore({
|
|
183
|
-
provider: 'redis',
|
|
184
|
-
host: process.env['REDIS_HOST'] ?? 'localhost',
|
|
185
|
-
port: 6379,
|
|
186
|
-
});
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Common Mistakes
|
|
190
|
-
|
|
191
|
-
- **Constructing stores directly** -- always use factory functions (`createSessionStore`). Direct construction bypasses lazy-loading and key prefix normalization.
|
|
192
|
-
- **Using memory store in production** -- sessions vanish on restart. Clients must re-authenticate and in-flight workflows are lost.
|
|
193
|
-
- **Missing `await` for Vercel KV** -- the `createSessionStore` factory is async when the provider is `vercel-kv`. Forgetting to await causes the store to be used before its connection is ready.
|
|
194
|
-
- **Sharing key prefixes** -- if two servers share a Redis instance with the same prefix, their sessions collide. Always use a unique prefix per server.
|
|
195
|
-
|
|
196
|
-
## Reference
|
|
197
|
-
|
|
198
|
-
- Session docs: [docs.agentfront.dev/frontmcp/deployment/redis-setup](https://docs.agentfront.dev/frontmcp/deployment/redis-setup)
|
|
199
|
-
- Session store factory: `createSessionStore()` — import from `@frontmcp/sdk`
|
|
200
|
-
- Redis session store: import from `@frontmcp/auth` — [source](https://github.com/agentfront/frontmcp/tree/main/libs/auth/src/session)
|
|
201
|
-
- Vercel KV session store: import from `@frontmcp/auth` — [source](https://github.com/agentfront/frontmcp/tree/main/libs/auth/src/session)
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configure-elicitation
|
|
3
|
-
description: Enable interactive user input requests from tools during execution. Use when tools need to ask the user for confirmation, choices, or additional data mid-execution.
|
|
4
|
-
tags: [elicitation, user-input, interactive, confirmation, form]
|
|
5
|
-
examples:
|
|
6
|
-
- scenario: Tool asks user for confirmation before destructive action
|
|
7
|
-
expected-outcome: Execution pauses, user confirms, tool proceeds
|
|
8
|
-
- scenario: Tool presents a form for user to fill in
|
|
9
|
-
expected-outcome: User fills form fields, tool receives structured input
|
|
10
|
-
priority: 6
|
|
11
|
-
visibility: both
|
|
12
|
-
license: Apache-2.0
|
|
13
|
-
metadata:
|
|
14
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/elicitation
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Configuring Elicitation
|
|
18
|
-
|
|
19
|
-
Elicitation allows tools to request interactive input from users mid-execution — confirmations, choices, or structured form data.
|
|
20
|
-
|
|
21
|
-
## When to Use
|
|
22
|
-
|
|
23
|
-
Enable elicitation when:
|
|
24
|
-
|
|
25
|
-
- Tools need user confirmation before destructive actions (delete, deploy, overwrite)
|
|
26
|
-
- Tools need additional input during execution (file selection, parameter choice)
|
|
27
|
-
- Building multi-step workflows that require user decisions at each stage
|
|
28
|
-
|
|
29
|
-
## Enable Elicitation
|
|
30
|
-
|
|
31
|
-
### Basic (In-Memory)
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
@FrontMcp({
|
|
35
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
36
|
-
apps: [MyApp],
|
|
37
|
-
elicitation: {
|
|
38
|
-
enabled: true,
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
class Server {}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### With Redis (Distributed/Production)
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
@FrontMcp({
|
|
48
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
49
|
-
apps: [MyApp],
|
|
50
|
-
elicitation: {
|
|
51
|
-
enabled: true,
|
|
52
|
-
redis: { provider: 'redis', host: 'localhost', port: 6379 },
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
class Server {}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## ElicitationOptionsInput
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
interface ElicitationOptionsInput {
|
|
62
|
-
enabled?: boolean; // default: false
|
|
63
|
-
redis?: RedisOptionsInput; // storage for elicitation state
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Using Elicitation in Tools
|
|
68
|
-
|
|
69
|
-
When elicitation is enabled, tools can request user input via the MCP elicitation protocol:
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
73
|
-
import { z } from 'zod';
|
|
74
|
-
|
|
75
|
-
@Tool({
|
|
76
|
-
name: 'delete_records',
|
|
77
|
-
description: 'Delete records from the database',
|
|
78
|
-
inputSchema: {
|
|
79
|
-
table: z.string(),
|
|
80
|
-
filter: z.string(),
|
|
81
|
-
},
|
|
82
|
-
outputSchema: { deleted: z.number() },
|
|
83
|
-
})
|
|
84
|
-
class DeleteRecordsTool extends ToolContext {
|
|
85
|
-
async execute(input: { table: string; filter: string }) {
|
|
86
|
-
// Count records that would be deleted
|
|
87
|
-
const db = this.get(DB_TOKEN);
|
|
88
|
-
const count = await db.count(input.table, input.filter);
|
|
89
|
-
|
|
90
|
-
// Request confirmation from user before proceeding
|
|
91
|
-
const confirmation = await this.elicit({
|
|
92
|
-
message: `This will delete ${count} records from ${input.table}. Are you sure?`,
|
|
93
|
-
requestedSchema: {
|
|
94
|
-
type: 'object',
|
|
95
|
-
properties: {
|
|
96
|
-
confirmed: { type: 'boolean', description: 'Confirm deletion' },
|
|
97
|
-
},
|
|
98
|
-
required: ['confirmed'],
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
if (!confirmation || !confirmation.confirmed) {
|
|
103
|
-
return { deleted: 0 };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const deleted = await db.delete(input.table, input.filter);
|
|
107
|
-
return { deleted };
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## How It Works
|
|
113
|
-
|
|
114
|
-
1. Tool calls `this.elicit()` with a message and requested schema
|
|
115
|
-
2. Server sends an `elicitation/request` to the client
|
|
116
|
-
3. Client displays the request to the user (UI varies by client)
|
|
117
|
-
4. User responds with structured data matching the schema
|
|
118
|
-
5. `this.elicit()` returns the user's response
|
|
119
|
-
6. Tool continues execution with the response
|
|
120
|
-
|
|
121
|
-
## Notes
|
|
122
|
-
|
|
123
|
-
- When `enabled: false` (default), `this.elicit()` is not available — keeps resource overhead low
|
|
124
|
-
- When enabled, tool output schemas are automatically extended with elicitation fallback type
|
|
125
|
-
- Use Redis storage for production/multi-instance deployments
|
|
126
|
-
- Not all MCP clients support elicitation — handle gracefully when `this.elicit()` returns `undefined`
|
|
127
|
-
|
|
128
|
-
## Verification
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
# Enable elicitation and start
|
|
132
|
-
frontmcp dev
|
|
133
|
-
|
|
134
|
-
# Test with an MCP client that supports elicitation
|
|
135
|
-
# The tool should pause and request user input
|
|
136
|
-
```
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configure-http
|
|
3
|
-
description: Configure HTTP server options including port, CORS, unix sockets, and entry path. Use when customizing the HTTP listener, enabling CORS, or binding to a unix socket.
|
|
4
|
-
tags: [http, cors, port, socket, server, configuration]
|
|
5
|
-
parameters:
|
|
6
|
-
- name: port
|
|
7
|
-
description: HTTP server port
|
|
8
|
-
type: number
|
|
9
|
-
default: 3001
|
|
10
|
-
examples:
|
|
11
|
-
- scenario: Configure CORS for a specific frontend origin
|
|
12
|
-
expected-outcome: Server accepts requests only from the allowed origin
|
|
13
|
-
- scenario: Bind to a unix socket for local-only access
|
|
14
|
-
expected-outcome: Server listens on unix socket instead of TCP port
|
|
15
|
-
priority: 7
|
|
16
|
-
visibility: both
|
|
17
|
-
license: Apache-2.0
|
|
18
|
-
metadata:
|
|
19
|
-
docs: https://docs.agentfront.dev/frontmcp/deployment/local-dev-server
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
# Configuring HTTP Options
|
|
23
|
-
|
|
24
|
-
Configure the HTTP server — port, CORS policy, unix sockets, and entry path prefix.
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
Configure HTTP options when:
|
|
29
|
-
|
|
30
|
-
- Changing the default port (3001)
|
|
31
|
-
- Enabling CORS for a frontend application
|
|
32
|
-
- Mounting the MCP server under a URL prefix
|
|
33
|
-
- Binding to a unix socket for local daemon mode
|
|
34
|
-
|
|
35
|
-
## HttpOptionsInput
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
@FrontMcp({
|
|
39
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
40
|
-
apps: [MyApp],
|
|
41
|
-
http: {
|
|
42
|
-
port: 3001, // default: 3001
|
|
43
|
-
entryPath: '', // default: '' (root)
|
|
44
|
-
socketPath: undefined, // unix socket path (overrides port)
|
|
45
|
-
cors: {
|
|
46
|
-
// default: permissive (all origins)
|
|
47
|
-
origin: ['https://myapp.com'],
|
|
48
|
-
credentials: true,
|
|
49
|
-
maxAge: 86400,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
class Server {}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Port Configuration
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
// Default: port 3001
|
|
60
|
-
http: {
|
|
61
|
-
port: 3001;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Use environment variable
|
|
65
|
-
http: {
|
|
66
|
-
port: Number(process.env.PORT) || 3001;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Random port (useful for testing)
|
|
70
|
-
http: {
|
|
71
|
-
port: 0;
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## CORS Configuration
|
|
76
|
-
|
|
77
|
-
### Permissive (Default)
|
|
78
|
-
|
|
79
|
-
When `cors` is not specified, the server allows all origins without credentials:
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
// All origins allowed (default behavior)
|
|
83
|
-
http: {
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Restrict to Specific Origins
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
http: {
|
|
91
|
-
cors: {
|
|
92
|
-
origin: ['https://myapp.com', 'https://staging.myapp.com'],
|
|
93
|
-
credentials: true,
|
|
94
|
-
maxAge: 86400, // Cache preflight for 24 hours
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Disable CORS Entirely
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
http: {
|
|
103
|
-
cors: false, // No CORS headers at all
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Dynamic Origin
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
http: {
|
|
111
|
-
cors: {
|
|
112
|
-
origin: (origin: string) => {
|
|
113
|
-
// Allow any *.myapp.com subdomain
|
|
114
|
-
return origin.endsWith('.myapp.com');
|
|
115
|
-
},
|
|
116
|
-
credentials: true,
|
|
117
|
-
},
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### CORS Fields
|
|
122
|
-
|
|
123
|
-
| Field | Type | Default | Description |
|
|
124
|
-
| ------------- | ------------------------------------------- | ------------ | ---------------------------------- |
|
|
125
|
-
| `origin` | `boolean \| string \| string[] \| function` | `true` (all) | Allowed origins |
|
|
126
|
-
| `credentials` | `boolean` | `false` | Allow cookies/auth headers |
|
|
127
|
-
| `maxAge` | `number` | — | Preflight cache duration (seconds) |
|
|
128
|
-
|
|
129
|
-
## Entry Path Prefix
|
|
130
|
-
|
|
131
|
-
Mount the MCP server under a URL prefix:
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
http: {
|
|
135
|
-
entryPath: '/api/mcp',
|
|
136
|
-
}
|
|
137
|
-
// Server endpoints become: /api/mcp/sse, /api/mcp/, etc.
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Useful when running behind a reverse proxy or alongside other services.
|
|
141
|
-
|
|
142
|
-
## Unix Socket Mode
|
|
143
|
-
|
|
144
|
-
Bind to a unix socket instead of a TCP port for local-only access:
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
http: {
|
|
148
|
-
socketPath: '/tmp/my-mcp-server.sock',
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
- Mutually exclusive with `port` — if `socketPath` is set, `port` is ignored
|
|
153
|
-
- Use for local daemons, CLI tools, and process manager integrations
|
|
154
|
-
- Combine with `sqlite` for fully local deployments
|
|
155
|
-
|
|
156
|
-
## Verification
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
# Start with custom port
|
|
160
|
-
PORT=8080 frontmcp dev
|
|
161
|
-
|
|
162
|
-
# Test CORS
|
|
163
|
-
curl -v -H "Origin: https://myapp.com" http://localhost:8080/
|
|
164
|
-
|
|
165
|
-
# Test unix socket
|
|
166
|
-
curl --unix-socket /tmp/my-mcp-server.sock http://localhost/
|
|
167
|
-
```
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configure-throttle
|
|
3
|
-
description: Set up rate limiting, concurrency control, timeouts, and IP filtering at server and per-tool level. Use when protecting against abuse, limiting request rates, or configuring IP allow/deny lists.
|
|
4
|
-
tags: [throttle, rate-limit, concurrency, timeout, security, guard, ip-filter]
|
|
5
|
-
parameters:
|
|
6
|
-
- name: maxRequests
|
|
7
|
-
description: Maximum requests per window
|
|
8
|
-
type: number
|
|
9
|
-
default: 100
|
|
10
|
-
examples:
|
|
11
|
-
- scenario: Rate limit all tools to 100 requests per minute
|
|
12
|
-
expected-outcome: Requests beyond limit receive 429 response
|
|
13
|
-
- scenario: Limit concurrent executions of expensive tool to 5
|
|
14
|
-
expected-outcome: 6th concurrent call queues or fails
|
|
15
|
-
- scenario: Block requests from specific IP ranges
|
|
16
|
-
expected-outcome: Blocked IPs receive 403 response
|
|
17
|
-
priority: 7
|
|
18
|
-
visibility: both
|
|
19
|
-
license: Apache-2.0
|
|
20
|
-
metadata:
|
|
21
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/guard
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
# Configuring Throttle, Rate Limits, and IP Filtering
|
|
25
|
-
|
|
26
|
-
Protect your FrontMCP server with rate limiting, concurrency control, execution timeouts, and IP filtering — at both server and per-tool levels.
|
|
27
|
-
|
|
28
|
-
## When to Use
|
|
29
|
-
|
|
30
|
-
Configure throttle when:
|
|
31
|
-
|
|
32
|
-
- Protecting against abuse or DDoS
|
|
33
|
-
- Limiting expensive tool executions
|
|
34
|
-
- Enforcing per-session or per-IP request quotas
|
|
35
|
-
- Blocking or allowing specific IP ranges
|
|
36
|
-
- Setting execution timeouts for long-running tools
|
|
37
|
-
|
|
38
|
-
## Server-Level Throttle (GuardConfig)
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
@FrontMcp({
|
|
42
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
43
|
-
apps: [MyApp],
|
|
44
|
-
throttle: {
|
|
45
|
-
enabled: true,
|
|
46
|
-
|
|
47
|
-
// Global rate limit (all requests combined)
|
|
48
|
-
global: {
|
|
49
|
-
maxRequests: 1000,
|
|
50
|
-
windowMs: 60000, // 1 minute window
|
|
51
|
-
partitionBy: 'global', // shared across all clients
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
// Global concurrency limit
|
|
55
|
-
globalConcurrency: {
|
|
56
|
-
maxConcurrent: 50,
|
|
57
|
-
partitionBy: 'global',
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
// Default limits for individual tools (applied unless tool overrides)
|
|
61
|
-
defaultRateLimit: {
|
|
62
|
-
maxRequests: 100,
|
|
63
|
-
windowMs: 60000,
|
|
64
|
-
},
|
|
65
|
-
defaultConcurrency: {
|
|
66
|
-
maxConcurrent: 10,
|
|
67
|
-
},
|
|
68
|
-
defaultTimeout: {
|
|
69
|
-
executeMs: 30000, // 30 second timeout
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
// IP filtering
|
|
73
|
-
ipFilter: {
|
|
74
|
-
allowList: ['10.0.0.0/8', '172.16.0.0/12'], // CIDR ranges
|
|
75
|
-
denyList: ['192.168.1.100'],
|
|
76
|
-
defaultAction: 'allow', // 'allow' | 'deny'
|
|
77
|
-
trustProxy: true, // trust X-Forwarded-For
|
|
78
|
-
trustedProxyDepth: 1, // proxy depth to trust
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
})
|
|
82
|
-
class Server {}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Per-Tool Rate Limiting
|
|
86
|
-
|
|
87
|
-
Override server defaults on individual tools:
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
@Tool({
|
|
91
|
-
name: 'expensive_query',
|
|
92
|
-
description: 'Run an expensive database query',
|
|
93
|
-
inputSchema: {
|
|
94
|
-
query: z.string(),
|
|
95
|
-
},
|
|
96
|
-
outputSchema: { rows: z.array(z.record(z.unknown())) },
|
|
97
|
-
|
|
98
|
-
// Per-tool limits
|
|
99
|
-
rateLimit: {
|
|
100
|
-
maxRequests: 10,
|
|
101
|
-
windowMs: 60000,
|
|
102
|
-
partitionBy: 'session', // per-session rate limit
|
|
103
|
-
},
|
|
104
|
-
concurrency: {
|
|
105
|
-
maxConcurrent: 3,
|
|
106
|
-
queueTimeoutMs: 5000, // wait up to 5s for a slot
|
|
107
|
-
partitionBy: 'session',
|
|
108
|
-
},
|
|
109
|
-
timeout: {
|
|
110
|
-
executeMs: 60000, // 60 second timeout for this tool
|
|
111
|
-
},
|
|
112
|
-
})
|
|
113
|
-
class ExpensiveQueryTool extends ToolContext {
|
|
114
|
-
async execute(input: { query: string }) {
|
|
115
|
-
const db = this.get(DB_TOKEN);
|
|
116
|
-
return { rows: await db.query(input.query) };
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Configuration Types
|
|
122
|
-
|
|
123
|
-
### RateLimitConfig
|
|
124
|
-
|
|
125
|
-
| Field | Type | Default | Description |
|
|
126
|
-
| ------------- | ------------------------------- | ---------- | ------------------------- |
|
|
127
|
-
| `maxRequests` | `number` | — | Max requests per window |
|
|
128
|
-
| `windowMs` | `number` | `60000` | Window duration in ms |
|
|
129
|
-
| `partitionBy` | `'global' \| 'ip' \| 'session'` | `'global'` | How to partition counters |
|
|
130
|
-
|
|
131
|
-
### ConcurrencyConfig
|
|
132
|
-
|
|
133
|
-
| Field | Type | Default | Description |
|
|
134
|
-
| ---------------- | ------------------------------- | ---------- | -------------------------------------------------- |
|
|
135
|
-
| `maxConcurrent` | `number` | — | Max simultaneous executions |
|
|
136
|
-
| `queueTimeoutMs` | `number` | `0` | How long to wait for a slot (0 = fail immediately) |
|
|
137
|
-
| `partitionBy` | `'global' \| 'ip' \| 'session'` | `'global'` | How to partition counters |
|
|
138
|
-
|
|
139
|
-
### TimeoutConfig
|
|
140
|
-
|
|
141
|
-
| Field | Type | Default | Description |
|
|
142
|
-
| ----------- | -------- | ------- | ------------------------ |
|
|
143
|
-
| `executeMs` | `number` | — | Max execution time in ms |
|
|
144
|
-
|
|
145
|
-
### IpFilterConfig
|
|
146
|
-
|
|
147
|
-
| Field | Type | Default | Description |
|
|
148
|
-
| ------------------- | ------------------- | --------- | ----------------------------------- |
|
|
149
|
-
| `allowList` | `string[]` | — | Allowed IPs or CIDR ranges |
|
|
150
|
-
| `denyList` | `string[]` | — | Blocked IPs or CIDR ranges |
|
|
151
|
-
| `defaultAction` | `'allow' \| 'deny'` | `'allow'` | Action when IP matches neither list |
|
|
152
|
-
| `trustProxy` | `boolean` | `false` | Trust X-Forwarded-For header |
|
|
153
|
-
| `trustedProxyDepth` | `number` | `1` | How many proxy hops to trust |
|
|
154
|
-
|
|
155
|
-
## Partition Strategies
|
|
156
|
-
|
|
157
|
-
- **`'global'`** — Single shared counter for all clients. Use for global capacity limits.
|
|
158
|
-
- **`'ip'`** — Separate counter per client IP. Use for per-client rate limiting.
|
|
159
|
-
- **`'session'`** — Separate counter per MCP session. Use for per-session fairness.
|
|
160
|
-
|
|
161
|
-
## Distributed Rate Limiting
|
|
162
|
-
|
|
163
|
-
For multi-instance deployments, configure Redis storage in the guard:
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
throttle: {
|
|
167
|
-
enabled: true,
|
|
168
|
-
storage: {
|
|
169
|
-
type: 'redis',
|
|
170
|
-
redis: { provider: 'redis', host: 'redis.internal' },
|
|
171
|
-
},
|
|
172
|
-
global: { maxRequests: 1000, windowMs: 60000 },
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Verification
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
# Start server
|
|
180
|
-
frontmcp dev
|
|
181
|
-
|
|
182
|
-
# Test rate limiting (send 101 requests rapidly)
|
|
183
|
-
for i in $(seq 1 101); do
|
|
184
|
-
curl -s -o /dev/null -w "%{http_code}\n" -X POST http://localhost:3001/ \
|
|
185
|
-
-H 'Content-Type: application/json' \
|
|
186
|
-
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
187
|
-
done
|
|
188
|
-
# Should see 429 responses after limit is exceeded
|
|
189
|
-
```
|