Ambari MCP Server
Enables AI assistants to manage Apache Ambari clusters, including services, hosts, alerts, and configurations via the MCP protocol.
README
Ambari MCP Server
A Model Context Protocol (MCP) server for Apache Ambari, built with the TypeScript SDK. This server provides tools to interact with Ambari clusters through the MCP protocol.
Overview
This MCP server allows AI assistants and other MCP clients to interact with Apache Ambari clusters by exposing common Ambari REST API operations as MCP tools.
Features
- Cluster Management: Get cluster information, create clusters
- Service Management: List and get details of cluster services
- Host Management: List and get details of cluster hosts
- Alert Management: Manage alert targets
- Secure Authentication: Basic authentication with Ambari server
- Configurable: Environment-based configuration
- Type-Safe: Built with TypeScript for better reliability
Available Tools
Cluster Operations
ambari_clusters_getclusters- Returns all clustersambari_clusters_getcluster- Returns information about a specific clusterambari_clusters_createcluster- Creates a new cluster
Service Operations
ambari_services_getservices- Get all services for a clusterambari_services_getservice- Get details of a specific serviceambari_services_getservicestate- Get detailed state information for a specific serviceambari_services_startservice- Start a specific service on the clusterambari_services_stopservice- Stop a specific service on the cluster
Service Restart & Configuration Management
ambari_services_getserviceswithstaleconfigs- Get services and components that have stale configurations requiring restartambari_services_gethostcomponentswithstaleconfigs- Get host components that need restart due to stale configurationsambari_services_restartservice- Restart a specific service on the cluster (supports rolling restart)ambari_services_restartcomponents- Restart specific components that have stale configurationsambari_services_getrollingrestartstatus- Get the status of rolling restart operations for services
Service Maintenance Mode Management
ambari_services_enablemaintenancemode- Enable maintenance mode for a service or componentambari_services_disablemaintenancemode- Disable maintenance mode for a service or component
Service Check Operations
ambari_services_runservicecheck- Run service check for a specific service to verify it is working correctlyambari_services_isservicechecksupported- Check if service check is supported for a specific service in the stackambari_services_getservicecheckstatus- Get the status of recent service check operations for a service
Host Operations
ambari_hosts_gethosts- Returns a collection of all hostsambari_hosts_gethost- Returns information about a single host
Alert Operations
ambari_alerts_gettargets- Returns all alert targetsambari_alerts_getalerts- Get all alerts for a cluster with filtering optionsambari_alerts_getalertsummary- Get alert summary in grouped format for a clusterambari_alerts_getalertdetails- Get details for a specific alert definitionambari_alerts_getalertdefinitions- Get all alert definitions for a clusterambari_alerts_updatealertdefinition- Update an alert definition (enable/disable or modify properties)
Alert Group Management
ambari_alerts_getalertgroups- Get all alert groups for a clusterambari_alerts_createalertgroup- Create a new alert groupambari_alerts_updatealertgroup- Update an existing alert groupambari_alerts_deletealertgroup- Delete an alert groupambari_alerts_duplicatealertgroup- Duplicate an existing alert group with a new nameambari_alerts_adddefinitiontogroup- Add an alert definition to an alert groupambari_alerts_removedefinitionfromgroup- Remove an alert definition from an alert group
Alert Notification Management
ambari_alerts_getnotifications- Get all alert notification targetsambari_alerts_createnotification- Create a new alert notification targetambari_alerts_updatenotification- Update an existing alert notification targetambari_alerts_deletenotification- Delete an alert notification targetambari_alerts_addnotificationtogroup- Add a notification target to an alert groupambari_alerts_removenotificationfromgroup- Remove a notification target from an alert group
Alert Settings
ambari_alerts_savealertsettings- Save cluster-level alert settings (like repeat tolerance)
Installation
-
Clone or copy this server to your local machine
-
Install dependencies:
npm install -
Install dev dependencies (if not already installed):
npm install typescript @types/node --save-dev
Configuration
-
Copy the example environment file:
cp .env.example .env -
Edit the
.envfile with your Ambari server details:AMBARI_BASE_URL=http://your-ambari-server:8080/api/v1 AMBARI_USERNAME=admin AMBARI_PASSWORD=admin TIMEOUT_MS=30000
Building
Build the TypeScript code:
npm run build
Usage
As a Standalone Server
Run the server directly:
npm start
With MCP Clients
Claude Desktop
Add to your Claude Desktop configuration:
{
"mcpServers": {
"ambari": {
"command": "node",
"args": ["/path/to/ambari-mcp-server/dist/index.js"]
}
}
}
Other MCP Clients
The server communicates via stdio and follows the MCP protocol specification.
Development
Project Structure
ambari-mcp-server/
├── src/
│ └── index.ts # Main server implementation
├── dist/ # Compiled JavaScript (after build)
├── .env.example # Environment configuration template
├── package.json # Node.js dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Development Commands
npm run build- Compile TypeScript to JavaScriptnpm run dev- Build and run the servernpm start- Run the compiled server
Adding New Tools
- Add the tool definition to the
AMBARI_TOOLSarray - Implement the tool executor in the
toolExecutorsobject - Update this README with the new tool documentation
Example:
// Add to AMBARI_TOOLS
{
name: 'ambari_new_operation',
description: 'Description of the new operation',
inputSchema: {
type: 'object',
properties: {
// Define input parameters
},
required: ['requiredParam']
}
}
// Add to toolExecutors
ambari_new_operation: async (args) => {
return executeAmbariRequest('GET', '/new-endpoint', args);
}
Error Handling
The server includes comprehensive error handling:
- Network timeouts and connection errors
- HTTP error responses from Ambari
- Invalid tool parameters
- Authentication failures
Errors are returned as MCP error responses with appropriate error codes and messages.
Security Considerations
- Store sensitive credentials in environment variables
- Use HTTPS for Ambari server connections in production
- Implement proper authentication and authorization
- Consider network security between MCP client and server
Troubleshooting
Common Issues
- Connection Refused: Check if Ambari server is running and accessible
- Authentication Failed: Verify username and password in
.env - Timeout Errors: Increase
TIMEOUT_MSvalue - Build Errors: Ensure TypeScript and dependencies are installed
Debug Mode
Set environment variable DEBUG=1 for verbose logging:
DEBUG=1 npm start
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
ISC License - see package.json for details
Related Links
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。