adf-mcp-server
Provides read-only monitoring, inspection, and root-cause analysis of Azure Data Factory resources, including factories, pipelines, and pipeline runs, through MCP tools.
README
adf-mcp-server
Read-only MCP (Model Context Protocol) server for Azure Data Factory monitoring and root-cause analysis, built for use from VS Code / Claude Code.
Status: Step 1 (skeleton + health check). No Azure connectivity yet - that's added in Step 2 (auth) and Step 3 (ADF tools).
Requirements
- Python 3.11+
- An Azure AD App Registration (Service Principal) with Reader role on the Data Factory resource(s) you want to inspect (Reader is sufficient - this server is read-only end to end, so it never needs Contributor)
Local setup
cd adf-mcp-server
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
cp .env.example .env
Creating the Service Principal (one-time, via az-cli)
az ad sp create-for-rbac \
--name "adf-mcp-server-reader" \
--role "Reader" \
--scopes "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RG_NAME>/providers/Microsoft.DataFactory/factories/<FACTORY_NAME>"
This prints appId, password, and tenant - map those into .env as
AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID
respectively. Scope the role assignment to the specific factory (or at
most the resource group) rather than the whole subscription - least
privilege, and this SPN never needs to touch anything outside ADF.
Running the server
python -m adf_mcp.server
# or, after `pip install -e .`:
adf-mcp-server
The server communicates over stdio - running it directly in a terminal
will look like it hangs; that's expected, it's waiting for an MCP client
(VS Code extension, Claude Code, mcp dev, etc.) to connect via stdin/stdout.
Configuring in VS Code
Point your MCP-capable extension's server config at:
{
"command": "python",
"args": ["-m", "adf_mcp.server"],
"cwd": "/absolute/path/to/adf-mcp-server"
}
Once connected:
- Call
health_check- should return{"status": "ok", ...}without touching Azure at all. - Call
check_auth- this makes one real call to Azure AD to acquire an ARM token. Success looks like:Failure returns a structured (not stack-trace) explanation, e.g. missing env vars or an invalid secret - see Troubleshooting below.{"authenticated": true, "auth_mode": "service_principal", "token_expires_on": 1735000000} - Call
list_factories- this makes a real call to Azure Data Factory. Returns each factory'sresource_group, which every other tool below needs as an input:{"factories": [{"name": "shell-prod-adf", "resource_group": "rg-shell-prod", "location": "eastus"}]}
Available tools (Step 3)
All tools are read-only - none of them can create, modify, trigger, or delete anything in Azure Data Factory.
| Tool | Required args | Notes |
|---|---|---|
health_check |
— | No Azure calls |
check_auth |
— | Verifies the Service Principal only |
list_factories |
— | Start here - returns resource_group for each factory |
get_factory |
resource_group, factory_name |
|
list_pipelines |
resource_group, factory_name |
Lightweight: name + activity count/names |
get_pipeline |
resource_group, factory_name, pipeline_name |
Full activity list for one pipeline |
list_pipeline_runs |
resource_group, factory_name |
start_time/end_time optional (default: last 24h), plus optional pipeline_name/status filters. Messages truncated to 500 chars. |
get_pipeline_run |
resource_group, factory_name, run_id |
Full, untruncated run detail - get run_id from list_pipeline_runs first |
Example RCA flow for an agent: list_factories → list_pipeline_runs(status="Failed")
→ get_failed_activity_details(run_id=...) for the error breakdown directly.
Available tools (Step 4 additions)
| Tool | Required args | Notes |
|---|---|---|
list_activity_runs |
resource_group, factory_name, run_id |
Full activity list for a run; start_time/end_time optional (default: last 7 days) |
get_failed_activity_details |
resource_group, factory_name, run_id |
The RCA tool - only failed activities, with error_code/message/failure_type already extracted |
list_triggers |
resource_group, factory_name |
All triggers + current runtime state (Started/Stopped) |
get_trigger_status |
resource_group, factory_name, trigger_name |
One trigger's runtime state - catches "pipeline never ran because its trigger was stopped" |
list_trigger_runs |
resource_group, factory_name |
trigger_name optional (omit for all triggers); default window last 7 days; optional status filter |
Full RCA flow for a failed pipeline: list_pipeline_runs(status="Failed") →
get_failed_activity_details(run_id=...) for the error, and separately
get_trigger_status(trigger_name=...) to rule out "it never even fired."
Running tests
pip install -e ".[dev]" pytest-asyncio
pytest -v
Project layout
See src/adf_mcp/ - server.py (MCP transport), config.py (settings),
logging_config.py (structured logging). Domain logic and Azure
connectivity are added under src/adf_mcp/domain/ from Step 3 onward.
Troubleshooting
- Client shows "server disconnected" immediately: check
python -m adf_mcp.serverruns cleanly on its own first - a startup exception will kill the process before the client ever connects. - Client can't parse responses / garbled output: something wrote to
stdout other than the MCP protocol itself (e.g. a stray
print()). All logging in this project goes to stderr for exactly this reason. check_authreturns "Missing required Service Principal setting(s)": one ofAZURE_TENANT_ID/AZURE_CLIENT_ID/AZURE_CLIENT_SECRETis empty in.env. Note these three do NOT use theADF_MCP_prefix.check_authreturns "Azure authentication failed": usually an expired/rotated client secret, a disabled App Registration, or a tenant ID typo. Re-verify withaz ad sp show --id <AZURE_CLIENT_ID>.ClientAuthenticationError: AADSTS7000215: invalid client secret - regenerate it in the App Registration and update.env.- A tool returns
{"error": "AZURE_SUBSCRIPTION_ID is not set..."}: addAZURE_SUBSCRIPTION_IDto.env- required for every ADF tool (notcheck_auth, which only needs tenant/client/secret). - A tool returns
{"error": "Azure API error (403): ..."}: the Service Principal lacks Reader access to that factory/resource group - re-check theaz ad sp create-for-rbac --role Reader --scopes ...assignment from setup. - A tool returns
{"error": "Azure API error (404): ..."}: check theresource_group/factory_name/pipeline_namespelling - these are case-sensitive and must match exactly whatlist_factories/list_pipelinesreturned. get_failed_activity_detailsreturns an empty list but you know the pipeline failed: the failure may be at the pipeline level (e.g. an invalid parameter) rather than any single activity - check the parent run's ownmessageviaget_pipeline_runinstead.- A pipeline "just didn't run" with no failed runs at all: check
get_trigger_statusfor its trigger -runtime_state: "Stopped"means the trigger was disabled and never fired, which won't show up as a failed run because no run was ever created.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。