igrid-sce-mcp-tool
Enables role-based interaction with iGrid-Prometheus APIs, including domain listing, AI agent execution, action proposal, and CSV ingest/export, supporting Read, Write, and Admin permission levels.
README
igrid-sce-mcp-tool v4 — Read / Write / Admin
Node.js/JavaScript MCP integration layer for the existing iGrid-Prometheus REST APIs. The iGrid backend and the existing eight-tool split are unchanged; this version adds SAP BTP XSUAA role-based authorization at the MCP tool level.
Authorization model
The project now defines three XSUAA scopes, three role templates, and three predefined role collections:
| Role collection | Role template | Scopes | Allowed MCP operations |
|---|---|---|---|
iGrid-MCP-Read |
Read |
$XSAPPNAME.read |
GET/read tools only |
iGrid-MCP-Write |
Write |
$XSAPPNAME.write |
POST/write tools only |
iGrid-MCP-Admin |
Admin |
$XSAPPNAME.read, $XSAPPNAME.write, $XSAPPNAME.admin |
All eight tools |
Authorization is checked inside the common MCP toolHandler before any downstream iGrid API request. A user without the required scope receives a Forbidden: MCP tool error.
Exactly 8 MCP tools
Bearer group — src/tools/bearer-tools.js
igrid_list_domains→GET /api/hub/datasets→ Read/Adminigrid_get_template→GET /api/hub/template/:domain→ Read/Adminigrid_run_agent→POST /api/ai/run→ Write/Adminigrid_propose_action→POST /api/ai/action/propose→ Write/Adminigrid_decide_action→POST /api/ai/action/decide→ Write/Adminigrid_metrics→GET /api/ai/metrics→ Read/Admin
x-api-key group — src/tools/api-key-tools.js
igrid_ingest_csv→POST /api/ingest/:domain→ Write/Adminigrid_export_csv→GET /api/export/:domain→ Read/Admin
igrid_propose_action is intentionally classified as Write because the requested authorization rule is based on the actual HTTP operation and this tool uses POST.
No igrid_health MCP tool is exposed. /healthz remains only the application health endpoint.
Existing downstream iGrid behavior is unchanged
- Six tools continue to use the iGrid Bearer/service session.
igrid_ingest_csvandigrid_export_csvcontinue to use the iGridx-api-keychannel.- No Destination or Connectivity service is introduced.
- No credentials or secrets are hard-coded.
Important files
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
Environment
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=
For Bearer tools, a pre-issued IGRID_BEARER_TOKEN is preferred. If absent, the existing token manager can use the approved iGrid login/MFA contract when the required MFA configuration is supplied.
Build
npm install
npm run check
npm run security:check
npm test
npx mbt build -t mta_archives
BTP deployment
cf login
cf target -o <ORG> -s <SPACE>
cf deploy mta_archives/igrid-sce-mcp-tool_4.0.0.mtar -f
Set iGrid secrets after deployment:
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
Or, when using the approved service login/MFA flow:
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 role assignment
Deployment creates/updates the XSUAA service instance igrid-sce-mcp-tool-xsuaa from xs-security.json.
After deployment, in the SAP BTP subaccount:
- Open Security → Role Collections.
- Confirm the predefined collections
iGrid-MCP-Read,iGrid-MCP-Write, andiGrid-MCP-Adminexist. - Assign
iGrid-MCP-Readto read-only users. - Assign
iGrid-MCP-Writeto write-only users. - Assign
iGrid-MCP-Adminonly to users who need both GET and POST MCP tools. - Re-authenticate the MCP client so its new token contains the assigned scopes.
If the user has only Read, POST tools fail at the MCP layer. If the user has only Write, GET tools fail. Admin can invoke all eight tools.
OAuth / Claude remote MCP
Use the deployed endpoint:
https://<BTP_ROUTE>/mcp
The OAuth discovery metadata now advertises the XSUAA read, write, and admin scopes. For user-specific role enforcement, use an OAuth flow that produces a user token, normally authorization code, so the user's BTP role collections are represented in the token.
A service key can still provide XSUAA OAuth client credentials, but a client_credentials token is a technical-client identity and should not be treated as if it inherited a human user's role collection.
Local stdio
Local stdio does not have a BTP user JWT, so role behavior is simulated with MCP_LOCAL_ROLE. Default is Admin to preserve the previous local behavior.
Read-only local test:
MCP_LOCAL_ROLE=Read npm run start:stdio
Write-only local test:
MCP_LOCAL_ROLE=Write npm run start:stdio
Full local test:
MCP_LOCAL_ROLE=Admin npm run start:stdio
Claude Desktop/Code example:
{
"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>"
}
}
}
}
Role acceptance test
Use three users (or three user-role assignments) and obtain a fresh token after each assignment.
Read user
Expected success:
igrid_list_domains
igrid_get_template
igrid_metrics
igrid_export_csv
Expected Forbidden::
igrid_run_agent
igrid_propose_action
igrid_decide_action
igrid_ingest_csv
Write user
Expected success:
igrid_run_agent
igrid_propose_action
igrid_decide_action
igrid_ingest_csv
Expected Forbidden::
igrid_list_domains
igrid_get_template
igrid_metrics
igrid_export_csv
Admin user
All eight tools should pass the MCP role check. Downstream iGrid authentication/authorization and request validation still apply.
Security notes
- The permission check happens before the iGrid API invocation.
- XSUAA controls inbound MCP permissions; iGrid remains authoritative for downstream credentials and business authorization.
- Never put the iGrid API key, iGrid password, Bearer token, XSUAA client secret, or service key in source control.
- See
README-SECURITY.mdfor the concise security model.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。