数字孪生查询服务

MCP服务器,将AI助手连接到Tacit数字孪生建筑系统,支持通过自然语言查询建筑、设备、传感器和区域信息。

  • by ucl-sbde
  • TypeScript
  • 混合部署
  • 更新于
在 GitHub 查看 ucl-sbde/tacit-mcp

使用说明

隐性mcp

连接AI助手的MCP服务器 默契 构建数字双胞胎。用自然语言询问有关建筑物、设备、传感器和区域的问题。

适用于Claude Desktop、Claude Code、Cursor、Windsurf和任何兼容MCP的客户端。

它做什么

四种只读工具:

工具 目的
tacit_list_sites 列出API密钥可以访问的建筑
tacit_graphql 查询建筑知识图(符合Brick标准)
tacit_timeseries 获取历史传感器数据
tacit_list_files 列出站点的文档和文件

GraphQL工具包含完整的模式引用,因此AI模型可以编写查询,而不需要单独的文档。

快速启动

选项A:npx(推荐--无需安装)

npx -y @tacit/mcp-server

只需将您的MCP客户端指向它(请参阅下面的配置)。没有克隆,就没有建筑。

选项B:克隆和构建

git clone https://github.com/ucl-sbde/tacit-mcp.git
cd tacit-mcp
npm install
npm run build

您需要一个Tacit API密钥。从您的仪表板上获取一个 app.betacit.com 在...之下 网站设置>API密钥.

连接方式

1.标准传输(本地,默认)

标准方法——MCP客户端将服务器作为子进程启动。最适合在您自己的机器上单独使用。

克劳德桌面

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)或 %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "tacit": {
      "command": "npx",
      "args": ["-y", "@tacit/mcp-server"],
      "env": {
        "TACIT_API_KEY": "your-api-key"
      }
    }
  }
}

克劳德代码

添加 .mcp.json 在您的项目中:

{
  "mcpServers": {
    "tacit": {
      "command": "npx",
      "args": ["-y", "@tacit/mcp-server"],
      "env": {
        "TACIT_API_KEY": "your-api-key"
      }
    }
  }
}

光标

添加 .cursor/mcp.json:

{
  "mcpServers": {
    "tacit": {
      "command": "npx",
      "args": ["-y", "@tacit/mcp-server"],
      "env": {
        "TACIT_API_KEY": "your-api-key"
      }
    }
  }
}

2.可流式HTTP传输(远程)

将服务器作为持久HTTP服务运行。最适合团队、云部署和用户无法在本地安装Node.js的环境。

# Start the HTTP server
TACIT_API_KEY=your-api-key npm run start:http

# Or with npx
TACIT_API_KEY=your-api-key npx --package @tacit/mcp-server tacit-mcp-http

服务器正在监听 http://0.0.0.0:3001/mcp 默认情况下。

从任何MCP客户端连接

使用承载令牌将您的客户端指向服务器URL:

{
  "mcpServers": {
    "tacit": {
      "type": "streamable-http",
      "url": "https://your-host:3001/mcp",
      "headers": {
        "Authorization": "Bearer your-api-key"
      }
    }
  }
}

HTTP配置

变量 默认值 描述
PORT 3001 要收听的端口
HOST 0.0.0.0 绑定地址
MCP_PATH /mcp MCP端点路径
TACIT_API_KEY API密钥模式下需要
TACIT_OAUTH_ISSUER 设置为启用OAuth 2.1模式

健康检查

GET /health → { "status": "ok", "transport": "streamable-http", "sessions": 3 }

3.OAuth 2.1(企业版)

对于您希望用户通过Tacit的登录流而不是管理API密钥进行身份验证的生产部署:

TACIT_OAUTH_ISSUER=https://app.betacit.com npm run start:http

这使得:

  • 动态客户端注册 --MCP客户端自动注册
  • 授权码+PKCE --用户通过Tacit的web UI登录
  • 令牌刷新 --会话保持活动状态,无需重新身份验证
  • 令牌撤销 --干净会话终止

支持OAuth的MCP客户端(如Claude Desktop)将通过 .well-known/oauth-authorization-server 元数据端点。

4.Docker

docker run -p 3001:3001 -e TACIT_API_KEY=your-api-key tacit/mcp-server

使用上面的HTTP传输配置进行连接。

试试看

连接后,询问您的AI助手以下问题:

  • “列出我的所有建筑工地”
  • “Tower West有什么空气处理机组?”
  • “显示AHU-001上的温度传感器”
  • “获取最近24小时的送风温度数据”
  • “什么设备为大厅区域供电?”

环境变量

变量 必填 默认 描述
TACIT_API_KEY 是(stdio/HTTP) 您的Tacit API密钥
TACIT_API_URL 没有 https://app.betacit.com API基本URL(用于自托管部署)
TACIT_OAUTH_ISSUER 否 OAuth颁发者URL(启用OAuth 2.1模式)
PORT 没有 3001 HTTP服务器端口
HOST 没有 0.0.0.0 HTTP服务器绑定地址
MCP_PATH 没有 /mcp HTTP MCP端点路径

发展

npm run dev       # watch mode — stdio transport
npm run dev:http  # watch mode — HTTP transport
npm run build     # compile TypeScript
npm start         # run stdio transport
npm run start:http # run HTTP transport

许可证

麻省理工学院