Skip to main content
Glama
hiimnit
by hiimnit

alrm-mcp

用于 AL ID Range Manager 的 MCP 服务器。

让 AI 编码代理能够以与 ALRM VS Code 扩展相同的方式预留 AL 对象 ID。当代理即将创建新的 AL 对象时,它会调用 new_object,Business Central 中的共享 ALRM 数据库会验证名称并返回下一个可用对象 ID——这样,所有在同一个扩展上工作的人获得的 ID 都能保持唯一。

工具

new_object

注册一个新的 AL 对象并返回其分配的 ID。

Parameter

Type

Description

appId

UUID

来自扩展 app.jsonid

objectType

见下文

AL 对象类型

objectName

字符串,≤ 30 个字符

对象名称,例如 ART CU Demo Data

以文本形式返回对象 ID,例如 50061。使用相同名称再次调用会返回相同的 ID,而不会分配新的 ID。

Related MCP server: Dynamics 365 Business Central Admin MCP Server

要求

  • Node.js 20 或更高版本

  • 安装了 ALRM 扩展的 Business Central 环境

  • 有权登录该环境(参见身份验证

配置

{
  "mcpServers": {
    "alrm-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "alrm-mcp@latest"],
      "env": {
        "BC_TENANT": "{tenant}",
        "BC_ENVIRONMENT": "{environment}",
        "BC_COMPANY": "{company}"
      }
    }
  }
}

对于 Claude Code,你可以用一条命令添加它:

claude mcp add alrm-mcp \
  --env BC_TENANT=contoso.com \
  --env BC_ENVIRONMENT=Production \
  --env BC_COMPANY=00000000-0000-0000-0000-000000000000 \
  -- npx -y alrm-mcp@latest

环境变量

这三个都是必需的——服务器会立即退出,并显示一条消息指出缺少哪一个。

Variable

Description

BC_TENANT

你的 Microsoft Entra 租户——可以是域(contoso.com)或租户 GUID。

BC_ENVIRONMENT

Business Central 环境名称,如 BC 管理中心所示,例如 ProductionSandbox

BC_COMPANY

公司 id(GUID,而非显示名称)。可在 https://api.businesscentral.dynamics.com/v2.0/{BC_TENANT}/{BC_ENVIRONMENT}/api/v2.0/companies 列出它们。

这些变量仅从 MCP 客户端的 env 块中读取——不支持 .env 文件,因为服务器通常由客户端启动,而不是从 shell 启动。

两个可选变量可让你将服务器指向自己的 Entra 应用注册,而不是默认的公共客户端:

Variable

Default

Description

ALRM_CLIENT_ID

内置

公共客户端应用注册的应用程序(客户端)ID。

ALRM_TENANT

common

用于登录的颁发机构租户。设置此项可将登录限制为单个租户。

身份验证

第一次工具调用会使用 OAuth 2.0 设备代码流让你登录:

  1. 浏览器标签页会在 https://microsoft.com/devicelogin 打开。

  2. 设备代码会复制到你的剪贴板,同时也会打印到服务器的 stderr,以防剪贴板或浏览器不可用。

  3. 粘贴代码,完成登录,然后工具调用继续执行。

之后,令牌缓存会存储在你操作系统的凭据存储中——macOS 上的 Keychain、Windows 上的 DPAPI、Linux 上的 Secret Service/libsecret——并在你的主目录中生成一个小的索引文件 .alrm-cache.json。后续会话会静默地复用它,包括在服务器和编辑器重启之后,因此在刷新令牌过期(大约 90 天不活动)之前,你不应再次看到浏览器。

要注销,请删除 .alrm-cache.json,并从你的凭据存储中移除 alrm-mcp 条目。在 macOS 上:

rm ~/.alrm-cache.json
security delete-generic-password -s alrm-mcp -a alrm-mcp

目前还没有 logout 命令。

平台说明

在 Linux 上,服务器拒绝回退到以明文存储令牌。在没有可用 Secret Service 的无头机器上,登录将失败,而不是静默写入未加密的令牌缓存。

故障排除

服务器无法启动 / 客户端报告 CONNECTION_CLOSED 几乎总是因为缺少或拼错环境变量。直接运行它来查看实际错误,MCP 客户端会吞掉该错误:

BC_TENANT=contoso.com BC_ENVIRONMENT=Production BC_COMPANY=... npx -y alrm-mcp@latest

健康的服务器会打印 MCP server running on stdio 并等待。

Extension {id} not found! 你的 app.json 中的 appId 尚未在此公司的 ALRM 数据库中注册。请先注册扩展,可以使用 VS Code 扩展,或直接在 Business Central 中注册。

浏览器意外打开。 这就是上面描述的登录。它应该只发生一次,而不是每次调用都发生——如果重复出现,说明令牌缓存没有被持久化;请检查 stderr 输出中是否有关于复用已存储登录信息的消息。

开发

git clone https://github.com/hiimnit/alrm-mcp.git
cd alrm-mcp
npm install
npm run build

然后将你的 MCP 客户端指向本地构建,而不是已发布的包:

{
  "mcpServers": {
    "alrm-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/alrm-mcp/dist/index.js"],
      "env": {
        "BC_TENANT": "...",
        "BC_ENVIRONMENT": "...",
        "BC_COMPANY": "..."
      }
    }
  }
}

npm run typecheck 检查类型但不生成输出。npm run build 会先清理 dist/,并且也会在 npm packnpm publish 时自动运行。

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to perform Business Central AL development tasks including language server operations, container management, Git version control, and file system operations for professional BC development workflows.
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to manage Dynamics 365 Business Central environments through natural language commands, including environment, app, session, and extension management.
    45
    9
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Generates AL code for Business Central directly from your IDE, enhancing developer efficiency by providing tools, prompts, and resources for code generation.
    1
  • A
    license
    A
    quality
    C
    maintenance
    Provides AI assistants with complete visibility into AL dependencies and symbols by exposing compiled .app files through the Model Context Protocol, enabling smart object discovery, deep code analysis, and reference tracking for Business Central development.
    6
    447
    80
    MIT

View all related MCP servers

Related MCP Connectors

  • Debug, build, and manage Power Automate cloud flows with AI agents

  • Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).

  • Odoo ERP for AI agents: hosted OAuth endpoint, gated writes, one endpoint for every instance.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hiimnit/alrm-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server