@frontmcp/skills 0.0.1 → 1.0.0-beta.11
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 +156 -0
- package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +5 -0
- package/catalog/frontmcp-config/references/configure-auth.md +243 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +183 -0
- package/catalog/frontmcp-config/references/configure-http.md +210 -0
- package/catalog/frontmcp-config/references/configure-session.md +210 -0
- package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +5 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +234 -0
- package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +5 -0
- package/catalog/frontmcp-config/references/configure-transport.md +200 -0
- package/catalog/frontmcp-config/references/setup-redis.md +9 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +9 -0
- package/catalog/frontmcp-deployment/SKILL.md +152 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +143 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +191 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +66 -20
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +218 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +77 -59
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +18 -4
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +69 -36
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +65 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +229 -0
- package/catalog/frontmcp-development/SKILL.md +126 -0
- package/catalog/frontmcp-development/references/create-adapter.md +170 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +10 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +83 -40
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +62 -15
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +100 -7
- package/catalog/frontmcp-development/references/create-plugin.md +506 -0
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +65 -22
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +63 -23
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +148 -26
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +174 -20
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +114 -28
- package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +5 -0
- package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +5 -0
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +172 -23
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +61 -14
- package/catalog/frontmcp-development/references/decorators-guide.md +754 -0
- package/catalog/frontmcp-development/references/official-adapters.md +199 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +97 -27
- package/catalog/frontmcp-extensibility/SKILL.md +103 -0
- package/catalog/frontmcp-extensibility/references/vectoriadb.md +289 -0
- package/catalog/frontmcp-guides/SKILL.md +420 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +641 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +517 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +297 -0
- package/catalog/frontmcp-production-readiness/SKILL.md +98 -0
- package/catalog/frontmcp-production-readiness/references/common-checklist.md +156 -0
- package/catalog/frontmcp-production-readiness/references/production-browser.md +46 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-binary.md +62 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-daemon.md +61 -0
- package/catalog/frontmcp-production-readiness/references/production-cloudflare.md +52 -0
- package/catalog/frontmcp-production-readiness/references/production-lambda.md +53 -0
- package/catalog/frontmcp-production-readiness/references/production-node-sdk.md +66 -0
- package/catalog/frontmcp-production-readiness/references/production-node-server.md +61 -0
- package/catalog/frontmcp-production-readiness/references/production-vercel.md +52 -0
- package/catalog/frontmcp-setup/SKILL.md +132 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +280 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +66 -19
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +79 -17
- package/catalog/frontmcp-setup/references/project-structure-nx.md +251 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +217 -0
- package/catalog/frontmcp-setup/references/readme-guide.md +226 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +63 -58
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +60 -82
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +65 -72
- package/catalog/frontmcp-testing/SKILL.md +135 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +79 -63
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +6 -0
- package/catalog/skills-manifest.json +337 -382
- package/package.json +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js.map +1 -1
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +15 -3
- package/src/manifest.js +3 -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/development/decorators-guide/SKILL.md +0 -598
- package/catalog/plugins/create-plugin/SKILL.md +0 -336
- 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
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-for-browser
|
|
3
|
+
description: Build a FrontMCP server or client for browser environments and frontend frameworks
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Building for Browser
|
|
7
|
+
|
|
8
|
+
Build your FrontMCP server or client for browser environments.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
### Must Use
|
|
13
|
+
|
|
14
|
+
- Building a browser-compatible MCP client or tool interface for a web application
|
|
15
|
+
- Embedding MCP tools in a React, Vue, or other frontend framework using `@frontmcp/react`
|
|
16
|
+
- Creating a client-side bundle that connects to a remote MCP server
|
|
17
|
+
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- Prototyping MCP tool UIs in the browser before building a full backend
|
|
21
|
+
- Shipping a web-based admin dashboard that lists and invokes MCP tools
|
|
22
|
+
- Building a PWA or single-page app that consumes MCP resources
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- Running MCP tools on a Node.js server -- use `--target node` or `build-for-cli`
|
|
27
|
+
- Embedding MCP in an existing Node.js app without HTTP -- use `build-for-sdk`
|
|
28
|
+
- Deploying to Cloudflare Workers or other edge runtimes -- use `deploy-to-cloudflare`
|
|
29
|
+
|
|
30
|
+
> **Decision:** Choose this skill when the MCP consumer runs in a browser; use server-side build targets for Node.js environments.
|
|
31
|
+
|
|
32
|
+
## Build Command
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
frontmcp build --target browser
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Options
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
frontmcp build --target browser -o ./dist/browser # Custom output directory
|
|
42
|
+
frontmcp build --target browser -e ./src/client.ts # Custom entry file
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Browser Limitations
|
|
46
|
+
|
|
47
|
+
Not all FrontMCP features are available in browser environments:
|
|
48
|
+
|
|
49
|
+
| Feature | Browser Support | Notes |
|
|
50
|
+
| --------------------------- | --------------- | ----------------------------------------- |
|
|
51
|
+
| Tools (client-side) | Yes | Can define and run tools |
|
|
52
|
+
| Resources | Yes | Read-only access |
|
|
53
|
+
| Prompts | Yes | Full support |
|
|
54
|
+
| Redis | No | Use in-memory or connect to server |
|
|
55
|
+
| SQLite | No | No filesystem access |
|
|
56
|
+
| File system utilities | No | `@frontmcp/utils` fs ops throw in browser |
|
|
57
|
+
| Crypto (`@frontmcp/utils`) | Yes | Uses WebCrypto API |
|
|
58
|
+
| Direct client (`connect()`) | Yes | In-memory connection |
|
|
59
|
+
|
|
60
|
+
## Usage with @frontmcp/react
|
|
61
|
+
|
|
62
|
+
The browser build is commonly paired with `@frontmcp/react` for React applications:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { FrontMcpProvider, useTools } from '@frontmcp/react';
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
return (
|
|
69
|
+
<FrontMcpProvider config={{ serverUrl: 'https://my-mcp.example.com' }}>
|
|
70
|
+
<ToolUI />
|
|
71
|
+
</FrontMcpProvider>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function ToolUI() {
|
|
76
|
+
const { tools, callTool } = useTools();
|
|
77
|
+
// Use tools in your React components
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Browser vs Node vs SDK Target
|
|
82
|
+
|
|
83
|
+
| Aspect | `--target browser` | `--target node` | `--target sdk` |
|
|
84
|
+
| ----------- | ------------------ | ----------------- | ------------------- |
|
|
85
|
+
| Runtime | Browser | Node.js server | Node.js library |
|
|
86
|
+
| Output | Browser bundle | Server executable | CJS + ESM + types |
|
|
87
|
+
| HTTP server | No | Yes | No (`serve: false`) |
|
|
88
|
+
| Use case | Frontend apps | Standalone server | Embed in Node apps |
|
|
89
|
+
|
|
90
|
+
## Verification
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Build
|
|
94
|
+
frontmcp build --target browser
|
|
95
|
+
|
|
96
|
+
# Check output
|
|
97
|
+
ls dist/browser/
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Common Patterns
|
|
101
|
+
|
|
102
|
+
| Pattern | Correct | Incorrect | Why |
|
|
103
|
+
| ----------------- | ---------------------------------------- | --------------------------------- | ------------------------------------------ |
|
|
104
|
+
| Crypto usage | `@frontmcp/utils` (uses WebCrypto) | `node:crypto` | `node:crypto` is not available in browsers |
|
|
105
|
+
| Storage | In-memory stores or remote API | SQLite / Redis directly | No filesystem or native TCP in browsers |
|
|
106
|
+
| File system ops | Avoid `@frontmcp/utils` fs functions | `readFile()`, `writeFile()` | fs utilities throw in browser environments |
|
|
107
|
+
| Entry file | Separate browser entry (`src/client.ts`) | Reusing server entry point | Server entry may import Node-only modules |
|
|
108
|
+
| Server connection | `FrontMcpProvider` with `serverUrl` | Direct `connect()` with localhost | Browser needs a remote URL, not localhost |
|
|
109
|
+
|
|
110
|
+
## Verification Checklist
|
|
111
|
+
|
|
112
|
+
**Build**
|
|
113
|
+
|
|
114
|
+
- [ ] `frontmcp build --target browser` completes without errors
|
|
115
|
+
- [ ] Output directory contains browser-compatible JS bundle
|
|
116
|
+
- [ ] No Node.js-only modules are included in the bundle
|
|
117
|
+
|
|
118
|
+
**Runtime**
|
|
119
|
+
|
|
120
|
+
- [ ] Bundle loads in the browser without console errors
|
|
121
|
+
- [ ] MCP tools are listed and callable from the frontend
|
|
122
|
+
- [ ] WebCrypto-based operations (auth, PKCE) work correctly
|
|
123
|
+
|
|
124
|
+
**Integration**
|
|
125
|
+
|
|
126
|
+
- [ ] `@frontmcp/react` provider connects to the remote MCP server
|
|
127
|
+
- [ ] Tool invocations return expected results in the UI
|
|
128
|
+
- [ ] Resources and prompts render correctly in browser components
|
|
129
|
+
|
|
130
|
+
## Troubleshooting
|
|
131
|
+
|
|
132
|
+
| Problem | Cause | Solution |
|
|
133
|
+
| --------------------------- | ----------------------------------------- | ---------------------------------------------------------------- |
|
|
134
|
+
| `Module not found: fs` | Node.js module imported in browser bundle | Use a separate browser entry point that avoids Node-only imports |
|
|
135
|
+
| `crypto is not defined` | Using `node:crypto` instead of WebCrypto | Switch to `@frontmcp/utils` crypto functions |
|
|
136
|
+
| CORS errors on tool calls | MCP server missing CORS headers | Configure CORS middleware on the MCP server |
|
|
137
|
+
| Bundle too large | All server-side code included | Use `--target browser` and a dedicated client entry file |
|
|
138
|
+
| `@frontmcp/utils` fs throws | File system ops called in browser | Remove fs calls; use API endpoints or in-memory alternatives |
|
|
139
|
+
|
|
140
|
+
## Reference
|
|
141
|
+
|
|
142
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/browser-compatibility>
|
|
143
|
+
- **Related skills:** `build-for-sdk`, `build-for-cli`, `deploy-to-cloudflare`
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-for-cli
|
|
3
|
+
description: Build a FrontMCP server as a standalone CLI binary using Node.js SEA or bundled JS
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Building a CLI Binary
|
|
7
|
+
|
|
8
|
+
Build your FrontMCP server as a distributable CLI binary using Node.js Single Executable Applications (SEA) or as a bundled JS file.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
### Must Use
|
|
13
|
+
|
|
14
|
+
- Distributing your MCP server as a standalone executable that runs without Node.js
|
|
15
|
+
- Creating a CLI tool installable via package managers (Homebrew, apt, etc.)
|
|
16
|
+
- Producing a self-contained binary for air-gapped or dependency-free deployment
|
|
17
|
+
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- Shipping an MCP-powered developer tool to end users who may not have Node.js
|
|
21
|
+
- Building platform-specific binaries for CI/CD artifact pipelines
|
|
22
|
+
- Creating a single-file JS bundle for lightweight Node.js execution
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- Deploying to a server environment with Node.js available -- use `--target node`
|
|
27
|
+
- Embedding tools in an existing Node.js application -- use `build-for-sdk`
|
|
28
|
+
- Targeting browser environments -- use `build-for-browser`
|
|
29
|
+
|
|
30
|
+
> **Decision:** Choose this skill when your goal is a distributable binary or bundled JS file; use other build targets for server or library deployments.
|
|
31
|
+
|
|
32
|
+
## Build Commands
|
|
33
|
+
|
|
34
|
+
### Native Binary (SEA)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
frontmcp build --target cli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Produces a Node.js Single Executable Application — a single binary embedding your server code and the Node.js runtime.
|
|
41
|
+
|
|
42
|
+
### JS Bundle Only
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
frontmcp build --target cli --js
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Produces a bundled JS file without the native binary wrapper. Run with `node dist/server.js`.
|
|
49
|
+
|
|
50
|
+
### Options
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
frontmcp build --target cli -o ./build # Custom output directory
|
|
54
|
+
frontmcp build --target cli -e ./src/main.ts # Custom entry file
|
|
55
|
+
frontmcp build --target cli --js # JS bundle only (no SEA)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
|
|
60
|
+
- **Node.js 24+** required for SEA support
|
|
61
|
+
- The entry file must export or instantiate a `@FrontMcp` decorated class
|
|
62
|
+
- SEA binaries are platform-specific (build on macOS for macOS, Linux for Linux)
|
|
63
|
+
|
|
64
|
+
## CLI Target vs Node Target
|
|
65
|
+
|
|
66
|
+
| Aspect | `--target cli` | `--target node` |
|
|
67
|
+
| -------- | ---------------------------------- | ------------------------------ |
|
|
68
|
+
| Output | Single binary or JS bundle | JS files for server deployment |
|
|
69
|
+
| Runtime | Embedded Node.js (SEA) or external | Requires Node.js installed |
|
|
70
|
+
| Use case | Distribution to end users | Server deployment (Docker, VM) |
|
|
71
|
+
| Includes | Bundled dependencies | External node_modules |
|
|
72
|
+
|
|
73
|
+
## Server Configuration for CLI Mode
|
|
74
|
+
|
|
75
|
+
When building for CLI distribution, configure your server for local/stdin transport:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
@FrontMcp({
|
|
79
|
+
info: { name: 'my-cli-tool', version: '1.0.0' },
|
|
80
|
+
apps: [MyApp],
|
|
81
|
+
http: { socketPath: '/tmp/my-tool.sock' }, // Unix socket instead of TCP
|
|
82
|
+
sqlite: { path: '~/.my-tool/data.db' }, // Local storage
|
|
83
|
+
})
|
|
84
|
+
class MyCLIServer {}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Verification
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Build
|
|
91
|
+
frontmcp build --target cli
|
|
92
|
+
|
|
93
|
+
# Test the binary
|
|
94
|
+
./dist/my-server --help
|
|
95
|
+
|
|
96
|
+
# Or test JS bundle
|
|
97
|
+
node dist/my-server.cjs.js
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Unix Socket Daemon Mode
|
|
101
|
+
|
|
102
|
+
Run your MCP server as a local daemon accessible via Unix socket:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Start daemon in foreground
|
|
106
|
+
frontmcp socket ./src/main.ts -s ~/.frontmcp/sockets/my-app.sock
|
|
107
|
+
|
|
108
|
+
# Start daemon in background
|
|
109
|
+
frontmcp socket ./src/main.ts -b --db ~/.my-tool/data.db
|
|
110
|
+
|
|
111
|
+
# Default socket path: ~/.frontmcp/sockets/{app-name}.sock
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The daemon accepts JSON-RPC requests over HTTP via the Unix socket, making it ideal for local MCP clients (Claude Code, IDE extensions) that need persistent tool access without a TCP port.
|
|
115
|
+
|
|
116
|
+
## Process Management
|
|
117
|
+
|
|
118
|
+
Manage long-running MCP server processes with built-in supervisor commands:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Start a named server (auto-restarts on crash)
|
|
122
|
+
frontmcp start my-server -e ./src/main.ts --max-restarts 5
|
|
123
|
+
|
|
124
|
+
# Monitor
|
|
125
|
+
frontmcp status my-server # Detailed status for one server
|
|
126
|
+
frontmcp status # Table of all managed servers
|
|
127
|
+
frontmcp list # List all managed processes
|
|
128
|
+
frontmcp logs my-server -F # Tail logs (follow mode)
|
|
129
|
+
|
|
130
|
+
# Control
|
|
131
|
+
frontmcp restart my-server
|
|
132
|
+
frontmcp stop my-server # Graceful shutdown (SIGTERM)
|
|
133
|
+
frontmcp stop my-server -f # Force kill (SIGKILL)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## System Service Installation
|
|
137
|
+
|
|
138
|
+
Install your MCP server as a system service for automatic startup:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Install as systemd service (Linux) or launchd service (macOS)
|
|
142
|
+
frontmcp service install my-server
|
|
143
|
+
|
|
144
|
+
# Uninstall service
|
|
145
|
+
frontmcp service uninstall my-server
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Common Patterns
|
|
149
|
+
|
|
150
|
+
| Pattern | Correct | Incorrect | Why |
|
|
151
|
+
| --------------------- | --------------------------------------------------- | -------------------------------- | ----------------------------------------------------------- |
|
|
152
|
+
| Node.js version | Node.js 24+ for SEA builds | Node.js 18 or 20 | SEA support requires Node.js 24+ |
|
|
153
|
+
| Entry file | Export or instantiate a `@FrontMcp` decorated class | Export a plain function | The build expects a FrontMcp entry point |
|
|
154
|
+
| Transport for CLI | `socketPath` or stdin/stdout | TCP port binding | CLI tools run locally; ports may conflict |
|
|
155
|
+
| Cross-platform binary | Build on each target OS separately | Build on macOS and ship to Linux | SEA binaries are platform-specific |
|
|
156
|
+
| JS-only bundle | `frontmcp build --target cli --js` | `frontmcp build --target node` | `--target node` assumes server deployment with node_modules |
|
|
157
|
+
|
|
158
|
+
## Verification Checklist
|
|
159
|
+
|
|
160
|
+
**Build**
|
|
161
|
+
|
|
162
|
+
- [ ] `frontmcp build --target cli` completes without errors
|
|
163
|
+
- [ ] Output directory contains the expected binary or `.cjs.js` file
|
|
164
|
+
- [ ] Binary file size is reasonable (no unexpected bloat)
|
|
165
|
+
|
|
166
|
+
**Runtime**
|
|
167
|
+
|
|
168
|
+
- [ ] Binary runs without Node.js installed on a clean machine
|
|
169
|
+
- [ ] `--help` flag prints usage information
|
|
170
|
+
- [ ] JS bundle runs correctly with `node dist/my-server.cjs.js`
|
|
171
|
+
|
|
172
|
+
**Distribution**
|
|
173
|
+
|
|
174
|
+
- [ ] Binary is tested on the target platform (macOS, Linux, Windows)
|
|
175
|
+
- [ ] Exit codes are correct (0 for success, non-zero for errors)
|
|
176
|
+
- [ ] No hard-coded absolute paths in the bundled output
|
|
177
|
+
|
|
178
|
+
## Troubleshooting
|
|
179
|
+
|
|
180
|
+
| Problem | Cause | Solution |
|
|
181
|
+
| ---------------------------- | ------------------------------------------- | ----------------------------------------------------------- |
|
|
182
|
+
| SEA build fails | Node.js version below 24 | Upgrade to Node.js 24+ |
|
|
183
|
+
| Binary crashes on startup | Missing `@FrontMcp` decorated entry | Ensure entry file exports or instantiates a decorated class |
|
|
184
|
+
| Binary too large | All dependencies bundled including dev deps | Review dependencies and remove unused packages from bundle |
|
|
185
|
+
| Permission denied on binary | Missing execute permission | Run `chmod +x dist/my-server` |
|
|
186
|
+
| Binary fails on different OS | SEA binaries are platform-specific | Build on the target OS or use CI matrix builds |
|
|
187
|
+
|
|
188
|
+
## Reference
|
|
189
|
+
|
|
190
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/production-build>
|
|
191
|
+
- **Related skills:** `build-for-sdk`, `build-for-browser`, `deploy-to-cloudflare`
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: build-for-sdk
|
|
3
|
-
description: Build a FrontMCP server as an embeddable
|
|
4
|
-
tags: [deployment, sdk, library, embed, programmatic, connect]
|
|
5
|
-
examples:
|
|
6
|
-
- scenario: Embed MCP tools in an existing Express app
|
|
7
|
-
expected-outcome: Tools callable programmatically without HTTP server
|
|
8
|
-
- scenario: Build SDK for npm distribution
|
|
9
|
-
expected-outcome: CJS + ESM + TypeScript declarations package
|
|
10
|
-
- scenario: Connect tools to OpenAI function calling
|
|
11
|
-
expected-outcome: Tools formatted for OpenAI API consumption
|
|
12
|
-
priority: 8
|
|
13
|
-
visibility: both
|
|
14
|
-
license: Apache-2.0
|
|
15
|
-
metadata:
|
|
16
|
-
docs: https://docs.agentfront.dev/frontmcp/deployment/direct-client
|
|
3
|
+
description: Build a FrontMCP server as an embeddable library with create() and connect() APIs
|
|
17
4
|
---
|
|
18
5
|
|
|
19
6
|
# Building as an SDK Library
|
|
20
7
|
|
|
21
8
|
Build your FrontMCP server as an embeddable library that runs without an HTTP server. Use `create()` for flat-config setup or `connect()` for platform-specific tool formatting (OpenAI, Claude, LangChain, Vercel AI).
|
|
22
9
|
|
|
23
|
-
## When to Use
|
|
10
|
+
## When to Use This Skill
|
|
24
11
|
|
|
25
|
-
|
|
12
|
+
### Must Use
|
|
26
13
|
|
|
27
|
-
- Embedding MCP tools in an existing Node.js application
|
|
28
|
-
- Distributing your
|
|
29
|
-
- Connecting tools to LLM platforms (OpenAI, Claude, LangChain, Vercel AI)
|
|
30
|
-
|
|
14
|
+
- Embedding MCP tools in an existing Node.js application without starting an HTTP server
|
|
15
|
+
- Distributing your MCP server as an npm package with CJS + ESM + TypeScript declarations
|
|
16
|
+
- Connecting tools to LLM platforms (OpenAI, Claude, LangChain, Vercel AI) via `connect*()` functions
|
|
17
|
+
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- Running MCP tools in-memory for low-latency, zero-network-overhead execution
|
|
21
|
+
- Building a shared tool library consumed by multiple services in a monorepo
|
|
22
|
+
- Testing MCP tools programmatically in integration test suites
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- Deploying a standalone MCP server that listens on a port -- use `--target node` or `build-for-cli`
|
|
27
|
+
- Building a browser-based MCP client -- use `build-for-browser`
|
|
28
|
+
- Deploying to Cloudflare Workers -- use `deploy-to-cloudflare`
|
|
29
|
+
|
|
30
|
+
> **Decision:** Choose this skill when you need MCP tools as a library or programmatic API; use other targets for standalone servers or browser clients.
|
|
31
31
|
|
|
32
32
|
## Build Command
|
|
33
33
|
|
|
@@ -216,3 +216,49 @@ ls dist/
|
|
|
216
216
|
# Test programmatically
|
|
217
217
|
node -e "const { create } = require('./dist/my-sdk.cjs.js'); ..."
|
|
218
218
|
```
|
|
219
|
+
|
|
220
|
+
## Common Patterns
|
|
221
|
+
|
|
222
|
+
| Pattern | Correct | Incorrect | Why |
|
|
223
|
+
| ------------------- | ------------------------------------------- | ---------------------------------------- | ----------------------------------------------------------- |
|
|
224
|
+
| HTTP server | `serve: false` in `@FrontMcp` decorator | Omitting `serve` (defaults to `true`) | SDK mode should not bind a port |
|
|
225
|
+
| Dependency bundling | `@frontmcp/*` marked as external | Bundling all `@frontmcp/*` packages | Consumers already have these as peer deps |
|
|
226
|
+
| Instance reuse | Pass `cacheKey` to `create()` | Call `create()` on every request | Same key reuses the server instance, avoiding repeated init |
|
|
227
|
+
| Cleanup | Call `server.dispose()` or `client.close()` | Letting the process exit without cleanup | Avoids leaked connections and open handles |
|
|
228
|
+
| Platform tools | `connectOpenAI()` for OpenAI format | Manually formatting tool schemas | `connect*()` handles schema translation automatically |
|
|
229
|
+
|
|
230
|
+
## Verification Checklist
|
|
231
|
+
|
|
232
|
+
**Build**
|
|
233
|
+
|
|
234
|
+
- [ ] `frontmcp build --target sdk` completes without errors
|
|
235
|
+
- [ ] Output contains `.cjs.js`, `.esm.mjs`, and `.d.ts` files
|
|
236
|
+
- [ ] `@frontmcp/*` packages are not included in the bundle
|
|
237
|
+
|
|
238
|
+
**Programmatic API**
|
|
239
|
+
|
|
240
|
+
- [ ] `create()` returns a working server instance
|
|
241
|
+
- [ ] `server.callTool()` executes tools and returns results
|
|
242
|
+
- [ ] `server.listTools()` returns all registered tools
|
|
243
|
+
- [ ] `server.dispose()` cleans up without errors
|
|
244
|
+
|
|
245
|
+
**Platform Connections**
|
|
246
|
+
|
|
247
|
+
- [ ] `connectOpenAI()` returns tools in OpenAI function-calling format
|
|
248
|
+
- [ ] `connectClaude()` returns tools in Anthropic `input_schema` format
|
|
249
|
+
- [ ] `client.close()` releases all resources
|
|
250
|
+
|
|
251
|
+
## Troubleshooting
|
|
252
|
+
|
|
253
|
+
| Problem | Cause | Solution |
|
|
254
|
+
| ------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------- |
|
|
255
|
+
| HTTP server starts unexpectedly | Missing `serve: false` in decorator | Add `serve: false` to the `@FrontMcp` options |
|
|
256
|
+
| `create()` returns stale tools | Cached instance from a previous `cacheKey` | Use a unique `cacheKey` or call `dispose()` before re-creating |
|
|
257
|
+
| TypeScript types missing | `.d.ts` files not generated | Ensure `tsconfig` has `declaration: true` and build target is `sdk` |
|
|
258
|
+
| `connectOpenAI()` format wrong | Using raw `listTools()` instead of platform client | Use `connectOpenAI()` which formats tools for OpenAI automatically |
|
|
259
|
+
| Bundle includes `@frontmcp/*` | Build config missing externals | Verify `--target sdk` is set; it marks `@frontmcp/*` as external |
|
|
260
|
+
|
|
261
|
+
## Reference
|
|
262
|
+
|
|
263
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/direct-client>
|
|
264
|
+
- **Related skills:** `build-for-cli`, `build-for-browser`, `deploy-to-cloudflare`
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy-to-cloudflare
|
|
3
|
+
description: Deploy a FrontMCP server to Cloudflare Workers with KV, D1, and Durable Objects
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploy a FrontMCP Server to Cloudflare Workers
|
|
7
|
+
|
|
8
|
+
This skill guides you through deploying a FrontMCP server to Cloudflare Workers.
|
|
9
|
+
|
|
10
|
+
<Warning>
|
|
11
|
+
Cloudflare Workers support is **experimental**. The Express-to-Workers adapter has limitations with streaming, certain middleware, and some response methods. For production Cloudflare deployments, consider using Hono or native Workers APIs.
|
|
12
|
+
</Warning>
|
|
13
|
+
|
|
14
|
+
## When to Use This Skill
|
|
15
|
+
|
|
16
|
+
### Must Use
|
|
17
|
+
|
|
18
|
+
- Deploying a FrontMCP server to Cloudflare Workers
|
|
19
|
+
- Configuring `wrangler.toml` for a FrontMCP project targeting Cloudflare
|
|
20
|
+
- Setting up Workers KV, D1, or Durable Objects storage for an MCP server on Cloudflare
|
|
21
|
+
|
|
22
|
+
### Recommended
|
|
23
|
+
|
|
24
|
+
- Evaluating serverless edge deployment options for low-latency MCP endpoints
|
|
25
|
+
- Migrating an existing Node.js MCP server to a Cloudflare Workers environment
|
|
26
|
+
- Adding a custom domain to a Cloudflare-hosted MCP server
|
|
27
|
+
|
|
28
|
+
### Skip When
|
|
29
|
+
|
|
30
|
+
- Deploying to a traditional Node.js server or Docker container -- use `build-for-cli` or `--target node`
|
|
31
|
+
- Building a browser-based MCP client -- use `build-for-browser`
|
|
32
|
+
- Embedding MCP tools in an existing app without HTTP -- use `build-for-sdk`
|
|
33
|
+
|
|
34
|
+
> **Decision:** Choose this skill when your deployment target is Cloudflare Workers; otherwise pick the skill that matches your runtime.
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
- A Cloudflare account (https://dash.cloudflare.com)
|
|
39
|
+
- Wrangler CLI installed: `npm install -g wrangler`
|
|
40
|
+
- A built FrontMCP project
|
|
41
|
+
|
|
42
|
+
## Step 1: Create a Cloudflare-targeted Project
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx frontmcp create my-app --target cloudflare
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This generates the project with a `wrangler.toml` and a deploy script (`npm run deploy` runs `wrangler deploy`).
|
|
49
|
+
|
|
50
|
+
## Step 2: Build for Cloudflare
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
frontmcp build --target cloudflare
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This produces:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
dist/
|
|
60
|
+
main.js # Your compiled server (CommonJS)
|
|
61
|
+
index.js # Cloudflare handler wrapper
|
|
62
|
+
wrangler.toml # Wrangler configuration
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Cloudflare Workers use CommonJS (not ESM). The build command sets `--module commonjs` automatically.
|
|
66
|
+
|
|
67
|
+
## Step 3: Configure wrangler.toml
|
|
68
|
+
|
|
69
|
+
The generated `wrangler.toml`:
|
|
70
|
+
|
|
71
|
+
```toml
|
|
72
|
+
name = "frontmcp-worker"
|
|
73
|
+
main = "dist/index.js"
|
|
74
|
+
compatibility_date = "2024-01-01"
|
|
75
|
+
|
|
76
|
+
[vars]
|
|
77
|
+
NODE_ENV = "production"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
To add KV storage for sessions and state:
|
|
81
|
+
|
|
82
|
+
```toml
|
|
83
|
+
name = "frontmcp-worker"
|
|
84
|
+
main = "dist/index.js"
|
|
85
|
+
compatibility_date = "2024-01-01"
|
|
86
|
+
|
|
87
|
+
[[kv_namespaces]]
|
|
88
|
+
binding = "FRONTMCP_KV"
|
|
89
|
+
id = "your-kv-namespace-id"
|
|
90
|
+
|
|
91
|
+
[vars]
|
|
92
|
+
NODE_ENV = "production"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Create the KV namespace via the dashboard or CLI:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
wrangler kv:namespace create FRONTMCP_KV
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Copy the returned `id` into your `wrangler.toml`.
|
|
102
|
+
|
|
103
|
+
## Step 4: Configure the Server
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { FrontMcp, App } from '@frontmcp/sdk';
|
|
107
|
+
|
|
108
|
+
@App({ name: 'MyApp' })
|
|
109
|
+
class MyApp {}
|
|
110
|
+
|
|
111
|
+
@FrontMcp({
|
|
112
|
+
info: { name: 'my-worker', version: '1.0.0' },
|
|
113
|
+
apps: [MyApp],
|
|
114
|
+
transport: {
|
|
115
|
+
type: 'sse',
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
class MyServer {}
|
|
119
|
+
|
|
120
|
+
export default MyServer;
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
For KV-backed session storage, use the Cloudflare KV or Upstash Redis provider.
|
|
124
|
+
|
|
125
|
+
## Step 5: Deploy
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Preview deployment
|
|
129
|
+
wrangler dev
|
|
130
|
+
|
|
131
|
+
# Production deployment
|
|
132
|
+
wrangler deploy
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Custom Domain
|
|
136
|
+
|
|
137
|
+
Configure a custom domain in the Cloudflare dashboard under **Workers & Pages > your worker > Settings > Domains & Routes**, or via wrangler:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
wrangler domains add mcp.example.com
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Step 6: Verify
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Health check
|
|
147
|
+
curl https://frontmcp-worker.your-subdomain.workers.dev/health
|
|
148
|
+
|
|
149
|
+
# Test MCP endpoint
|
|
150
|
+
curl -X POST https://frontmcp-worker.your-subdomain.workers.dev/mcp \
|
|
151
|
+
-H "Content-Type: application/json" \
|
|
152
|
+
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Workers Limitations
|
|
156
|
+
|
|
157
|
+
- **Bundle size**: Workers have a 1 MB compressed / 10 MB uncompressed limit (paid plan: 10 MB / 30 MB). Review dependencies and remove unused packages to reduce bundle size.
|
|
158
|
+
- **CPU time**: 10 ms CPU time on free plan, 30 seconds on paid. Long-running operations must be optimized or use Durable Objects.
|
|
159
|
+
- **No native modules**: `better-sqlite3` and other native Node.js modules are not available. Use KV, D1, or Upstash Redis for storage.
|
|
160
|
+
- **Streaming**: SSE streaming may have limitations through the Workers adapter. Test thoroughly.
|
|
161
|
+
|
|
162
|
+
## Storage Options
|
|
163
|
+
|
|
164
|
+
| Storage | Use Case | Notes |
|
|
165
|
+
| ------------- | ----------------------------- | --------------------------------- |
|
|
166
|
+
| Cloudflare KV | Simple key-value, low write | Eventually consistent, fast reads |
|
|
167
|
+
| Upstash Redis | Sessions, pub/sub, high write | Redis-compatible REST API |
|
|
168
|
+
| Cloudflare D1 | Relational data | SQLite-based, serverless |
|
|
169
|
+
|
|
170
|
+
## Troubleshooting
|
|
171
|
+
|
|
172
|
+
| Problem | Cause | Solution |
|
|
173
|
+
| ----------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------- |
|
|
174
|
+
| Worker exceeds size limit | Too many bundled dependencies | Review dependencies and remove unused packages to reduce bundle size |
|
|
175
|
+
| Module format errors | `wrangler.toml` sets `type = "module"` | Remove the `type` field; FrontMCP Cloudflare builds use CommonJS |
|
|
176
|
+
| KV binding errors | Namespace not created or binding name mismatch | Run `wrangler kv:namespace create` and copy the `id` into `wrangler.toml` |
|
|
177
|
+
| Timeout errors | CPU time exceeds plan limit | Upgrade plan or offload heavy computation to Durable Objects |
|
|
178
|
+
| CORS failures on MCP endpoint | Missing CORS headers in Worker response | Add CORS middleware or headers in your FrontMCP server configuration |
|
|
179
|
+
|
|
180
|
+
## Common Patterns
|
|
181
|
+
|
|
182
|
+
| Pattern | Correct | Incorrect | Why |
|
|
183
|
+
| ------------------ | ------------------------------------------- | --------------------------------- | -------------------------------------------------- |
|
|
184
|
+
| Module format | CommonJS (`main = "dist/index.js"`) | ESM (`type = "module"`) | FrontMCP Cloudflare builds emit CommonJS |
|
|
185
|
+
| Storage binding | `[[kv_namespaces]]` with matching `binding` | Hardcoded KV namespace ID in code | Bindings are injected at runtime by Workers |
|
|
186
|
+
| Compatibility date | Set to a recent, tested date | Omitting `compatibility_date` | Workers behavior changes across compat dates |
|
|
187
|
+
| Build command | `frontmcp build --target cloudflare` | `frontmcp build` (no target) | Default target is Node.js, not Workers |
|
|
188
|
+
| Secrets | `wrangler secret put MY_SECRET` | Storing secrets in `[vars]` | `[vars]` are visible in plaintext in the dashboard |
|
|
189
|
+
|
|
190
|
+
## Verification Checklist
|
|
191
|
+
|
|
192
|
+
**Build**
|
|
193
|
+
|
|
194
|
+
- [ ] `frontmcp build --target cloudflare` completes without errors
|
|
195
|
+
- [ ] Bundle size is within Cloudflare plan limits (free: 1 MB compressed)
|
|
196
|
+
|
|
197
|
+
**Configuration**
|
|
198
|
+
|
|
199
|
+
- [ ] `wrangler.toml` has correct `name`, `main`, and `compatibility_date`
|
|
200
|
+
- [ ] KV namespace IDs match between dashboard and `wrangler.toml`
|
|
201
|
+
- [ ] Secrets are stored via `wrangler secret put`, not in `[vars]`
|
|
202
|
+
|
|
203
|
+
**Deployment**
|
|
204
|
+
|
|
205
|
+
- [ ] `wrangler dev` serves the MCP endpoint locally
|
|
206
|
+
- [ ] `wrangler deploy` succeeds without errors
|
|
207
|
+
- [ ] Health endpoint responds with 200
|
|
208
|
+
|
|
209
|
+
**Runtime**
|
|
210
|
+
|
|
211
|
+
- [ ] `tools/list` JSON-RPC call returns expected tools
|
|
212
|
+
- [ ] SSE streaming works end-to-end (if using SSE transport)
|
|
213
|
+
- [ ] Custom domain resolves correctly (if configured)
|
|
214
|
+
|
|
215
|
+
## Reference
|
|
216
|
+
|
|
217
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/serverless>
|
|
218
|
+
- **Related skills:** `build-for-cli`, `build-for-browser`, `build-for-sdk`
|