microfn
2
总安装量
2
周安装量
#66122
全站排名
安装命令
npx skills add https://github.com/microfnhq/skills --skill microfn
Agent 安装分布
opencode
2
antigravity
2
claude-code
2
github-copilot
2
roo
2
codex
2
Skill 文档
MicroFn CLI Skill
Use this skill when interacting with the MicroFn platform through the installed CLI commands (microfn or mfn).
What MicroFn is
MicroFn is a cloud platform for sandboxed JavaScript functions. Use it to run focused JavaScript snippets as deployed functions. Functions can power app behavior and can also be enabled as tools for agent workflows.
Install and authenticate
- Install globally with
npm install -g microfn. - Use either command:
microfnormfn. - Create an API key at
https://microfn.dev/users/settings/api. - Pass auth with
--token mfn_xxxorMICROFN_API_TOKEN.
Core workflows
List functions
Run microfn list (or mfn list) to inspect available functions.
Deploy a new function
- From file:
microfn create <name> <path-to-file>. - From stdin:
cat file.ts | microfn create <name> -.
Update function code
- From file:
microfn push <owner/name> <path-to-file>. - From stdin:
cat file.ts | microfn push <owner/name> -.
Inspect function details
Use:
microfn info <owner/name>microfn code <owner/name>
Execute a function
- Inline payload:
microfn execute <owner/name> '{"key":"value"}'. - Stdin payload:
echo '{"key":"value"}' | microfn execute <owner/name> -. - Include logs when needed: add
--include-logs.
Work with tool-enabled functions
- Check
microfn info <owner/name>for MCP tool status. - Keep function signatures stable when functions are consumed as tools.
Function source contract (important)
When writing code for create or push, follow the CLI contract used in command help:
- Export exactly one entrypoint function style.
- Prefer
export async function main(input) { ... }. - If
mainis not exported, export exactly one named function; it will be auto-wrapped asmain(). - The function should accept the execution input object and return a JSON-serializable value.
- Sync and async functions are both valid.
- Use default imports for
@microfn/*packages. - Do not use named imports for
@microfn/*.
Valid examples:
export async function main(input) {
const { name = "world" } = input || {};
return { greeting: `hello ${name}` };
}
export async function greet(payload) {
return { greeting: `hello ${payload?.name || "world"}` };
}
import kv from "@microfn/kv";
import secret from "@microfn/secret";
export async function main() {
const apiKey = await secret.get("API_KEY");
const count = (await kv.get("count")) || 0;
await kv.set("count", count + 1);
return { apiKeyPresent: !!apiKey, count: count + 1 };
}
Invalid import pattern:
import { kv } from "@microfn/kv";
Output and troubleshooting
- Use
--output jsonfor scriptable output. - Use
--debugfor verbose request/response diagnostics.
Delivery checklist
- Show examples with
microfn(notemfnis equivalent). - Keep command examples reproducible and copy-paste ready.
- Preserve the product model: sandboxed JavaScript functions that can also be used as tools.