Skip to main content
Glama
tkrishnav31

igrid-sce-mcp-tool

by tkrishnav31

igrid-sce-mcp-tool v4 — 读取 / 写入 / 管理

用于现有 iGrid-Prometheus REST API 的 Node.js/JavaScript MCP 集成层。iGrid 后端和现有的八个工具拆分保持不变;此版本在 MCP 工具级别添加了基于 SAP BTP XSUAA 角色的授权。

授权模型

该项目现在定义了三个 XSUAA 作用域、三个角色模板和三个预定义角色集合:

角色集合

角色模板

作用域

允许的 MCP 操作

iGrid-MCP-Read

Read

$XSAPPNAME.read

仅 GET/读取工具

iGrid-MCP-Write

Write

$XSAPPNAME.write

仅 POST/写入工具

iGrid-MCP-Admin

Admin

$XSAPPNAME.read, $XSAPPNAME.write, $XSAPPNAME.admin

全部八个工具

授权检查在公共 MCP toolHandler 中执行,在任何下游 iGrid API 请求之前。缺少所需作用域的用户将收到 Forbidden: MCP 工具错误。

Related MCP server: agent-sudo-mcp

恰好 8 个 MCP 工具

Bearer 组 — src/tools/bearer-tools.js

  1. igrid_list_domainsGET /api/hub/datasets读取/管理

  2. igrid_get_templateGET /api/hub/template/:domain读取/管理

  3. igrid_run_agentPOST /api/ai/run写入/管理

  4. igrid_propose_actionPOST /api/ai/action/propose写入/管理

  5. igrid_decide_actionPOST /api/ai/action/decide写入/管理

  6. igrid_metricsGET /api/ai/metrics读取/管理

x-api-key 组 — src/tools/api-key-tools.js

  1. igrid_ingest_csvPOST /api/ingest/:domain写入/管理

  2. igrid_export_csvGET /api/export/:domain读取/管理

igrid_propose_action 被有意归类为写入,因为请求的授权规则基于实际的 HTTP 操作,且此工具使用 POST。

不公开 igrid_health MCP 工具。/healthz 仅保留为应用程序健康端点。

现有下游 iGrid 行为保持不变

  • 六个工具继续使用 iGrid Bearer/服务会话。

  • igrid_ingest_csvigrid_export_csv 继续使用 iGrid x-api-key 通道。

  • 未引入 Destination 或 Connectivity 服务。

  • 未硬编码任何凭据或密钥。

重要文件

xs-security.json                 XSUAA scopes, role templates, role collections
src/auth/xsuaa.js               XSUAA authentication + OAuth metadata
src/auth/authorization.js       Read/Write/Admin authorization checks
src/context/auth-context.js     Per-request auth context propagation
src/tools/response.js           Common MCP tool-level enforcement
src/tools/bearer-tools.js       6 Bearer tools and permission mapping
src/tools/api-key-tools.js      2 x-api-key tools and permission mapping

环境

IGRID_BASE_URL=https://igrid-prometheus.azurewebsites.net
IGRID_API_KEY=<IGRID_API_KEY>
IGRID_BEARER_TOKEN=<optional pre-issued iGrid Bearer>
IGRID_SERVICE_EMAIL=<optional approved iGrid service email>
IGRID_SERVICE_PASSWORD=<optional approved iGrid service password>
IGRID_MFA_CODE=<optional MFA code>
IGRID_MFA_BODY_JSON=<approved MFA JSON body using {{code}}>
IGRID_REQUEST_TIMEOUT_MS=30000

MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080
MCP_PATH=/mcp

# Local stdio / local HTTP test authorization only.
# Ignored for a hosted request authenticated through XSUAA.
MCP_LOCAL_ROLE=Admin
MCP_HTTP_AUTH_TOKEN=

对于 Bearer 工具,优先使用预先颁发的 IGRID_BEARER_TOKEN。如果不存在,现有的令牌管理器可以在提供所需 MFA 配置的情况下使用已批准的 iGrid 登录/MFA 契约。

构建

npm install
npm run check
npm run security:check
npm test
npx mbt build -t mta_archives

BTP 部署

cf login
cf target -o <ORG> -s <SPACE>
cf deploy mta_archives/igrid-sce-mcp-tool_4.0.0.mtar -f

部署后设置 iGrid 密钥:

cf set-env igrid-sce-mcp-tool IGRID_API_KEY '<IGRID_API_KEY>'
cf set-env igrid-sce-mcp-tool IGRID_BEARER_TOKEN '<IGRID_BEARER_TOKEN>'
cf restart igrid-sce-mcp-tool

或者,当使用已批准的服务登录/MFA 流程时:

cf set-env igrid-sce-mcp-tool IGRID_SERVICE_EMAIL '<SERVICE_EMAIL>'
cf set-env igrid-sce-mcp-tool IGRID_SERVICE_PASSWORD '<SERVICE_PASSWORD>'
cf set-env igrid-sce-mcp-tool IGRID_MFA_BODY_JSON '<APPROVED_JSON_WITH_{{code}}>'
cf restart igrid-sce-mcp-tool

XSUAA 角色分配

部署会根据 xs-security.json 创建/更新 XSUAA 服务实例 igrid-sce-mcp-tool-xsuaa

部署后,在 SAP BTP 子账户中:

  1. 打开 安全 → 角色集合

  2. 确认预定义的集合 iGrid-MCP-ReadiGrid-MCP-WriteiGrid-MCP-Admin 存在。

  3. iGrid-MCP-Read 分配给只读用户。

  4. iGrid-MCP-Write 分配给只写用户。

  5. 仅将 iGrid-MCP-Admin 分配给需要同时使用 GET 和 POST MCP 工具的用户。

  6. 重新认证 MCP 客户端,使其新令牌包含已分配的作用域。

如果用户只有读取权限,POST 工具将在 MCP 层失败。如果用户只有写入权限,GET 工具将失败。管理员可以调用全部八个工具。

OAuth / Claude 远程 MCP

使用已部署的端点:

https://<BTP_ROUTE>/mcp

OAuth 发现元数据现在会公布 XSUAA 的 readwriteadmin 作用域。对于用户特定的角色强制执行,请使用能生成用户令牌的 OAuth 流程(通常是授权码),以便用户的 BTP 角色集合在令牌中得以体现。

服务密钥仍然可以提供 XSUAA OAuth 客户端凭据,但 client_credentials 令牌是技术客户端身份,不应被视为继承了人类用户的角色集合。

本地 stdio

本地 stdio 没有 BTP 用户 JWT,因此角色行为通过 MCP_LOCAL_ROLE 模拟。默认值为 Admin,以保留之前的本地行为。

只读本地测试:

MCP_LOCAL_ROLE=Read npm run start:stdio

只写本地测试:

MCP_LOCAL_ROLE=Write npm run start:stdio

完整本地测试:

MCP_LOCAL_ROLE=Admin npm run start:stdio

Claude Desktop/Code 示例:

{
  "mcpServers": {
    "igrid-sce-mcp-tool": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/igrid-sce-mcp-tool/src/server.js"],
      "env": {
        "MCP_TRANSPORT": "stdio",
        "MCP_LOCAL_ROLE": "Read",
        "IGRID_BASE_URL": "https://igrid-prometheus.azurewebsites.net",
        "IGRID_API_KEY": "<IGRID_API_KEY>",
        "IGRID_BEARER_TOKEN": "<IGRID_BEARER_TOKEN>"
      }
    }
  }
}

角色验收测试

使用三个用户(或三个用户角色分配),并在每次分配后获取新令牌。

读取用户

预期成功:

igrid_list_domains
igrid_get_template
igrid_metrics
igrid_export_csv

预期 Forbidden:

igrid_run_agent
igrid_propose_action
igrid_decide_action
igrid_ingest_csv

写入用户

预期成功:

igrid_run_agent
igrid_propose_action
igrid_decide_action
igrid_ingest_csv

预期 Forbidden:

igrid_list_domains
igrid_get_template
igrid_metrics
igrid_export_csv

管理员用户

全部八个工具应通过 MCP 角色检查。下游 iGrid 身份验证/授权和请求验证仍然适用。

安全说明

  • 权限检查在 iGrid API 调用之前执行。

  • XSUAA 控制入站 MCP 权限;iGrid 对下游凭据和业务授权保持权威。

  • 切勿将 iGrid API 密钥、iGrid 密码、Bearer 令牌、XSUAA 客户端密钥或服务密钥放入源代码管理。

  • 有关简洁的安全模型,请参阅 README-SECURITY.md

Install Server
F
license - not found
A
quality
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

  • F
    license
    -
    quality
    A
    maintenance
    Provides a trust and governance layer for AI agents, enabling secure API access, credential vaulting, paid execution with human approval, and automatic call resume.
    8
    1
  • A
    license
    A
    quality
    A
    maintenance
    Local zero-trust permission gateway for AI agents. Enforces policy-based tool authorization, human approvals, scoped permissions, and cryptographically verifiable audit logs.
    4
    5
    Apache 2.0
  • A
    license
    -
    quality
    B
    maintenance
    Provides a secure MCP gateway for AI agents to access APIs without exposing raw credentials, with scoped access, audit logging, and OAuth support.
    MIT

View all related MCP servers

Related MCP Connectors

  • Runtime permission, approval, and audit layer for AI agent tool execution.

  • Single entry point for the GOSCE portfolio: routes orchestrators to verified agents by capability, w

  • Build, validate, and deploy multi-agent AI solutions from any AI environment.

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/tkrishnav31/igrid_aits--mcp_tool'

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