Enfyra MCP 服务配置器

Enfyra MCP Server 是一个用于将 Enfyra 平台接入 Codex、Claude Code、Cursor 等 MCP 兼容编码工具的配置与连接服务,帮助开发者在 AI 编程助手中安全地使用 Enfyra API。

  • by enfyra
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 enfyra/mcp-server

使用说明

Enfyra MCP Server

Connect Enfyra to MCP-compatible coding tools such as Codex, Claude Code, Cursor, VS Code / GitHub Copilot, Google Antigravity, ZCode, and other STDIO MCP hosts.

Install and Configure

Run this from the project that should use Enfyra:

npx @enfyra/mcp-server@latest config

The setup asks for:

  • the Enfyra app/admin URL, such as http://localhost:3000 or https://demo.enfyra.io;
  • an ENFYRA_API_TOKEN created from the Enfyra admin UI /me page;
  • the MCP clients to configure.

It writes project-local configuration, records the setup directory as ENFYRA_MCP_PROJECT_ROOT, and replaces only the enfyra server entry.

Client Command Project config
Codex npx @enfyra/mcp-server@latest config --codex .codex/config.toml
Claude Code npx @enfyra/mcp-server@latest config --claude-code .mcp.json
Cursor npx @enfyra/mcp-server@latest config --cursor .cursor/mcp.json
VS Code / GitHub Copilot npx @enfyra/mcp-server@latest config --vscode .vscode/mcp.json
Google Antigravity npx @enfyra/mcp-server@latest config --antigravity .agents/mcp_config.json
ZCode npx @enfyra/mcp-server@latest config --zcode .zcode/config.json

Non-interactive setup for all supported clients:

npx @enfyra/mcp-server@latest config --yes \
  --app-url http://localhost:3000 \
  --api-token efy_pat_your-token

Remove temporary source artifacts and local telemetry files created by MCP:

npx @enfyra/mcp-server@latest cleanup

Configure more than one selected client:

npx @enfyra/mcp-server@latest config --cursor --claude-code

Manual Configuration

For hosts that accept an mcpServers JSON block:

{
  "mcpServers": {
    "enfyra": {
      "command": "npx",
      "args": ["-y", "@enfyra/mcp-server@latest"],
      "env": {
        "ENFYRA_API_URL": "http://localhost:3000/api",
        "ENFYRA_API_TOKEN": "efy_pat_your-token"
      }
    }
  }
}

Codex project configuration uses TOML:

[mcp_servers.enfyra]
command = "npx"
args = ["-y", "@enfyra/mcp-server@latest"]

[mcp_servers.enfyra.env]
ENFYRA_API_URL = "http://localhost:3000/api"
ENFYRA_API_TOKEN = "efy_pat_your-token"

ZCode uses a nested mcp.servers JSON structure in .zcode/config.json:

{
  "mcp": {
    "servers": {
      "enfyra": {
        "command": "npx",
        "args": ["-y", "@enfyra/mcp-server@latest"],
        "env": {
          "ENFYRA_API_URL": "http://localhost:3000/api",
          "ENFYRA_API_TOKEN": "efy_pat_your-token"
        }
      }
    }
  }
}

Restart or reload the MCP client after writing configuration. Keep the token out of committed files.

Config Command

npx @enfyra/mcp-server@latest config [options]
Option Use
--app-url Set the Enfyra app/admin URL
--api-token, -t Set ENFYRA_API_TOKEN
--yes Run non-interactively
--reconfig Select clients again and replace the existing enfyra entry
--static-tools Preserve compatibility config; the runtime still exposes only enfyra
--codex Write Codex config
--claude-code, --claude Write Claude Code config
--cursor Write Cursor config
--vscode, --copilot Write VS Code / GitHub Copilot config
--antigravity Write Google Antigravity config
--zcode Write ZCode config
-h, --help Show CLI help

Environment

Variable Description Default
ENFYRA_API_URL Runtime API base written into MCP config Required
ENFYRA_API_TOKEN Programmatic token from the Enfyra admin UI /me Required
ENFYRA_MCP_PROJECT_ROOT Absolute project directory for source workspaces Set by config; otherwise use an explicit tool argument or one client-provided root

The MCP connection exposes one tool, enfyra, throughout the session. No tool-loading configuration is needed. ENFYRA_MCP_PROFILE guides workflow discovery; it does not add public tools. Re-running config preserves existing advanced settings. ENFYRA_MCP_DYNAMIC_TOOLS and --static-tools do not change the single-tool runtime surface. Reconnect the MCP client after updating the installed package.

The MCP sends this PAT directly through Enfyra Server's native x-enfyra-pat header. It does not exchange the PAT for a short-lived access token or send it as a Bearer token.

Source workflows prepare an enfyra/ working directory and store source snapshots and diffs under .tmp/enfyra/<target>/<session>/ inside the selected project. Preparation adds /enfyra/ and /.tmp/enfyra/ to the project's .gitignore before writing source. The runtime does not infer the project from its launch directory. Reopen the workspace in each new MCP session; existing local edits are preserved.

Verify the Connection

Open a new session in the configured MCP client and ask it to:

Use Enfyra MCP to show the connected API context.

Then try a read-only request:

Use Enfyra MCP to list the available tables without changing anything.

Development

This repository uses Yarn 4 and TypeScript:

yarn typecheck
yarn test

Use AGENTS.md for maintainer architecture, tool contracts, verification rules, and backend sync points. LLM runtime guidance is served by the MCP instructions, tool descriptions, workflow discovery, required-knowledge tools, builders, and examples—not by this README.