@ai-development-environment/server

中文文档
0.0.145发布于 2026/11/07MIT构建来源已验证近 30 天下载 4210

AI-focused development environment (prebuilt Next.js standalone server)

原始使用文档
文档目录7 节
  1. Install
  2. Run
  3. Configuration
  4. Credential backends
  5. Reusing an existing Vault on a new install
  6. Read-only Vault installs
  7. See also

@ai-development-environment/server

Prebuilt Next.js standalone server for the AI Development Environment.

Install

npm install -g @ai-development-environment/server

Requires Node.js 24 (>=24.16.0 <25).

Run

export APP_SECRET="$(openssl rand -base64 32)"
export APP_ORIGINS="http://127.0.0.1:3090"
ai-development-environment

The command applies pending database migrations, then starts the server on http://127.0.0.1:3090 with agent GraphQL WebSockets on ws://127.0.0.1:3091/graphql. The SQLite database is stored at ~/.ai-development-environment/production.db by default.

Configuration

Override with environment variables:

VariableDefault
HOSTNAME127.0.0.1
PORT3090
AGENT_WS_HOSTNAME127.0.0.1
AGENT_WS_PORT3091
DATABASE_URLfile:~/.ai-development-environment/production.db
APP_SECRETRequired except for automatic macOS Keychain storage; base64 or hex of exactly 32 bytes
APP_SECRET_PREVIOUSunset; set only while rotating APP_SECRET
APP_ORIGINSunset; inferred from each request's host
TRUST_PROXY_HEADERSfalse
MCP_OAUTH_ENABLEDfalse
MCP_OAUTH_DCR_ENABLEDfalse
AUTH_MODEpassword
CREDENTIAL_STORAGE_TYPEdatabase
VAULT_ADDRrequired for Vault
VAULT_TOKENunset
VAULT_NAMESPACEunset
CREDENTIAL_VAULT_MOUNTsecret
CREDENTIAL_VAULT_PATH_PREFIXai-development-environment/credentials
CREDENTIAL_VAULT_HEADERS{}
VAULT_CACERTunset
VAULT_TLS_SERVER_NAMEunset
VAULT_SKIP_VERIFYfalse
CREDENTIAL_VAULT_READ_ONLYfalse

Only SQLite file: URLs are supported for DATABASE_URL.

For database or Vault storage, generate APP_SECRET once with openssl rand -base64 32, back it up, and keep it stable across upgrades. It must be base64 or hex encoding of exactly 32 random bytes — a passphrase is rejected, because session signing, database credential encryption, and install-link signing are all derived from it. Changing it signs everyone out and invalidates outstanding install links. For database credentials, pass the old value as APP_SECRET_PREVIOUS to re-encrypt them on the next start; remove it once the server has started cleanly. Keychain and Vault credentials do not depend on this secret.

On macOS with CREDENTIAL_STORAGE_TYPE=keychain, leave APP_SECRET unset or blank to use automatic storage. Before starting services, the server reads service com.bludesign.ai-development-environment.app-secret, account APP_SECRET, from your login Keychain. If the entry is absent, it generates and persists a 32-byte secret. Every server installation under the same macOS account shares it across restarts and upgrades. An explicit environment value always takes precedence, must still be valid, and is never copied into Keychain. No secret is written to an environment file. The Homebrew formula already selects Keychain storage; npm and source installs must select it explicitly.

Back up the Keychain entry. Removing an environment override switches to the stored or newly generated Keychain root and can invalidate existing sessions and signed links. A locked, inaccessible, or malformed entry stops startup instead of replacing the secret: unlock your login Keychain and grant access, restore the original entry, or supply APP_SECRET explicitly. Initialization uses a temporary lock under ~/.ai-development-environment/; concurrent starts wait up to 30 seconds, and abandoned locks expire automatically. If the lock cannot be acquired, check directory permissions and retry. Builds never access Keychain. Automatic storage is available only on macOS.

APP_ORIGINS is the optional comma-separated list of origins this server is reached at. Localhost is always trusted outside production. Leaving both it and PUBLIC_BASE_URL unset makes the server trust each request's own Host, which means the absolute URLs it generates follow whatever host the caller asked for.

The first account to register claims the instance and closes public registration. Every account then has identical, complete authority: any signed-in user can create and delete accounts, set anyone's password, revoke sessions, and issue API keys. There are no roles.

AUTH_MODE accepts password, oidc, or both. OIDC modes require a generic provider client ID and secret plus either a discovery URL or a complete authorization, token, and user-info endpoint set. See the authentication documentation for the complete AUTH_OAUTH_* variable list and redirect URL.

Incoming MCP OAuth is independent of AUTH_MODE and disabled by default. Set a canonical HTTPS PUBLIC_BASE_URL (or an exact APP_ORIGINS), deploy migrations, then set MCP_OAUTH_ENABLED=true. CIMD identifies clients by default; enable MCP_OAUTH_DCR_ENABLED=true only for older clients that require dynamic registration. OAuth access is limited to /api/mcp, with separate read, write, and destructive consent. Manage revocation in Settings → Connected Applications. Existing sessions, API keys, and enrolled agents continue working. See the MCP OAuth setup and rollout guide.

Credential backends

CREDENTIAL_STORAGE_TYPE accepts database, vault, or keychain. Database is the default on npm, Linux, and Docker. Database secrets are always encrypted with a key derived from APP_SECRET; there is no plaintext mode and no separate encryption key to configure. Rows written before encryption became unconditional are encrypted at the next start. Rotation is supported: set the old root as APP_SECRET_PREVIOUS and stored credentials are re-encrypted on start. Vault and Keychain storage do not use the derived key at all.

Vault supports KV v2 only. Quote custom-header JSON as one shell value, for example CREDENTIAL_VAULT_HEADERS='{"X-Vault-AWS-IAM-Server-ID":"vault.example.com"}'. Standard token/namespace variables cannot conflict with equivalent custom headers. VAULT_CACERT must be readable by the server process. Plaintext Vault HTTP and VAULT_SKIP_VERIFY=true work but display prominent interception warnings. The default-prefix policy is:

path "secret/data/ai-development-environment/credentials/*" {
  capabilities = ["create", "read", "update"]
}
path "secret/metadata/ai-development-environment/credentials/*" {
  capabilities = ["list", "delete"]
}

list is optional. With it, a server discovers every credential under the prefix, including per-server MCP header bundles and APNs certificates; without it, discovery still covers each credential stored at a fixed path.

Reusing an existing Vault on a new install

A server pointed at a Vault that already holds credentials adopts them when it starts: it reads what is stored under the configured mount and prefix and rebuilds the local metadata rows describing it. Nothing needs to be re-entered, and the Credentials page reports how many items were adopted. A credential this install recorded under an earlier backend is adopted the same way, because the configured backend is the only one a read can reach: once Vault is confirmed to hold that secret, the local row is repointed at Vault and the superseded database copy is dropped from it. Only secrets live in Vault—non-secret settings such as the Jira site URL or GitHub App ID are still entered per install. Point two installs at the same mount and prefix and they share one set of secrets, with no coordination between them; a write from either is immediately visible to the other.

Because the Vault token is the only thing gating this, treat it as the credential: anyone who can point a new install at the Vault gets a working install.

Read-only Vault installs

CREDENTIAL_VAULT_READ_ONLY=true declares that an install must never write to Vault. Secret fields become read-only across the settings forms, and credential writes and deletions are refused before any request is sent; non-secret settings stay editable. The setting applies only when CREDENTIAL_STORAGE_TYPE=vault—database and keychain storage ignore it and report a warning on the Credentials page. A token that simply lacks write capabilities does not need the flag: Vault's denial is reported as the same read-only error rather than a bare HTTP 403. A read-only install needs:

path "secret/data/ai-development-environment/credentials/*" {
  capabilities = ["read"]
}
path "secret/metadata/ai-development-environment/credentials/*" {
  capabilities = ["read", "list"]
}

macOS Keychain is dynamically loaded only on Darwin; selecting it on Linux or in Docker reports an error without crashing the app. Do not run a Keychain-backed service as root. Switching storage backends never copies a value into the new backend. Switching to Vault, whose contents the server can read back, keeps working for every secret Vault already holds; anything the configured backend does not hold is reported as a mismatch on the Credentials page and must be re-entered through its owning settings form. External-backend outages affect only credential-dependent features.

See also

版本与发布记录

@ai-development-environment/server 共发布 118 个版本,首次发布于 2026/07/19;过去 12 个月发布了 118 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.145latest2026/11/071 天前
0.0.1442026/11/061 天前
0.0.1432026/11/052 天前
0.0.1422026/11/052 天前
0.0.1412026/11/043 天前
0.0.1402026/11/043 天前

关于 @ai-development-environment/server 的常见问题

@ai-development-environment/server 是什么?

AI-focused development environment (prebuilt Next.js standalone server)

如何安装 @ai-development-environment/server?

在项目目录运行 npm install @ai-development-environment/server,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ai-development-environment,可以用 npx ai-development-environment 直接运行。

@ai-development-environment/server 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ai-development-environment__server 是否存在。

@ai-development-environment/server 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.16.0 <25。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ai-development-environment/server 可以商用吗?

@ai-development-environment/server 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ai-development-environment/server 的下载量有多少?

根据 npm 官方下载统计,@ai-development-environment/server 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,210 次,日均约 140 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ai-development-environment/server 还在维护吗?

最新版本 0.0.145 发布于 2026/11/07(1 天前);至今共发布 118 个版本,其中过去 12 个月发布了 118 个;首次发布于 2026/07/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。