mcpField
A
Anythink all-in-one backend: data, auth, files, workflows, payments, APIs

Anythink all-in-one backend: data, auth, files, workflows, payments, APIs

远程服务
anythink.cloud云与基础设施62 周前更新

关于 Anythink all-in-one backend: data, auth, files, workflows, payments, APIs

Anythink CLI 是 Anythink 后端平台的命令行工具,供开发者和创业者管理项目、数据及后端功能。它支持从实体和字段配置到记录导入导出,并与配套 MCP 服务一同发布。

主要功能

  1. 01管理账户、项目和配置
  2. 02创建实体并设置字段
  3. 03增删改查数据记录
  4. 04以 CSV、JSON 或 JSONL 导入导出
  5. 05管理工作流、用户和文件

适用场景

  1. 01在终端创建并切换后端项目
  2. 02配置数据库实体和字段
  3. 03批量导入或导出项目记录

MCP 相关

安装包同时提供 anythink-mcp MCP 服务。该服务的具体工具和暴露能力在所给 README 内容中未说明。

配置

远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。

服务地址https://mcp.anythink.cloud/mcp
一键复制安装命令
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。

安装包
nugetanythink-mcp0.2.37

工具

详细介绍

Anythink

Anythink CLI

Anythink 官方命令行界面——面向开发者和创始人的无头后端平台。无需离开终端,即可管理项目、实体、数据、工作流、用户、文件和支付。

NuGet Release Homebrew MCP Registry License: MIT

   ░███                             ░██    ░██        ░██           ░██
  ░██░██                            ░██    ░██                      ░██
 ░██  ░██  ░████████  ░██    ░██ ░████████ ░████████  ░██░████████  ░██    ░██
░█████████ ░██    ░██ ░██    ░██    ░██    ░██    ░██ ░██░██    ░██ ░██   ░██
░██    ░██ ░██    ░██ ░██    ░██    ░██    ░██    ░██ ░██░██    ░██ ░███████
░██    ░██ ░██    ░██ ░██   ░███    ░██    ░██    ░██ ░██░██    ░██ ░██   ░██
░██    ░██ ░██    ░██  ░█████░██     ░████ ░██    ░██ ░██░██    ░██ ░██    ░██
                             ░██
                       ░███████

目录


安装

anythink CLI 和 anythink-mcp 服务一同发布。要同时安装这两者,最快捷的方式是使用 Homebrew。

Homebrew(macOS / Linux)——推荐
brew install anythink-cloud/tap/anythink

这会将两个命令都安装到你的 PATH 中:

  • anythink — CLI
  • anythink-mcp — MCP 服务(参见 MCP 服务)

也可以先添加 tap,再安装:

brew tap anythink-cloud/tap
brew install anythink

更新到最新版本:

brew upgrade anythink

卸载:

brew uninstall anythink
macOS / Linux — 下载二进制文件

从 Releases 页面下载适用于你平台的最新版本:

平台二进制文件
macOS(Apple Silicon)anythink-osx-arm64
macOS(Intel)anythink-osx-x64
Linux(x86_64)anythink-linux-x64
Linux(ARM64)anythink-linux-arm64
# Example — macOS Apple Silicon
curl -Lo anythink https://github.com/anythink-cloud/anythink-cli/releases/latest/download/anythink-osx-arm64
chmod +x anythink
sudo mv anythink /usr/local/bin/

MCP 服务会在同一版本中提供匹配的 anythink-mcp-<platform> 二进制文件——按相同方式下载并安装(例如 anythink-mcp-osx-arm64)。

请使用发布资源中的 checksums.txt 校验下载文件:

sha256sum -c checksums.txt --ignore-missing
.NET 全局工具

如果已安装 .NET 8 SDK:

dotnet tool install --global anythink-cli
从源代码构建
git clone https://github.com/anythink-cloud/anythink-cli
cd anythink-cli
dotnet build
dotnet run --project src/AnythinkCli.csproj -- --help

快速开始

# 1. Create an account (or log in if you already have one)
anythink signup

# 2. Create a billing account
anythink accounts create --name "My Company"

# 3. Create a project
anythink projects create "My App" --region lon1

# 4. Connect to the project
anythink projects use <project-id>

# 5. Start building
anythink entities list
anythink workflows list

你的凭据和项目配置文件存储在 ~/.anythink/config.json 中。运行 projects use 即可在多个项目之间切换。


命令参考

signup / login / logout
anythink signup                        Create a new Anythink account
anythink login                         Log in to the platform
anythink logout                        Remove saved credentials for a project profile

signup 和 login 均为交互式命令——它们会提示你输入电子邮件和密码,并在首次运行时引导你连接计费账户和项目。


accounts

管理计费账户。计费账户是一个或多个项目的容器,其中保存了你的订阅和支付详情。

anythink accounts list                 List your billing accounts
anythink accounts create               Create a new billing account
anythink accounts use <id>             Set the active billing account

示例

anythink accounts create --name "Acme Ltd" --email [email protected]
anythink accounts use a1b2c3d4

projects

创建和管理 Anythink 项目。每个项目都是一个隔离的后端实例,拥有自己的数据库、身份验证、文件和工作流。

anythink projects list                 List projects in the active billing account
anythink projects create <name>        Create a new project
anythink projects use <id>             Connect to a project (sets it as the active profile)
anythink projects delete <id>          Delete a project

选项 — projects create

标志描述
--region <id>部署区域(例如 lon1)
--plan <id>方案 ID(参见 anythink plans)

示例

anythink projects create "My App" --region lon1
anythink projects use a1b2c3d4
anythink projects delete a1b2c3d4 --yes

config

查看和管理已保存的 CLI 配置文件。

anythink config show                   List all profiles and platform settings
anythink config use <profile>          Set the active project profile
anythink config remove <profile>       Remove a profile

配置文件以项目别名或 ID 命名,并存储在 ~/.anythink/config.json 中。


entities

管理当前项目中的实体(数据库表)。

anythink entities list                 List all entities
anythink entities get <name>           Get entity details and fields
anythink entities create <name>        Create a new entity
anythink entities update <name>        Update entity settings
anythink entities delete <name>        Delete an entity and all its data

选项 — entities create

标志描述
--rls启用行级安全
--public将实体设为公开可读
--lock锁定新记录(阻止直接创建)
--junction将实体标记为联结(多对多)表

示例

anythink entities create orders --rls
anythink entities get customers
anythink entities delete temp_data --yes

fields

管理实体中的字段。字段直接映射到数据库列。

anythink fields list <entity>          List fields on an entity
anythink fields add <entity> <name>    Add a field
anythink fields delete <entity> <id>   Delete a field

选项 — fields add

标志描述
--type <type>字段类型:varchar、text、int、float、bool、datetime、json、uuid
--required将字段标记为必填
--unique强制执行唯一性约束
--indexed添加数据库索引
--default <value>默认值

示例

anythink fields list customers
anythink fields add customers email --type varchar --unique --required
anythink fields add products price --type float --required
anythink fields delete customers 1234 --yes

data

对实体记录执行 CRUD 操作。

anythink data list <entity>            List records
anythink data get <entity> <id>        Get a single record by ID
anythink data create <entity>          Create a new record
anythink data update <entity> <id>     Update a record
anythink data delete <entity> <id>     Delete a record
anythink data export <entity> <file>   Export records to CSV, JSON or JSONL
anythink data import <entity> <file>   Create records from CSV, JSON or JSONL

选项 — data list

标志描述
--limit <n>每页记录数(默认值:20)
--page <n>页码(默认值:1)
--filter <expr>字段筛选器 — JSON({"status":"draft","total":{"gte":10}})或 field=value 键值对(status=draft&total=GTE:10)。见下文。
--json输出原始 JSON,而非表格
--all将所有页面作为连续的 JSON 对象流式输出(需要 --json,内存占用恒定)

筛选运算符(JSON 格式) — {"field": value} 表示精确匹配,{"field": [a, b]} 表示匹配任意值,{"field": null} 表示匹配空值。其他情况请使用运算符对象,例如 {"price": {"gte": 10, "lt": 100}}:

运算符含义field=value 格式
eq / ne等于 / 不等于x=v / x=!v
gt gte lt lte比较x=GT:v …
contains / not_contains不区分大小写的子字符串x=C:v / x=NC:v
starts_with / ends_with不区分大小写的前缀/后缀x=SW:v / x=EW:v
in匹配列表中的任意值x=IN:a,b
null: true / null: false为空 / 不为空x=NULL: / x=NNULL:
exists: true / exists: false有 / 没有相关记录x=EXISTS: / x=NOT_EXISTS:

选项 — data create / data update

Flag描述
--data <json>包含字段值的 JSON 对象

示例

anythink data list blog_posts --limit 10
anythink data get blog_posts 42
anythink data create blog_posts --data '{"title":"Hello World","status":"draft"}'
anythink data update blog_posts 42 --data '{"status":"approved"}'
anythink data delete blog_posts 42 --yes

导出和导入 — data export 按页将记录流式写入文件;data import 每行创建一条记录。导入时务必先运行 --dry-run:该选项会验证每一行,但不会发送任何内容。

anythink data export customers customers.csv
anythink data export orders orders.jsonl --filter 'status=paid' --fields id,total
anythink data import customers customers.csv --dry-run
anythink data import customers customers.csv --errors rejected.csv --yes
Flag(export)描述
--format <fmt>csv、json 或 jsonl。默认值:根据扩展名确定(.csv、.json、.jsonl、.ndjson)。将 - 用作文件时会写入 stdout(需要 --format)
--filter <expr>语法与 data list --filter 相同
--fields a,b要导出的列,按指定顺序排列。CSV 默认导出实体的字段
--page-size <n>每次请求的记录数(默认 200,最大 1000)
--force覆盖现有文件。未指定时,绝不会改动现有文件。文件会先写入临时名称,并在成功后重命名,因此导出失败不会留下不完整文件
--no-formula-guard仅适用于 CSV:见下文
Flag(import)描述
--format <fmt>csv、json(对象数组)或 jsonl。默认值:根据扩展名确定;若没有扩展名,则根据第一个字符([ 或 {)确定
--dry-run验证并报告;不会发送任何内容
--concurrency <n>并行创建数(默认 4,最大 16)
--errors <file>将跳过和失败的行写入文件,并添加 _error 列或属性,以便修复后重新导入
--ignore-unknown丢弃实体中不存在的字段对应的列,而不是拒绝该行
--yes跳过确认提示。非交互式运行时(CI、脚本、Agent)必须指定此选项,否则导入会在写入任何内容前被拒绝

值的处理方式:

  • CSV 遵循 RFC 4180:包含逗号、引号或换行符的单元格会加引号,引号会加倍,带引号的单元格可以跨行。对象、数组、JSON 字段和关系会写成紧凑的 JSON 文本。
  • 公式防护(导出):以 =, +, -, @、制表符或回车符开头的 CSV 文本会加上 ' 前缀,以防电子表格将其作为公式运行。数字不会被更改。这包括 +44 20 7946 0000 这样的电话号码,以及任何以 + 或 - 开头的文本。防护是单向的:导入文件时会保留 ',除非文件是使用 --no-formula-guard 导出的。
  • 类型遵循实体字段的类型。 文本保留原有字符(00123 仍为 00123);整数和小数使用 . 作为小数分隔符进行解析(1,5 会被拒绝,不会进行猜测);布尔值接受 true/false、1/0 和 yes/no;日期必须符合 ISO 8601 格式(2025-03-31、2025-03-31T09:30:00Z;未指定时区偏移表示 UTC);JSON 字段必须是有效的 JSON。
  • 空 CSV 单元格会作为 null 发送。 JSON 和 JSONL 输入中的空字符串会保留为空字符串。
  • 错误行会被跳过,绝不会发送。 系统会报告行号(CSV:记录编号,因此表头为第 1 行;JSONL:行号;JSON:数组中的位置),并计入已跳过。被服务端拒绝的行会计入失败。只要有任何行被跳过或失败,退出代码就非零。
  • 重试:绝不会重试 400、409 和 422,因此不会重复创建。哪些请求会重试,请参阅下文的不确定失败。
  • 导入时会忽略系统列:id、created_at、updated_at、tenant_id 和 locked 绝不会发送,导入结果会指出忽略了哪些列。因此,将导出文件重新导入同一项目会创建带有新 id 和时间戳的重复记录,不会更新原记录。
  • 导入时会跳过一对多集合和密钥字段(导入结果会列出这些字段),除非在 --fields 中指定,否则导出时会省略一对多列。多对多、文件和用户列会作为 id 复制,这些 id 只有在同一项目内才有意义;导入时会对每列警告一次。
  • 空布尔单元格会作为 null 而不是 false 发送。
  • 不确定失败:只有 429/503 响应以及从未到达服务端的请求(DNS、连接或 TLS 故障)会重试。如果请求超时,或发送后连接断开,该行会报告为 UNCERTAIN: may have been created,错误文件中也会记录;重新导入前请先检查项目。速率限制等待会让所有工作线程同时暂停,并会持续重试一分钟以上,之后才会放弃。
  • Ctrl+C 会停止读取文件,完成已排队的行,并打印部分摘要(退出代码为 1)。中断导出时会删除临时文件。
  • data import 和 data export 会读取和写入本地文件,因此无法通过托管的(HTTP)MCP 服务使用。

目前尚不支持:按键更新或插入现有记录、通过自然键查找关系(请使用相关记录的 id),以及文件上传。


search

对所有实体进行全文搜索,并管理索引生命周期。

anythink search query <text>                          Run a search
anythink search similar <entity> <id>                 Find similar documents
anythink search rehydrate [<entity>]                  Rebuild the search index (admin)
anythink search purge [<entity>]                      Wipe the search index (admin)
anythink search audit <entity>                        Compare configured public-searchable fields
                                                       with what public search actually returns

选项 — search query

标志描述
--entities <list>以逗号分隔的实体名称。默认:所有已索引的实体。
--filter <expr>过滤表达式,例如 "status=published AND category=news"。支持 _geoRadius。
--sort <list>以逗号分隔的排序字段,例如 "created_at:desc,id:asc"。
--facet <fields>以逗号分隔的字段,用于计算分面计数。
--highlight在结果中高亮匹配的词语。
--page N页码(默认:1)。
--limit N每页结果数(1-100,默认:20)。
--public使用无需身份验证的 /search/public 端点(仅限标记为公开的字段)。
--json输出原始响应 JSON。

索引生命周期

rehydrate 和 purge 是针对搜索索引的管理操作:

  • search rehydrate — 从数据库重建索引(不会丢失数据;仅重新同步)
  • search purge — 删除索引(之后运行 rehydrate 以重新填充)

默认情况下,两项操作都会要求确认;传入 -y / --yes 可在自动化任务中跳过提示。

search audit — 公开搜索数据泄漏检查

将实体的架构声明应可通过公开搜索的内容(publicly_searchable=true 的字段,以及实体自身 is_public=true)与 /search/public 实际返回的内容进行比较。公开结果中出现的任何不在允许列表中的字段都会被报告为泄漏。

检测到泄漏时以代码 1 退出 — 适用于 CI/CD。

示例

# Browse everything
anythink search query "*"

# Filtered search with sorting
anythink search query "anythink" --filter "status=published" --sort "created_at:desc"

# Compare what public visitors see vs what's in the database
anythink search audit posts
anythink search audit users --query "alice" --sample 10

# Reindex after a schema change
anythink search rehydrate posts
anythink search rehydrate --yes        # everything (admin)

# Geo search (radius in metres)
anythink search query "*" --filter "_geoRadius(51.5074,-0.1278,5000)"

工作流

管理自动化工作流。工作流可以有多种触发方式:cron 计划、实体事件、API 路由或手动运行。

anythink workflows list                List all workflows (--json for a compact summary)
anythink workflows get <id>            Get workflow details and steps (--json for the full definition)
anythink workflows create <name>       Create a new workflow
anythink workflows update <id>         Rename a workflow or change its description
anythink workflows enable <id>         Enable a workflow
anythink workflows disable <id>        Disable a workflow
anythink workflows trigger <id>        Manually trigger a workflow
anythink workflows delete <id>         Delete a workflow

触发类型 — workflows create --trigger <type>(不区分大小写;默认值为 Manual)

类型触发时机必需标志其他标志
Manual手动运行时,在某个实体上--entity <name>
Event发生事件时,例如创建记录Entity... 事件需要 --entity <name>--event <event>、--filter <json>
Timed按 cron 计划运行--cron <expr>
Api调用其 API 路由时--api-route <route>

--event(不区分大小写)可设为 EntityCreated(默认值)、EntityUpdated、EntityDeleted、UserRegistered、UserInvited、SubscriptionCreated、SubscriptionActivated、SubscriptionExpired、PaymentCreated、PaymentSucceeded、PaymentFailed、PaymentMethodCaptured、PaymentMethodCaptureFailed、PaymentMethodRemoved 或 PushActionTaken;只有三个 Entity... 事件需要 --entity。如果触发类型缺少必需标志,系统会在发送任何内容前拒绝请求;不适用于所选类型的标志则会被忽略并显示警告。

其他选项 — workflows create

标志描述
--description <text>工作流描述
--enabled立即启用工作流
--filter-file <path>从文件读取 Event 过滤器 JSON

示例

anythink workflows create daily-sync --trigger Timed --cron "0 6 * * *"
anythink workflows create on-post --trigger Event --entity blog_posts --event EntityUpdated
anythink workflows create import-hook --trigger Api --api-route hooks/import
anythink workflows create review-posts --entity blog_posts
anythink workflows trigger 76
anythink workflows disable 83

用户

管理当前项目中的用户。

anythink users list                    List all users
anythink users me                      Show the currently authenticated user
anythink users get <id>                Get a user by ID
anythink users invite <email> <first> <last>   Create a user and send an invitation email
anythink users delete <id>             Delete a user

选项 — users invite

标志描述
--role-id <id>为新用户分配角色

示例

anythink users list
anythink users invite [email protected] Alice Smith --role-id 3
anythink users delete 42 --yes

文件

管理当前项目中上传的文件。

anythink files list                    List uploaded files
anythink files get <id>                Get file metadata by ID
anythink files upload <path>           Upload a file
anythink files delete <id>             Delete a file

选项 — files list

标志描述
--page <n>页码
--limit <n>每页文件数(默认值:25)

选项 — files upload

标志描述
--public让文件可公开访问

示例

anythink files list
anythink files upload logo.png --public
anythink files upload export.csv
anythink files delete 12 --yes

邮件

查看和编辑项目的事务性邮件模板(确认、邀请、恢复等)以及包裹每封邮件正文的 HTML 外壳。邮件命令需要项目的邮件权限;API 会为当前登录用户强制执行这些权限。

anythink email templates list                      List the project's email templates
anythink email templates show <type>               Show a template's subject and content
anythink email templates update <type>             Change a template's subject and/or content
anythink email preview                             Render an unsaved draft and print the HTML
anythink email shell show                          Show the shell HTML (custom or platform default)
anythink email shell update                        Save new shell HTML, or reset it

选项 — email templates show

标志说明
--rendered打印渲染后的 HTML(使用示例数据),而不是源代码

选项 — email templates update

标志说明
--subject <text>新主题行
--content <path>包含新内容的文件(使用 - 从标准输入读取)
--content-text <html>以内联方式传入的新内容(使用此选项或 --content,不能同时使用)

主题或内容至少传入一项。未提供的部分将保留当前值。不接受空内容。

选项 — email preview(在服务器上渲染,不会保存)

标志说明
--subject <text>要渲染的主题(默认:Preview)
--content <path>包含内容的文件(使用 - 从标准输入读取)
--content-text <html>以内联方式传入的内容
--wrapper <path>用于渲染的可选外壳 HTML(使用 - 从标准输入读取)
--wrapper-text <html>以内联方式传入的可选外壳 HTML

选项 — email shell update(必须且只能传入一项)

标志说明
--html <path>包含新外壳 HTML 的文件(使用 - 从标准输入读取)
--html-text <html>以内联方式传入的新外壳 HTML
--reset恢复为平台默认外壳

HTML 长度上限为 1,000,000 个字符。外壳和模板命令会打印原始 HTML,因此你可以将其重定向到文件。通过 MCP 服务使用时,不提供文件选项,因此 Agent 会通过 content_text、wrapper_text 和 html_text 内联传入 HTML。

示例

anythink email templates list
anythink email templates show confirmation --rendered > confirmation.html
anythink email templates update confirmation --subject "Welcome aboard"
anythink email templates update confirmation --content ./confirmation.html
cat confirmation.html | anythink email templates update confirmation --content -
anythink email preview --subject "Hi" --content ./draft.html --wrapper ./shell.html
anythink email shell show > shell.html
anythink email shell update --html ./shell.html
anythink email shell update --reset

角色

管理当前项目中的角色。角色控制已通过身份验证的用户可以访问哪些内容。

anythink roles list                    List all roles
anythink roles create <name>           Create a new role
anythink roles delete <id>             Delete a role

选项 — roles create

标志说明
--description <text>对角色的易读描述

示例

anythink roles list
anythink roles create editor --description "Can edit content"
anythink roles delete 5 --yes

api-keys

签发并管理 API 密钥,以便进行非交互式访问(CI 流水线、脚本、集成)。每个密钥都限定了一组权限,设有有效期,并与创建它的用户关联。

创建时原始密钥只会显示一次,之后无法再次获取——请立即保存,或使用 --save-as 将其直接写入 CLI 配置文件。

anythink api-keys list                              List your API keys
anythink api-keys create <name> --permissions ...   Create a new key
anythink api-keys revoke <id>                       Revoke a key

选项 — api-keys create

标志说明
--permissions <list>必填。以逗号分隔的权限名称,例如 data:read,data:create
--expires-in <days>距离过期的天数(默认值:90,最大值:365)
--no-expiry-cap允许 --expires-in 大于 365 天
--save-as <profile>将新密钥直接保存到 CLI 配置文件,而不是打印出来
--json将响应以 JSON 格式打印到 stdout(密钥包含在此输出中,请谨慎处理)
-y, --yes跳过确认提示

输出行为

默认情况下,成功消息会发送到 stdout,原始密钥则单独一行发送到 stderr。这样便于只捕获密钥:

anythink api-keys create ci-deploy --permissions data:read --yes 2> key.txt

如果服务器因当前用户不具备某些权限而剔除请求中的权限,CLI 会发出醒目的警告,避免你拿到权限不足却不自知的密钥。

示例

# Create a 90-day key for CI
anythink api-keys create github-actions --permissions "data:read,data:create" --yes 2> key.txt

# Create a key and save it directly into a profile (key never echoes)
anythink api-keys create scraper --permissions data:read --save-as scraper-bot --yes
anythink --profile scraper-bot data list posts

# Revoke a key
anythink api-keys revoke 42 --yes

菜单

在当前项目中管理仪表板侧边栏菜单。菜单用于控制 Anythink 仪表板中显示哪些实体,以及它们的分组方式。

anythink menus list                                        List all menus with tree structure
anythink menus get <menu_id> [--json]                      Show one menu (and its role) with its items and child items
anythink menus create <name> <role_id>                     Create a menu shown to a role
anythink menus update <menu_id> [--name <text>] [--role <id>]
                                                           Rename a menu or change its role
anythink menus delete <menu_id> [--yes]                    Delete a menu and all of its items
anythink menus add-item <menu_id> <entity>                 Add an entity to a dashboard menu
anythink menus update-item <menu_id> <item_id> [options]   Change an item's name, icon, link or parent
anythink menus remove-item <menu_id> <item_id> [--yes]     Remove an item, along with its child items
anythink menus reorder-items <menu_id> <item_ids>          Set the order of items that share a parent
anythink menus reorder <menu_ids>                          Set the order of menus

选项 — menus add-item

标志描述
--icon <name>Lucide 图标名称(例如,MessageCircle、Target)
--name <text>显示名称(默认为实体名称,并转换为标题格式)
--parent <id>用于将菜单项嵌套到分组中的父菜单项 ID

选项 — menus update-item(只更改传入的字段)

标志描述
--name <text>新的显示名称
--icon <name>新的 Lucide 图标名称
--entity <name>将菜单项指向实体页面(而非 --href)
--href <path>将菜单项指向任意路径(而非 --entity)
--parent <id>要嵌套到其下的父菜单项 ID;0 会将其移至顶层

reorder-items 和 reorder 接受以逗号分隔的 ID,并按所需顺序排列(301,299,300)。指定的菜单项会排在其分组的最前面;未指定的菜单项则保持当前顺序,排在其后。reorder-items 要求所有菜单项属于同一父级。锁定项(内置项)不能更改、删除或移动;它们会保留原位,其间的菜单项会复用各自的位置编号(只有当两个菜单项的位置编号相同时才会重新编号)。

add-item 和 update-item --entity 会先查找实体(系统实体也包括在内),只有实体不存在时才会停止;如果查找本身失败(例如,没有权限),仍会保存菜单项,并发出警告,说明无法检查该实体。使用 update-item --parent 将菜单项移至新的父级时,该项会排在新同级菜单项的最后。

删除菜单项也会删除其直属子项。命令会对此进行说明,并在这些子项处于锁定状态或拥有自己的子项时拒绝删除。

一个角色只显示其第一个菜单,因此如果该角色已有菜单,create(以及 update --role)会发出警告。delete 会一并删除菜单中的锁定内置项,并在该角色不再有菜单时说明此情况。

示例

# List all menus and their items
anythink menus list

# Show menu 250 with the item IDs you need for the commands below
anythink menus get 250

# Add "Check-ins" under the Profiles group (parent 168) in admin menu (250)
anythink menus add-item 250 check_ins --icon MessageCircle --parent 168

# Add a top-level menu item
anythink menus add-item 250 badges --icon Award

# Rename an item and give it another icon
anythink menus update-item 250 299 --name "Achievements" --icon Trophy

# Remove an item
anythink menus remove-item 250 299 --yes

# Put items 301, 299 and 300 first, in that order
anythink menus reorder-items 250 301,299,300

图表

在当前项目中构建和管理仪表板上显示的图表。每个命令都接受 --json,用于打印包含下一步所需 ID 的紧凑结果。在 MCP 服务中,每个命令都是一个同名工具(charts_create、charts_preview 等)。

anythink charts list [--entity <name>]            List charts, newest first
anythink charts get <id>                          Show a chart's configuration
anythink charts create <name> [options]           Create a chart
anythink charts update <id> [options]             Change a chart; options you leave out keep their value
anythink charts delete <id> [--yes]               Delete a chart
anythink charts preview [options]                 Show the data a configuration would draw, without saving it
anythink charts platform-metrics                  List the usage metrics a platform chart can plot

选项 — charts create、charts update 和 charts preview

标志描述
--entity <name>图表所绘制记录所属的实体
--type <type>column(柱状图)、line、pie、area、stat、gauge 或 funnel
--group-by <field>x 轴字段,或饼图的切片字段
--interval <size>对日期 --group-by 进行分桶:hour、day、week、month、quarter 或 year
--measure <field>要聚合的数值字段(除非 --agg 为 count,否则必需)
--agg <how>count(默认)、sum、avg、min 或 max
--stack-by <field>将每个柱或数据点进一步拆分的字段
--filter <f:op:value>筛选条件,例如 status:eq:published。运算符:eq ne gt gte lt lte contains in exists not_exists。可重复指定多个字段;每个图表对每个字段仅保留一个筛选条件
--timeframe <preset>all、24h、7d、30d、90d、365d 或 custom(配合 --from 和 --to 使用)
--limit <n>、--sort <asc|desc>、--cumulative <bool>行数上限、排序顺序和累计值
--target <n>、--target-mode <goal|warning>统计图或仪表图上的目标值或警告级别
--compare <bool>、--compare-days <n>、--compare-overlay <bool>与上一时间段进行比较
--source <entity|platform|quota>数据来源。平台图表使用 --platform-metric(参见 charts platform-metrics),配额图表使用 --quota-metric
--config <json>其他选项,以 JSON 对象形式提供,例如用于漏斗图的 {"funnelStages":[{"label":"Signed up"}]}。类型化选项优先
--rows <n>仅适用于 charts preview:要显示的最大行数(默认值为 50)

如果缺少值或值未知,系统会在发送任何内容前拒绝操作,并指出相应值。使用 charts create 前,先用 charts preview 检查图表:它接受相同的选项,并展示图表的呈现效果。

示例

# What would a pie of orders by status show?
anythink charts preview --entity orders --type pie --group-by status

# Save it, then a revenue chart with a filter
anythink charts create "Orders by status" --entity orders --type pie --group-by status
anythink charts create "UK revenue per month" --entity orders --type column --group-by created_at \
  --interval month --measure total --agg sum --filter region:eq:uk --timeframe 365d

# A usage chart from the platform metrics
anythink charts create "Workflow runs" --source platform --platform-metric workflow_runs --type line

# Change one thing
anythink charts update 12 --timeframe 30d

仪表板

构建和管理仪表板。仪表板是一组排列在 12 列网格上的小组件(图表、列表、备注等)。每条命令都需要 --json。

anythink dashboards list                                 List the dashboards you can see
anythink dashboards get <id>                             Show a dashboard with its widgets and their positions
anythink dashboards mine                                 Show your landing dashboard, or the project default
anythink dashboards create <name> [options]              Create a dashboard
anythink dashboards update <id> [options]                Rename it, change who can see it, or replace its widgets and layout
anythink dashboards delete <id> [--yes]                  Delete a dashboard and its widgets (the charts are kept)
anythink dashboards add-chart <dashboard-id> <chart-id>  Add a chart as a new widget
anythink dashboards remove-widget <dashboard-id> <widget-id>  Remove a widget
anythink dashboards data <id> [--widget <id>]            Show the data behind the widgets
anythink dashboards widget-preview --type <type>         Show the data a widget would draw, without saving it
anythink dashboards set-home <id>                        Make it your landing dashboard
anythink dashboards promote-to-default <id> [--yes]      Copy it over the project default (administrators only)

add-chart 和 remove-widget 会读取仪表板,仅更改对应的小组件,然后按原样写回其余内容。

选项

命令 / 标志说明
create --chart <id>在新仪表板上添加图表。可重复指定多个图表
create --description、--shared、--allow-shared-edit、--home、--default描述、哪些人可以查看或编辑,以及它是否是你的落地页或项目默认仪表板
create/update --config <json>以 JSON 对象形式指定其他设置:widgets(每个小组件包含 type、title 和设置)和 layout。使用 update 时,widgets 会替换整个列表,因此要保留的小组件都必须列出,并包含其 id
update --name、--description、--shared <bool>、--allow-shared-edit <bool>要更改的字段;其余字段保持不变
add-chart --title <text>小组件标题(默认为图表名称)
add-chart --column、--row、--width、--height网格中的位置和大小(默认宽度为 4、高度为 3,放置在现有小组件下方)。全部省略时,仪表板会自行放置小组件
data --widget <id>、--rows <n>仅指定这些小组件;每个小组件最多显示的行数(默认为 20)
widget-preview --type、--chart、--config、--rows小组件类型(chart、list、markdown 等)、要显示的图表,或小组件自身的 JSON 设置

示例

# A dashboard with two charts already on it
anythink dashboards create Sales --chart 12 --chart 14

# Add a third, half the width of the grid
anythink dashboards add-chart 3 15 --width 6

# See what is on it, then take a widget off
anythink dashboards get 3
anythink dashboards remove-widget 3 41

# The numbers behind it
anythink dashboards data 3 --json

设置

查看并更改当前项目的设置,包括浏览器可从哪些应用 URL 调用 API(CORS)。

anythink settings get [--json]                   Show all project settings
anythink settings set <key> <value> [--yes]     Set a single project setting
anythink settings cors list                      List allowed application URLs
anythink settings cors add <url> [--yes]         Add an allowed origin
anythink settings cors remove <url>              Remove an allowed origin

键 — settings set

键值
name, description文本
require_email_confirmationtrue / false
allow_registrationstrue / false
default_role_id新注册用户的角色 ID
enable_group_rlstrue / false
payment_success_url, payment_cancel_urlURL
app_engagement_trial_enabledtrue / false
app_engagement_trial_days天数
ai_modeplatform 或 byok
ai_byok_provider, ai_default_model文本
google_maps_key文本

源站必须为 http/https,包含主机名,可带端口,但不能带路径、查询参数或片段;末尾的 / 会被移除。像 https://*.example.com 这样的通配符仅适用于你控制的域名,因此除非传入 --yes,否则会拒绝共享托管域名(vercel.app、github.io 等)下的通配符,以及裸顶级域名。

某些更改会扩大可注册用户的范围:如果 default_role_id 指向管理员角色,系统会拒绝该设置,除非传入 --yes;allow_registrations true 和 require_email_confirmation false 则会要求确认(以非交互方式运行时传入 --yes)。

cors add 和 cors remove 会清除项目的 CORS 缓存,因此更改会立即生效。匹配不区分大小写,添加已存在的 URL 不会产生任何影响。Anythink 自有域名和 localhost 始终处于允许列表中,无需添加。

示例

# Allow a deployed front end to call the API
anythink settings cors add https://my-app.vercel.app

# Allow every subdomain of a domain you own
anythink settings cors add "https://*.example.com"

# Remove an origin
anythink settings cors remove https://my-app.vercel.app

# Let users sign up on their own
anythink settings set allow_registrations true

集成

管理集成,包括可用提供商目录(Claude、OpenAI、Slack、Google 等)以及保存这些提供商凭据的活动连接。

anythink integrations list                                  List available providers
anythink integrations get <provider>                        Show details and operations for one provider
anythink integrations connections list [--provider <p>]     List your active connections

anythink integrations connect <provider>                    Create an API-key connection (Claude, OpenAI, etc.)
anythink integrations oauth status <provider>               Show OAuth client setup status
anythink integrations oauth configure <provider>            Set the OAuth client ID + secret
anythink integrations oauth connect <provider>              Connect via the browser OAuth flow

anythink integrations test <connection-id>                  Test a connection
anythink integrations enable <connection-id>                Enable a connection
anythink integrations disable <connection-id>               Disable a connection
anythink integrations disconnect <connection-id>            Delete a connection

anythink integrations execute <provider> <operation>        Run an operation on a connected provider

API 密钥提供商 — integrations connect

标志说明
--api-key <key>提供商的 API 密钥。如果省略,系统会提示输入(输入内容将隐藏)。
--name <name>此连接的易记名称(默认值:<provider> connection)
--user-connection将此连接设为用户级连接(仅当前用户可见)。默认情况下,连接对整个租户可见。

OAuth 提供商 — integrations oauth connect

CLI 会在 http://localhost:8745/callback 启动本地 HTTP 监听器,在浏览器中打开提供商的授权 URL,并将返回的代码交换为连接,无需复制粘贴授权代码。

标志说明
--name <name>此连接的易记名称
--user-connection将此连接设为用户级连接
--port <n>本地回调端口(默认值:8745)
--no-open不尝试打开浏览器,只打印 URL
--timeout <secs>等待回调的时长(默认值:300)

连接之前,需要为每个提供商设置一次 OAuth 凭据:

anythink integrations oauth configure slack          # prompts for client_id + secret (hidden)
anythink integrations oauth connect slack --name main

运行操作 — integrations execute

标志说明
--input <k=v>输入参数,格式为 key=value。可重复使用。
--inputs <json>所有输入组成的 JSON 对象。
--json打印完整的 JSON 响应(默认情况下,如果存在 content 字段,则只打印该字段)。

示例

# Browse what's available
anythink integrations list
anythink integrations get claude

# API-key flow (Claude, OpenAI)
anythink integrations connect claude --name "main"
anythink integrations execute claude generate-text --input "prompt=Tell me a haiku"

# OAuth flow (Slack, Google, GitHub)
anythink integrations oauth configure slack
anythink integrations oauth connect slack --name main

# Manage connections
anythink integrations connections list
anythink integrations test <connection-id>
anythink integrations disable <connection-id>
anythink integrations disconnect <connection-id> --yes

pay

管理 AnythinkPay — Stripe Connect、Apple 应用内购买、支付、订阅计划和有效订阅。

anythink pay status                    Show Stripe Connect account status
anythink pay connect                   Set up a Stripe Connect account and start onboarding
anythink pay setup                     Guided setup: Stripe Connect, Apple IAP, and a first plan
anythink pay payments                  List recent payments
anythink pay methods                   List saved payment methods
anythink pay entitlement               Show the current user's access / trial entitlement
anythink pay payment-options           Show available payment providers for a platform/storefront

anythink pay trial status|enable|disable          Manage the app engagement trial

anythink pay apple credentials set                Set Apple IAP credentials (.p8 from a file)
anythink pay apple credentials show               Show Apple IAP credentials (identifiers masked)
anythink pay apple credentials notification-url   Print the URL to register in App Store Connect
anythink pay apple verify                         Verify an Apple transaction (testing)

anythink pay plans list|get|create|update|delete  Manage subscription plans

anythink pay subscriptions list|get|events        Inspect subscriptions and history
anythink pay subscriptions cancel|resume          Standard lifecycle actions
anythink pay subscriptions delete|force-expire|relink|resync   Admin recovery (project admin)

anythink pay offers list|get|create|update        Manage promo and referral offers
anythink pay offers pause|activate                Change an offer's status
anythink pay offers delete                        Permanently delete an offer, its codes and redemption records
anythink pay offers codes|add-code|redemptions    Inspect and extend an offer
anythink pay offers user-code                     Look up a user's personal referral code

执行取消、删除、过期、重新关联或暂停操作的命令(pay plans delete、pay subscriptions cancel|delete|force-expire|relink、pay offers pause|delete)会要求确认。传入 -y/--yes 可跳过提示;在非交互式 shell 中,如果未传入该选项,命令将拒绝运行。

pay plans update 只会更改你传入的字段:省略的标志会保留计划当前的货币、周期、类型和启用状态。使用 --active 或 --inactive 更改可用状态。

选项 — pay payments

标志说明
--page <n>页码
--limit <n>每页的支付数量(默认:25)

pay connect 采用交互式操作 — 它会提示你选择业务类型、国家/地区并填写联系邮箱,创建 Stripe Connect 账户,然后在浏览器中打开 Stripe 入驻 URL。pay setup 会依次设置 Stripe Connect、Apple IAP 凭据和第一个计划;每个步骤都是可选的。

订阅计划可以包含 --apple-product-id(以及可选的 --apple-subscription-group-id),这样一个计划即可同时用于 Stripe 和 Apple。pay apple credentials set 会从文件读取 App Store Connect .p8 私钥并加密存储 — 绝不会打印或记录该私钥。

所需权限

命令范围权限
计划 / 订阅读取、权益、支付选项anythink_subscription_plans:read
计划写入anythink_subscription_plans:create / :update / :delete
支付读取 / 写入anythink_payments:read / :create
Apple 凭据、管理员恢复(delete/force-expire/relink/resync)项目管理员

示例

anythink pay setup
anythink pay plans create --plan-name monthly --name Monthly --amount 9.99 --currency gbp --interval month --apple-product-id example_monthly
anythink pay apple credentials set --issuer-id <uuid> --key-id <id> --bundle-id com.example.app --private-key-file ./AuthKey.p8
anythink pay apple verify --signed-transaction <JWS>
anythink pay subscriptions events <subId>
anythink pay entitlement

oauth

为当前项目配置 OAuth 社交登录提供商。

anythink oauth google status           Show Google OAuth configuration status
anythink oauth google configure        Set Google OAuth client ID and secret

Google OAuth 允许项目用户使用 Google 账号登录。你需要创建一个包含 OAuth 2.0 凭据的 Google Cloud 项目 — 请参阅 Google Cloud Console。

将 Google Cloud 凭据中的授权重定向 URI 设置为:

https://api.my.anythink.cloud/org/<your-org-id>/auth/v1/google/callback

示例

anythink oauth google status
anythink oauth google configure

api

列出当前项目的所有可用 API 端点 — 包括平台路由以及为实体动态生成的 REST 路由。

anythink api                           List all endpoints
anythink api --json                    Output as JSON (useful for AI tooling)

docs

打印完整的 CLI 参考文档。

anythink docs                          Print reference as markdown
anythink docs --json                   Print reference as JSON (for AI/tooling consumption)

migrate

将实体架构(实体 + 字段)从一个项目配置复制到另一个项目配置。适用于将暂存环境中的架构发布到生产环境。

anythink migrate --from <profile> --to <profile>

选项

标志说明
--from <profile>源配置名称(必填)
--to <profile>目标配置名称(必填)
--dry-run显示将要迁移的内容,但不进行更改

示例

anythink migrate --from my-app-staging --to my-app-prod
anythink migrate --from my-app-staging --to my-app-prod --dry-run

plans

列出可用的 Anythink 计划。

anythink plans                         List plans
anythink plans --json                  Output as JSON

MCP 服务

Anythink MCP 服务通过 Model Context Protocol 向 AI 助手(Claude、Cursor 等)提供平台功能。

安装

无需安装 — 推荐使用 npx 按需运行:

npx -y @anythink-cloud/mcp

想要使用 PATH 中的原生二进制文件?任选其一:

# Homebrew (bundled with the CLI — see Installation above)
brew install anythink-cloud/tap/anythink

# .NET global tool (requires the .NET 8 SDK)
dotnet tool install -g anythink-mcp

# Or download the anythink-mcp-<platform> binary from the Releases page
配置

添加到 Cursor 在 VS Code 中安装

对于 Claude Code,只需运行一条命令即可注册:

claude mcp add anythink -- npx -y @anythink-cloud/mcp

也可以手动将其添加到 MCP 客户端配置中(例如 .mcp.json):

{
  "mcpServers": {
    "anythink": {
      "command": "npx",
      "args": ["-y", "@anythink-cloud/mcp"]
    }
  }
}

若要固定使用某个配置档案,请将其添加到 args:["-y", "@anythink-cloud/mcp", "--profile", "my-project"]

可用于任何 MCP 客户端。大多数客户端使用上方相同的 mcpServers JSON,只需将其添加到客户端的配置文件中:

客户端配置文件
Claude Codeclaude mcp add anythink -- npx -y @anythink-cloud/mcp(或 .mcp.json)
Claude Desktopclaude_desktop_config.json(Settings → Developer → Edit Config)
Cursor~/.cursor/mcp.json(或使用上方的 添加到 Cursor 按钮)
VS Code.vscode/mcp.json(或使用上方的 在 VS Code 中安装 按钮)
Clinecline_mcp_settings.json(MCP Servers → Configure)
Windsurf~/.codeium/windsurf/mcp_config.json

有些客户端使用不同的配置格式:

Continue(YAML — mcpServers 是列表)
mcpServers:
  - name: anythink
    command: npx
    args:
      - -y
      - "@anythink-cloud/mcp"
Zed(使用 context_servers,而非 mcpServers)
{
  "context_servers": {
    "anythink": {
      "source": "custom",
      "command": "npx",
      "args": ["-y", "@anythink-cloud/mcp"]
    }
  }
}

(若使用原生二进制文件而非 npx,请使用 "command": "anythink-mcp",无需填写 args。)

连接后,运行 login 工具,然后运行 accounts_use / projects_use 以选择工作上下文。

可用工具

MCP 服务提供用于身份验证、账户/项目管理和配置的专用工具,另有一个通用的 cli 工具,可运行任何 CLI 命令:

工具描述
signup创建新的 Anythink 账户
login使用电子邮件和密码登录
login_direct直接保存凭据(组织 ID + API 密钥或 JWT)
logout移除已保存的配置档案
config_show列出所有配置档案
config_use切换当前配置档案
config_remove移除配置档案
accounts_list列出计费账户
accounts_create创建计费账户
accounts_use设置当前计费账户
projects_list列出项目
projects_create创建项目
projects_use连接到项目
projects_delete删除项目
cli运行任何 CLI 命令(实体、数据、工作流、角色等)

托管的 MCP 服务(anythink-mcp --hosted)没有登录或配置档案工具。其 accounts_list、accounts_create、plans、projects_create 和 projects_delete 工具以已登录用户的身份运行,并且仅在用户授予账户访问权限后显示;请参阅 MCP 服务文档。


贡献

先决条件
  • .NET 8 SDK
  • Anythink 账户(免费套餐即可)
设置
git clone https://github.com/anythink-cloud/anythink-cli
cd anythink-cli
dotnet build
本地运行
dotnet run --project src/AnythinkCli.csproj -- --help
dotnet run --project src/AnythinkCli.csproj -- projects list
dotnet run --project src/AnythinkCli.csproj -- entities list
发布

发布通过 GitHub Actions 自动完成。推送版本标签即可触发构建:

git tag v1.2.0
git push origin v1.2.0

工作流会为 macOS(arm64、x64)和 Linux(x64、arm64)构建独立运行的二进制文件,计算 SHA256 校验和,并将其作为 GitHub 发布内容发布。

项目结构
anythink-cli/
├── src/                        # CLI source
│   ├── Commands/               # Command implementations (signup, login, etc)
│   ├── Config/                 # CliConfig.cs, Profile, ConfigService
│   ├── Models/                 # ApiModels.cs, BillingModels.cs
│   ├── Client/                 # HttpApiClient.cs, AnythinkClient.cs, BillingClient.cs
│   ├── Output/                 # Renderer.cs (Spectre.Console helpers)
│   └── Program.cs              # Application entry point & .env loader
├── mcp/                        # MCP server source
│   ├── Tools/                  # MCP tool implementations
│   ├── McpClientFactory.cs     # Auth + client resolution
│   └── Program.cs              # MCP server entry point
├── tests/                      # CLI unit tests
├── mcp-tests/                  # MCP unit tests
├── AnythinkCli.sln             # Solution file
└── .gitignore

许可证

MIT — 参见 LICENSE。此许可涵盖本仓库中的 Anythink CLI 和 MCP 服务源代码;它不授予 Anythink 平台、API 或服务的使用权,这些内容受 anythink.cloud 上的单独条款约束。


使用 Spectre.Console 构建 · 由 Anythink 提供支持

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。