
HDFS MCP Server
A Model Context Protocol server that enables interaction with Hadoop Distributed File System, allowing operations like listing, reading, writing, and managing HDFS files and directories.
README
HDFS MCP 服务器
这是一个真正的Model Context Protocol (MCP) 服务器,用于管理Hadoop分布式文件系统。它实现了MCP标准,可以与支持MCP的客户端(如Claude Desktop)集成。
项目结构
src/
├── index.ts # 主入口文件
├── interface/
│ └── types.ts # 类型定义
├── connection/
│ └── HDFSConnection.ts # HDFS连接管理
├── server/
│ └── HDFSMCPServer.ts # MCP服务器实现
├── tools/
│ └── HDFSTools.ts # HDFS操作工具
└── utils/
└── HDFSUtils.ts # 工具函数
功能
- 列出HDFS目录中的文件
- 读取HDFS文件内容
- 写入内容到HDFS文件
- 删除HDFS文件或目录
- 创建HDFS目录
- 获取HDFS文件或目录信息
- 测试HDFS连接
安装
npm install
构建
npm run build
运行
npm start
配置
服务器使用以下HDFS配置:
- NameService:
haclusterdev
- NameNodes:
n1
,n2
- RPC地址:
- n1:
1.hadoopdev.com:8020
- n2:
2.hadoopdev.com:8020
- n1:
- HTTP地址:
- n1:
1.hadoopdev.com:8090
- n2:
2.hadoopdev.com:8090
- n1:
环境变量配置
可以通过环境变量自定义配置:
export HDFS_NAMESERVICES=haclusterdev
export HDFS_NAMENODES=n1,n2
export HDFS_RPC_N1=1.hadoopdev.com:8020
export HDFS_RPC_N2=2.hadoopdev.com:8020
export HDFS_HTTP_N1=1.hadoopdev.com:8090
export HDFS_HTTP_N2=2.hadoopdev.com:8090
export HDFS_USERNAME=hadoop
export HDFS_PASSWORD=your_password
MCP 工具
服务器实现了以下MCP工具:
- hdfs_list_files - 列出HDFS目录内容
- hdfs_read_file - 读取HDFS文件内容
- hdfs_write_file - 写入内容到HDFS文件
- hdfs_delete_file - 删除HDFS文件或目录
- hdfs_create_directory - 创建HDFS目录
- hdfs_get_file_info - 获取HDFS文件信息
- hdfs_test_connection - 测试HDFS连接
使用方法
作为MCP服务器运行
-
构建项目:
npm run build
-
启动MCP服务器:
npm start
-
在支持MCP的客户端中配置:
{ "mcpServers": { "hdfs": { "command": "node", "args": ["dist/index.js"] } } }
作为独立客户端使用
import { HDFSMCPServer } from './dist/server/HDFSMCPServer.js';
import { HDFSConfig } from './dist/interface/types.js';
const config: HDFSConfig = {
nameservices: 'haclusterdev',
namenodes: ['n1', 'n2'],
rpcAddresses: {
n1: '1.hadoopdev.com:8020',
n2: '2.hadoopdev.com:8020'
},
httpAddresses: {
n1: '1.hadoopdev.com:8090',
n2: '2.hadoopdev.com:8090'
},
sharedEditsDir: 'qjournal://1.hadoopdev.com:8485;2.hadoopdev.com:8485;3.hadoopdev.com:8485/haclusterdev',
failoverProvider: 'org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'
};
const server = new HDFSMCPServer(config);
await server.initialize();
特性
- 高可用性支持: 支持HDFS HA集群,自动故障转移
- 重试机制: 网络错误时自动重试
- 路径验证: 自动验证和规范化HDFS路径
- 详细日志: 完整的操作日志记录
- 错误处理: 友好的错误信息和处理
- 类型安全: 完整的TypeScript类型定义
开发
# 开发模式运行
npm run dev
# 运行测试
npm test
许可证
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.