funifier-mcp 0.2.4 → 0.2.7
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/.cursor/rules/funifier.mdc +2 -2
- package/.github/copilot-instructions.md +1 -1
- package/AGENTS.md +3 -3
- package/README.md +109 -190
- package/dist/cli/search.d.ts +2 -0
- package/dist/cli/search.d.ts.map +1 -0
- package/dist/cli/search.js +93 -0
- package/dist/cli/search.js.map +1 -0
- package/dist/core/lexical.d.ts +22 -0
- package/dist/core/lexical.d.ts.map +1 -0
- package/dist/core/lexical.js +79 -0
- package/dist/core/lexical.js.map +1 -0
- package/dist/mcp/bundle.js +76 -73
- package/dist/mcp/index.js +9 -3
- package/dist/mcp/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/funifier-create-action/SKILL.md +1 -1
- package/skills/funifier-create-aggregate/SKILL.md +1 -1
- package/skills/funifier-create-challenge/SKILL.md +1 -1
- package/skills/funifier-create-custom-page/SKILL.md +1 -1
- package/skills/funifier-create-leaderboard/SKILL.md +1 -1
- package/skills/funifier-create-level/SKILL.md +1 -1
- package/skills/funifier-create-point/SKILL.md +1 -1
- package/skills/funifier-create-quiz/SKILL.md +1 -1
- package/skills/funifier-create-scheduler/SKILL.md +1 -1
- package/skills/funifier-create-trigger/SKILL.md +1 -1
- package/skills/funifier-create-virtual-good/SKILL.md +1 -1
- package/skills/funifier-debug/SKILL.md +1 -1
- package/skills/funifier-help/SKILL.md +1 -1
- package/skills/funifier-implement-frontend/SKILL.md +1 -1
- package/skills/funifier-index/SKILL.md +1 -1
|
@@ -39,7 +39,7 @@ Source of truth: `datasource-funifier-docs/`
|
|
|
39
39
|
**Always search before reading:**
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npx
|
|
42
|
+
npx funifier-mcp search "<query>" --top 5 --min-score 0.3
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## Skill Workflows
|
|
@@ -86,6 +86,6 @@ Configure in `.mcp.json` — see `README.md`. Tools: `funifier_list` (always fil
|
|
|
86
86
|
|
|
87
87
|
## Rules
|
|
88
88
|
|
|
89
|
-
- Search docs with `search
|
|
89
|
+
- Search docs with `funifier-mcp search` before loading any file.
|
|
90
90
|
- Groovy scripts in Funifier: no `import` statements, use `manager` object for all platform APIs.
|
|
91
91
|
- Rebuild skills after doc changes: `npm run build:skills`.
|
|
@@ -29,7 +29,7 @@ Documentation source of truth: `datasource-funifier-docs/`
|
|
|
29
29
|
### Doc search (run in terminal before reading files)
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npx
|
|
32
|
+
npx funifier-mcp search "<query>" --top 5 --min-score 0.3
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Skill workflows
|
package/AGENTS.md
CHANGED
|
@@ -32,8 +32,8 @@ All Funifier documentation lives in `datasource-funifier-docs/`.
|
|
|
32
32
|
Use the lexical search CLI to find the most relevant files before reading them:
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
npx
|
|
36
|
-
npx
|
|
35
|
+
npx funifier-mcp search "<your question or task>"
|
|
36
|
+
npx funifier-mcp search "<query>" --skill <skill-id> --top 5 --min-score 0.3
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Only read files returned with score above the threshold. Avoid loading all docs at once.
|
|
@@ -91,7 +91,7 @@ To get detailed workflow guidance for any skill, read the corresponding `skills/
|
|
|
91
91
|
|
|
92
92
|
## Key Rules
|
|
93
93
|
|
|
94
|
-
- **Search before reading**: always run `search
|
|
94
|
+
- **Search before reading**: always run `funifier-mcp search` first, then read only the top results.
|
|
95
95
|
- **Never list all MCP resources** without a `search` parameter — always filter.
|
|
96
96
|
- **Docs are authoritative for patterns**: never infer patterns from existing live resources.
|
|
97
97
|
- **Run `npm run build:skills`** after editing any file in `datasource-funifier-docs/`.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# funifier-mcp
|
|
2
2
|
|
|
3
3
|
Funifier AI toolkit — API client, MCP server, and AI assistant skills for the [Funifier](https://funifier.com) gamification platform.
|
|
4
4
|
|
|
@@ -7,116 +7,57 @@ Funifier AI toolkit — API client, MCP server, and AI assistant skills for the
|
|
|
7
7
|
| Component | Description |
|
|
8
8
|
|-----------|-------------|
|
|
9
9
|
| **API Client** | Pure Node.js client for the Funifier REST API (80+ methods, 18 resource types) |
|
|
10
|
-
| **MCP Server** | Model Context Protocol server
|
|
11
|
-
| **Skills** | 15 guided workflows for Claude Code, Codex, Copilot, Continue, and Cursor |
|
|
12
|
-
| **
|
|
10
|
+
| **MCP Server** | Model Context Protocol server — 8 tools, 3 prompts, documentation resources |
|
|
11
|
+
| **Skills** | 15 guided workflows for Claude Code, Codex, OpenCode, Copilot, Continue, and Cursor |
|
|
12
|
+
| **CLI** | `npx funifier-mcp@latest init` (interactive setup) and `npx funifier-mcp search` (doc search) |
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
1. **Install:**
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @funifier-ai
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
2. **Choose your platform** and follow setup instructions:
|
|
23
|
-
|
|
24
|
-
- [Claude Code](#claude-code) — Claude's official IDE and CLI
|
|
25
|
-
- [Codex CLI](#codex-cli-and-opencode) — Codex command-line agent
|
|
26
|
-
- [OpenCode](#codex-cli-and-opencode) — Open-source agent framework
|
|
27
|
-
- [GitHub Copilot](#github-copilot) — VS Code, JetBrains, GitHub.com
|
|
28
|
-
- [Continue IDE](#continue-ide) — Open-source IDE extension
|
|
29
|
-
- [Cursor IDE](#cursor-ide) — AI-native code editor
|
|
30
|
-
|
|
31
|
-
For detailed setup instructions, see:
|
|
32
|
-
- **[docs/INSTALL_EXAMPLES.md](docs/INSTALL_EXAMPLES.md)** — Real-world examples
|
|
33
|
-
- **[docs/PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md)** — Full platform guide
|
|
34
|
-
- **[docs/](docs/)** — Complete documentation index
|
|
35
|
-
|
|
36
|
-
## Installation
|
|
37
|
-
|
|
38
|
-
### From npm (published)
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm install @funifier-ai
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Local development (before publishing)
|
|
45
|
-
|
|
46
|
-
**Automated setup (recommended):**
|
|
14
|
+
---
|
|
47
15
|
|
|
48
|
-
|
|
16
|
+
## Quick Start
|
|
49
17
|
|
|
50
18
|
```bash
|
|
51
|
-
|
|
52
|
-
# or relative path:
|
|
53
|
-
node scripts/install-local.js ../my-project
|
|
54
|
-
# or install in current directory:
|
|
55
|
-
node scripts/install-local.js
|
|
19
|
+
npx funifier-mcp@latest init
|
|
56
20
|
```
|
|
57
21
|
|
|
58
|
-
|
|
59
|
-
1. Ask which platforms you're using (Claude Code, Codex, OpenCode, Copilot, Cursor, or all/none)
|
|
60
|
-
2. Build Funifier AI
|
|
61
|
-
3. Create npm link
|
|
62
|
-
4. Copy only the files you need for your selected platforms
|
|
22
|
+
One command — no install required. `init` is interactive: it asks which AI platforms you use (Claude Code, Codex CLI, OpenCode, Cursor, Copilot, Google Antigravity), prompts for your Funifier credentials, and writes all config files automatically (skills, MCP config, `funifier.json`).
|
|
63
23
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
**Manual setup:**
|
|
24
|
+
---
|
|
67
25
|
|
|
68
|
-
|
|
69
|
-
# In funifier-ai directory
|
|
70
|
-
npm run build && npm run bundle && npm link
|
|
26
|
+
## CLI Reference
|
|
71
27
|
|
|
72
|
-
# In your project
|
|
73
|
-
npm link @funifier-ai
|
|
74
28
|
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
npm install /path/to/funifier-ai
|
|
80
|
-
# or
|
|
81
|
-
npm install file:../funifier-ai
|
|
29
|
+
npx funifier-mcp@latest init Interactive setup for AI platforms
|
|
30
|
+
npx funifier-mcp search "<query>" Search Funifier documentation
|
|
31
|
+
funifier-mcp Start the MCP server (stdio)
|
|
32
|
+
funifier-mcp --version Print version
|
|
82
33
|
```
|
|
83
34
|
|
|
84
|
-
|
|
35
|
+
### `funifier-mcp search`
|
|
85
36
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
After local installation, verify everything is working:
|
|
37
|
+
Lexical search across all Funifier docs — returns ranked file paths so you only read what's relevant:
|
|
89
38
|
|
|
90
39
|
```bash
|
|
91
|
-
|
|
92
|
-
|
|
40
|
+
npx funifier-mcp search "trigger event groovy before_create"
|
|
41
|
+
npx funifier-mcp search "quiz question answer" --skill funifier-create-quiz
|
|
42
|
+
npx funifier-mcp search "leaderboard ranking" --top 5 --min-score 0.3
|
|
93
43
|
```
|
|
94
44
|
|
|
95
|
-
|
|
96
|
-
- ✓ Symlink is set up correctly
|
|
97
|
-
- ✓ Built files exist (dist/)
|
|
98
|
-
- ✓ Instruction files copied
|
|
99
|
-
- ✓ Can import the package
|
|
100
|
-
- ✓ API client works (if credentials set)
|
|
101
|
-
|
|
102
|
-
For detailed information on how local testing works, see [docs/LOCAL_TESTING.md](docs/LOCAL_TESTING.md).
|
|
103
|
-
|
|
104
|
-
If any check fails, see [docs/MCP_SETUP.md](docs/MCP_SETUP.md) for troubleshooting.
|
|
45
|
+
Flags: `--top N` (max results, default 3), `--skill <id>` (boosts skill's primary docs), `--min-score N` (threshold, default 0.5).
|
|
105
46
|
|
|
106
47
|
---
|
|
107
48
|
|
|
108
49
|
## MCP Server Setup
|
|
109
50
|
|
|
110
|
-
|
|
51
|
+
The MCP server exposes Funifier as tools in any MCP-compatible AI client. `npx funifier-mcp@latest init` configures it automatically. For manual setup, install the package first (`npm install funifier-mcp`) then configure your client:
|
|
111
52
|
|
|
112
|
-
|
|
53
|
+
### Claude Code / Cursor / Antigravity (`.mcp.json`)
|
|
113
54
|
|
|
114
55
|
```json
|
|
115
56
|
{
|
|
116
57
|
"mcpServers": {
|
|
117
58
|
"funifier": {
|
|
118
59
|
"command": "node",
|
|
119
|
-
"args": ["node_modules
|
|
60
|
+
"args": ["/absolute/path/to/node_modules/funifier-mcp/dist/mcp/bundle.js"],
|
|
120
61
|
"env": {
|
|
121
62
|
"FUNIFIER_API_KEY": "your-api-key",
|
|
122
63
|
"FUNIFIER_SECRET_KEY": "your-secret-key",
|
|
@@ -127,25 +68,29 @@ Add to your `.mcp.json` (project or global `~/.claude/.mcp.json`):
|
|
|
127
68
|
}
|
|
128
69
|
```
|
|
129
70
|
|
|
130
|
-
|
|
71
|
+
### Codex CLI (`.codex/config.toml`)
|
|
131
72
|
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
73
|
+
```toml
|
|
74
|
+
[mcp_servers.funifier]
|
|
75
|
+
command = "node"
|
|
76
|
+
args = ["/absolute/path/to/node_modules/funifier-mcp/dist/mcp/bundle.js"]
|
|
77
|
+
enabled = true
|
|
78
|
+
|
|
79
|
+
[mcp_servers.funifier.env]
|
|
80
|
+
FUNIFIER_API_KEY = "your-api-key"
|
|
81
|
+
FUNIFIER_SECRET_KEY = "your-secret-key"
|
|
82
|
+
FUNIFIER_SERVER_URL = "https://your-instance.funifier.com"
|
|
138
83
|
```
|
|
139
84
|
|
|
140
|
-
###
|
|
85
|
+
### OpenCode (`opencode.json`)
|
|
141
86
|
|
|
142
87
|
```json
|
|
143
88
|
{
|
|
144
|
-
"
|
|
89
|
+
"mcp": {
|
|
145
90
|
"funifier": {
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
91
|
+
"type": "local",
|
|
92
|
+
"command": ["node", "/absolute/path/to/node_modules/funifier-mcp/dist/mcp/bundle.js"],
|
|
93
|
+
"environment": {
|
|
149
94
|
"FUNIFIER_API_KEY": "your-api-key",
|
|
150
95
|
"FUNIFIER_SECRET_KEY": "your-secret-key",
|
|
151
96
|
"FUNIFIER_SERVER_URL": "https://your-instance.funifier.com"
|
|
@@ -163,6 +108,22 @@ If no config is provided at startup, use the `funifier_connect` tool to connect:
|
|
|
163
108
|
funifier_connect({ apiKey: "...", secretKey: "...", serverUrl: "https://..." })
|
|
164
109
|
```
|
|
165
110
|
|
|
111
|
+
### Credentials via `funifier.json`
|
|
112
|
+
|
|
113
|
+
Place in your project root for automatic connection at startup:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"apiKey": "your-api-key",
|
|
118
|
+
"secretKey": "your-secret-key",
|
|
119
|
+
"serverUrl": "https://your-instance.funifier.com"
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Add `funifier.json` to `.gitignore` — it contains secrets.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
166
127
|
## MCP Tools
|
|
167
128
|
|
|
168
129
|
| Tool | Description |
|
|
@@ -176,44 +137,22 @@ funifier_connect({ apiKey: "...", secretKey: "...", serverUrl: "https://..." })
|
|
|
176
137
|
| `funifier_logs` | Get execution logs for triggers and schedulers |
|
|
177
138
|
| `funifier_database` | Query, aggregate, insert, update, delete on any collection |
|
|
178
139
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
trigger, scheduler, aggregate, websocket, widget, custom-page, public-endpoint, challenge-aggregate, auth-module, ai-knowledge, action, challenge, point, level, leaderboard, quiz, virtual-good-catalog, virtual-good-item
|
|
182
|
-
|
|
183
|
-
## API Client (library usage)
|
|
184
|
-
|
|
185
|
-
```typescript
|
|
186
|
-
import { createAPIClient } from "@funifier-ai";
|
|
187
|
-
|
|
188
|
-
const api = createAPIClient({
|
|
189
|
-
apiKey: "your-api-key",
|
|
190
|
-
secretKey: "your-secret-key",
|
|
191
|
-
serverUrl: "https://your-instance.funifier.com",
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// List all triggers
|
|
195
|
-
const triggers = await api.listTriggers();
|
|
196
|
-
|
|
197
|
-
// Execute an aggregate
|
|
198
|
-
const result = await api.executeAggregate("my-aggregate-id", {});
|
|
140
|
+
**Resource types:** trigger, scheduler, aggregate, websocket, widget, custom-page, public-endpoint, challenge-aggregate, auth-module, ai-knowledge, action, challenge, point, level, leaderboard, quiz, virtual-good-catalog, virtual-good-item
|
|
199
141
|
|
|
200
|
-
|
|
201
|
-
const players = await api.queryCollection("player", { active: true }, { limit: 10 });
|
|
202
|
-
```
|
|
142
|
+
---
|
|
203
143
|
|
|
204
144
|
## Skills and Instructions
|
|
205
145
|
|
|
206
|
-
|
|
146
|
+
`npx funifier-mcp@latest init` copies the right files for each platform automatically. For manual setup, install first (`npm install funifier-mcp`) then copy:
|
|
207
147
|
|
|
208
148
|
### Claude Code
|
|
209
149
|
|
|
210
|
-
Install skills to your project:
|
|
211
|
-
|
|
212
150
|
```bash
|
|
213
|
-
|
|
151
|
+
npm install funifier-mcp
|
|
152
|
+
cp -r node_modules/funifier-mcp/skills/* .claude/skills/
|
|
214
153
|
```
|
|
215
154
|
|
|
216
|
-
Invoke any skill with `/funifier-<name
|
|
155
|
+
Invoke any skill with `/funifier-<name>` in Claude Code:
|
|
217
156
|
|
|
218
157
|
```
|
|
219
158
|
/funifier-create-trigger
|
|
@@ -221,105 +160,82 @@ Invoke any skill with `/funifier-<name>`:
|
|
|
221
160
|
/funifier-help
|
|
222
161
|
```
|
|
223
162
|
|
|
224
|
-
### Codex CLI
|
|
225
|
-
|
|
226
|
-
The generated `AGENTS.md` file provides instructions for Codex, OpenCode, and any agent that reads AGENTS.md.
|
|
227
|
-
|
|
228
|
-
**Codex CLI:**
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
cp node_modules/@funifier-ai/AGENTS.md .
|
|
232
|
-
codex "Create a trigger for player registration"
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
**OpenCode:**
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
cp node_modules/@funifier-ai/AGENTS.md .
|
|
239
|
-
# Add to .opencode.json:
|
|
240
|
-
# { "instructions": { "file": "./AGENTS.md" } }
|
|
241
|
-
opencode "Debug my scheduler"
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
See [PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md) for full configuration details.
|
|
245
|
-
|
|
246
|
-
### GitHub Copilot
|
|
163
|
+
### Codex CLI / OpenCode
|
|
247
164
|
|
|
248
165
|
```bash
|
|
249
|
-
|
|
250
|
-
cp node_modules
|
|
166
|
+
npm install funifier-mcp
|
|
167
|
+
cp node_modules/funifier-mcp/AGENTS.md .
|
|
251
168
|
```
|
|
252
169
|
|
|
253
|
-
|
|
170
|
+
The `AGENTS.md` is the entry point for Codex, OpenCode, and any agent that reads AGENTS.md.
|
|
254
171
|
|
|
255
|
-
### Continue
|
|
172
|
+
### GitHub Copilot / Continue
|
|
256
173
|
|
|
257
174
|
```bash
|
|
175
|
+
npm install funifier-mcp
|
|
258
176
|
mkdir -p .github
|
|
259
|
-
cp node_modules
|
|
260
|
-
# Configure ~/.continue/config.json with customInstructions and MCP
|
|
177
|
+
cp node_modules/funifier-mcp/.github/copilot-instructions.md .github/
|
|
261
178
|
```
|
|
262
179
|
|
|
263
|
-
|
|
180
|
+
Copilot and Continue automatically apply `.github/copilot-instructions.md`.
|
|
264
181
|
|
|
265
182
|
### Cursor IDE
|
|
266
183
|
|
|
267
184
|
```bash
|
|
185
|
+
npm install funifier-mcp
|
|
268
186
|
mkdir -p .cursor/rules
|
|
269
|
-
cp node_modules
|
|
187
|
+
cp node_modules/funifier-mcp/.cursor/rules/funifier.mdc .cursor/rules/
|
|
270
188
|
```
|
|
271
189
|
|
|
272
|
-
Cursor
|
|
190
|
+
Cursor discovers and applies `.mdc` files in `.cursor/rules/` automatically.
|
|
273
191
|
|
|
274
192
|
---
|
|
275
193
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
Each platform above provides access to these guided workflows:
|
|
194
|
+
## Available Workflows
|
|
279
195
|
|
|
280
196
|
| Skill | Description |
|
|
281
197
|
|-------|-------------|
|
|
282
198
|
| `funifier-help` | Documentation router and guidance |
|
|
283
199
|
| `funifier-debug` | Systematic debugging workflow |
|
|
284
|
-
| `funifier-create-trigger` | Create server-side event handlers |
|
|
200
|
+
| `funifier-create-trigger` | Create server-side event handlers (Groovy) |
|
|
285
201
|
| `funifier-create-scheduler` | Create scheduled Groovy jobs |
|
|
286
202
|
| `funifier-create-aggregate` | Create MongoDB aggregate pipelines |
|
|
287
|
-
| `funifier-create-custom-page` | Create Studio admin pages |
|
|
203
|
+
| `funifier-create-custom-page` | Create Studio admin pages (AngularJS) |
|
|
288
204
|
| `funifier-create-action` | Create trackable player actions |
|
|
289
205
|
| `funifier-create-challenge` | Create missions with rewards |
|
|
290
206
|
| `funifier-create-point` | Create point categories |
|
|
291
207
|
| `funifier-create-level` | Create level progression |
|
|
292
208
|
| `funifier-create-leaderboard` | Create rankings |
|
|
293
209
|
| `funifier-create-quiz` | Create quizzes |
|
|
294
|
-
| `funifier-create-virtual-good` | Create virtual
|
|
210
|
+
| `funifier-create-virtual-good` | Create virtual store items |
|
|
295
211
|
| `funifier-implement-frontend` | Build frontend consuming Funifier API |
|
|
296
212
|
|
|
297
|
-
|
|
213
|
+
---
|
|
298
214
|
|
|
299
|
-
|
|
215
|
+
## API Client
|
|
300
216
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
| `AGENTS.md` | Codex, OpenCode | Agent routing, MCP tools, and skill index |
|
|
305
|
-
| `.github/copilot-instructions.md` | Copilot, Continue | Code quality standards and skill routing |
|
|
306
|
-
| `.cursor/rules/funifier.mdc` | Cursor | Development rules with YAML frontmatter |
|
|
217
|
+
```bash
|
|
218
|
+
npm install funifier-mcp
|
|
219
|
+
```
|
|
307
220
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
- **Skill routing** (which skill to use for each task)
|
|
311
|
-
- **MCP tool reference** (if server is configured)
|
|
312
|
-
- **Lexical search command** (to find relevant docs efficiently)
|
|
221
|
+
```typescript
|
|
222
|
+
import { createAPIClient } from "funifier-mcp";
|
|
313
223
|
|
|
314
|
-
|
|
224
|
+
const api = createAPIClient({
|
|
225
|
+
apiKey: "your-api-key",
|
|
226
|
+
secretKey: "your-secret-key",
|
|
227
|
+
serverUrl: "https://your-instance.funifier.com",
|
|
228
|
+
});
|
|
315
229
|
|
|
316
|
-
|
|
230
|
+
// List resources
|
|
231
|
+
const triggers = await api.listTriggers();
|
|
317
232
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
233
|
+
// Execute an aggregate
|
|
234
|
+
const result = await api.executeAggregate("my-aggregate-id", {});
|
|
235
|
+
|
|
236
|
+
// Query any collection
|
|
237
|
+
const players = await api.queryCollection("player", { active: true }, { limit: 10 });
|
|
238
|
+
```
|
|
323
239
|
|
|
324
240
|
---
|
|
325
241
|
|
|
@@ -332,19 +248,22 @@ All files embed:
|
|
|
332
248
|
| `FUNIFIER_API_KEY` | API key for authentication |
|
|
333
249
|
| `FUNIFIER_SECRET_KEY` | Secret key for authentication |
|
|
334
250
|
| `FUNIFIER_SERVER_URL` | Base URL of your Funifier instance |
|
|
335
|
-
| `FUNIFIER_DOCS_PATH` | Path to documentation files (optional) |
|
|
251
|
+
| `FUNIFIER_DOCS_PATH` | Path to documentation files (optional override) |
|
|
336
252
|
|
|
337
|
-
###
|
|
253
|
+
### Config resolution order
|
|
338
254
|
|
|
339
|
-
|
|
255
|
+
`funifier.json` in cwd → environment variables.
|
|
340
256
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Documentation
|
|
260
|
+
|
|
261
|
+
- **[docs/PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md)** — Detailed setup for all platforms
|
|
262
|
+
- **[docs/QUICK_REFERENCE.md](docs/QUICK_REFERENCE.md)** — Copy-paste setup commands
|
|
263
|
+
- **[docs/INSTALL_EXAMPLES.md](docs/INSTALL_EXAMPLES.md)** — Real-world scenarios
|
|
264
|
+
- **[docs/MCP_SETUP.md](docs/MCP_SETUP.md)** — MCP configuration and troubleshooting
|
|
265
|
+
|
|
266
|
+
---
|
|
348
267
|
|
|
349
268
|
## License
|
|
350
269
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/cli/search.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,OAAO,UAAU,IAAI,IAAI,IAAI,CA0CnC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.default = main;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const lexical_1 = require("../core/lexical");
|
|
40
|
+
const paths_1 = require("./paths");
|
|
41
|
+
function parseArgs(argv) {
|
|
42
|
+
const args = argv.slice(3); // skip node, script, "search"
|
|
43
|
+
const query = args.find(a => !a.startsWith("--")) ?? "";
|
|
44
|
+
const getFlag = (name) => {
|
|
45
|
+
const eqForm = args.find(a => a.startsWith(`--${name}=`))?.split("=").slice(1).join("=");
|
|
46
|
+
if (eqForm !== undefined)
|
|
47
|
+
return eqForm;
|
|
48
|
+
const idx = args.indexOf(`--${name}`);
|
|
49
|
+
return idx >= 0 ? args[idx + 1] : undefined;
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
query,
|
|
53
|
+
top: getFlag("top") ? parseInt(getFlag("top"), 10) : 3,
|
|
54
|
+
skillId: getFlag("skill"),
|
|
55
|
+
minScore: getFlag("min-score") ? parseFloat(getFlag("min-score")) : 0.5,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function main() {
|
|
59
|
+
const { query, top, skillId, minScore } = parseArgs(process.argv);
|
|
60
|
+
if (!query) {
|
|
61
|
+
console.error('Usage: funifier-mcp search "<query>" [--top N] [--skill <id>] [--min-score N]');
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
const pkgRoot = (0, paths_1.resolvePackageRoot)();
|
|
65
|
+
const indexFile = path.join(pkgRoot, "datasource-funifier-docs", ".search-index.json");
|
|
66
|
+
const skillsMapFile = path.join(pkgRoot, "datasource-funifier-docs", ".skills-map.json");
|
|
67
|
+
if (!fs.existsSync(indexFile)) {
|
|
68
|
+
console.error("ERROR: .search-index.json not found. Run `npm run build:skills` first.");
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
const index = JSON.parse(fs.readFileSync(indexFile, "utf-8"));
|
|
72
|
+
let skillDocs = [];
|
|
73
|
+
if (skillId && fs.existsSync(skillsMapFile)) {
|
|
74
|
+
const skillsMap = JSON.parse(fs.readFileSync(skillsMapFile, "utf-8"));
|
|
75
|
+
skillDocs = skillsMap[skillId] ?? [];
|
|
76
|
+
}
|
|
77
|
+
const results = (0, lexical_1.scoreFiles)(query, index, { skillDocs, minScore, top });
|
|
78
|
+
const separator = "─".repeat(53);
|
|
79
|
+
console.log(`\nSEARCH: "${query}"`);
|
|
80
|
+
console.log(separator);
|
|
81
|
+
if (results.length === 0) {
|
|
82
|
+
console.log("No results above score threshold.");
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
results.forEach((r, i) => {
|
|
86
|
+
const filePath = `datasource-funifier-docs/${r.file}`;
|
|
87
|
+
console.log(`${i + 1}. ${filePath.padEnd(60)} [score: ${r.score.toFixed(2)}]`);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
console.log(separator);
|
|
91
|
+
console.log(`Read files with score > ${minScore}. Skip others.\n`);
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/cli/search.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,uBA0CC;AAlED,uCAAyB;AACzB,2CAA6B;AAC7B,6CAA+D;AAC/D,mCAA6C;AAE7C,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B;IAC1D,MAAM,KAAK,GAA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QACzB,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,4BAA4B,CAAC,CAAC,IAAI,EAAE,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,2BAA2B,QAAQ,kBAAkB,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function tokenize(text: string): string[];
|
|
2
|
+
export interface FileEntry {
|
|
3
|
+
tokens: Record<string, number>;
|
|
4
|
+
headings: string[];
|
|
5
|
+
totalTokens: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SearchIndex {
|
|
8
|
+
files: Record<string, FileEntry>;
|
|
9
|
+
idf: Record<string, number>;
|
|
10
|
+
}
|
|
11
|
+
export interface SearchResult {
|
|
12
|
+
file: string;
|
|
13
|
+
score: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildIndex(files: Map<string, string>): SearchIndex;
|
|
16
|
+
export interface ScoreOptions {
|
|
17
|
+
skillDocs?: string[];
|
|
18
|
+
minScore?: number;
|
|
19
|
+
top?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function scoreFiles(query: string, index: SearchIndex, options?: ScoreOptions): SearchResult[];
|
|
22
|
+
//# sourceMappingURL=lexical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical.d.ts","sourceRoot":"","sources":["../../src/core/lexical.ts"],"names":[],"mappings":"AAeA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAK/C;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW,CAmClE;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,YAAiB,GACzB,YAAY,EAAE,CA6BhB"}
|