MSTR BI Agent MCP Server

MSTR BI Agent MCP Server

MicroStrategy MCP server that enforces row-level security via LDAP authentication, enabling authorized users to list projects, reports, and execute reports returning data as markdown tables.

Category
访问服务器

README

MicroStrategy (MSTR) BI Agent MCP Server

Phase 1 of the Enterprise AI Architecture at our highly regulated state bank: a secure Model Context Protocol (MCP) server that wraps the MicroStrategy REST API, enforcing native Row-Level Security (RLS) and object-level permissions using Pass-Through LDAP Authentication.

This server is designed to integrate as an HTTP/SSE tool within Onyx (formerly Danswer), allowing our local Qwen 27B LLM to execute reports and return data to authorized bank employees without using master API keys.


Architecture Overview

[Bank Employee]
      │
      ▼
[Onyx Web UI (SSO Authenticated)]
      │
      ▼ (HTTP /sse request with User LDAP credentials/Basic Auth)
[MSTR MCP Server (Docker Container)]
      │
      ├─► Dynamic Header Extraction
      ├─► Instantiates mstrio Connection (loginMode: 16 - LDAP)
      │
      ▼ (REST request with User Context)
[MicroStrategy Library API / IServer]

Deliverables & Project Structure

  • src/server.py: Custom FastMCP server code with dynamic header parsing, pandas parsing, and rotating compliance logs.
  • requirements.txt: Python package requirements (fastmcp, mstrio-py, pandas, tabulate, requests, urllib3).
  • Dockerfile: Secure, non-root, lightweight slim-python container definition.
  • onyx_system_prompt.txt: Strict system instructions for Qwen 27B (forbids hallucinations, outlines tool calling pipeline).

Configuration Variables

The server is configured using the following environment variables:

Variable Description Default
MSTR_BASE_URL MicroStrategy Library REST API URL https://localhost/MicroStrategyLibrary/api
MSTR_PROJECT_ID Default MicroStrategy Project ID "" (Required if querying specific project reports)
MSTR_SSL_VERIFY Verify SSL certificates (True / False) True
MSTR_MCP_TRANSPORT Server transport channel (sse / stdio) sse
MSTR_MCP_HOST Host address to bind the SSE server to 0.0.0.0
MSTR_MCP_PORT Port to bind the SSE server to 8000
COMPLIANCE_LOG_PATH Destination file path for compliance audit log mstr_mcp_compliance.log

Quick Start & Deployment

1. Build the Container

Run this command from the root of this project:

# Standard Build
docker build -t mstr-mcp-server:latest .

# Proxy-aware Build (Required for internal bank deployments)
docker build \
  --build-arg http_proxy="http://proxy.internal-bank.com:8080" \
  --build-arg https_proxy="http://proxy.internal-bank.com:8080" \
  -t mstr-mcp-server:latest .

2. Run the Container

Launch the container, mounting the log folder to your host's secure audit path:

docker run -d \
  --name mstr-mcp-agent \
  -p 8000:8000 \
  -e MSTR_BASE_URL="https://mstr-library.internal-bank.com/MicroStrategyLibrary/api" \
  -e MSTR_SSL_VERIFY="True" \
  -v /var/log/mcp-audit:/app/logs \
  mstr-mcp-server:latest

3. Register in Onyx Admin UI

  • Go to Onyx Admin UI -> Tools -> Add Custom Tool.
  • Select HTTP/SSE.
  • Enter the SSE Endpoint URL: http://<mstr-mcp-agent-ip>:8000/sse
  • Ensure Onyx is configured to pass the user's LDAP credentials (Basic Authentication header or custom X-LDAP-* headers) down to the tool during invocation.

Exposed MCP Tools

The server registers three tools with FastMCP:

  1. list_mstr_projects
    • Description: Retrieves all MicroStrategy projects the authenticated user's LDAP account is authorized to view.
    • Arguments: None.
  2. list_mstr_reports
    • Description: Lists all Reports, OLAP Cubes, and Super Cubes in the specified project.
    • Arguments:
      • project_id (optional, string): MicroStrategy project ID. If omitted, uses the default MSTR_PROJECT_ID env.
  3. execute_mstr_report
    • Description: Runs a report or cube and returns the dataset as a clean Markdown table.
    • Arguments:
      • report_id (required, string): ID of the report/cube.
      • project_id (optional, string): MicroStrategy project ID.
      • limit (optional, integer): Maximum number of rows to return (default is 100 to prevent context window bloat).

Auditing and Compliance

All actions are logged to the file specified in COMPLIANCE_LOG_PATH in a standardized, SIEM-parseable format.

  • Username Masking: The username is always masked (e.g., jdo***) to prevent leaking PII.
  • Credential Protection: Passwords are never written to any log file.
  • Data Protection: Raw dataset records/cells are never written to the audit log.

Log Example:

[2026-07-14 16:20:05] [INFO] [COMPLIANCE] User: jdo*** | Tool: execute_mstr_report | ProjectID: B129A8... | TargetID: R98721... | Status: SUCCESS | Details: Returned 45 rows

Development & Testing

For local verification on Python 3.10+, install dependencies:

pip install -r requirements.txt

To run the server in STDIO mode for testing (using local environment fallbacks):

export MSTR_USERNAME="test_ldap_user"
export MSTR_PASSWORD="test_ldap_password"
export MSTR_BASE_URL="https://mstr-library.internal-bank.com/MicroStrategyLibrary/api"
export MSTR_PROJECT_ID="YOUR_PROJECT_ID"
export MSTR_SSL_VERIFY="False" # For local testing

python src/server.py --transport stdio

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选