파일 시스템 MCP 서버
표준화된 도구 인터페이스를 통해 파일 시스템 작업, 분석 및 조작 기능을 제공하는 MCP(모델 컨텍스트 프로토콜) 서버 구현입니다.
건축학
서버는 MCP SDK 기반으로 구축되었으며 여러 개의 별도 계층으로 구성되어 있습니다.
지엑스피1
구성 요소
서버 계층 : MCP 프로토콜 통신 및 도구 디스패치를 처리합니다.
도구 등록 : 도구 등록 및 실행을 관리합니다.
운영 계층 : 핵심 기능을 구현합니다.
파일 시스템 인터페이스 : 안전한 파일 시스템 액세스를 제공합니다.
Related MCP server: MCP Filesystem Server
설치
저장소를 복제합니다.
git clone <repository-url>
cd filesystem-server
종속성 설치:
서버를 빌드하세요:
MCP 설정 구성(cline_mcp_settings.json):
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": ["path/to/filesystem-server/build/index.js"]
}
}
}
도구 참조
디렉토리 작업
목록_디렉토리
메타데이터와 함께 디렉토리 내용을 나열합니다.
interface ListDirectoryParams {
path: string; // Directory path
recursive?: boolean; // List recursively (default: false)
}
interface ListDirectoryResult {
entries: {
name: string;
path: string;
isDirectory: boolean;
size: number;
created: string;
modified: string;
accessed: string;
mode: string;
}[];
}
디렉토리 생성
새로운 디렉토리를 만듭니다.
interface CreateDirectoryParams {
path: string; // Directory path
recursive?: boolean; // Create parent directories (default: true)
}
파일 작업
읽기_파일
인코딩 지원을 통해 파일 내용을 읽습니다.
interface ReadFileParams {
path: string; // File path
encoding?: string; // File encoding (default: 'utf8')
}
쓰기_파일
파일에 내용을 씁니다.
interface WriteFileParams {
path: string; // File path
content: string; // Content to write
encoding?: string; // File encoding (default: 'utf8')
}
추가_파일
파일에 내용을 추가합니다.
interface AppendFileParams {
path: string; // File path
content: string; // Content to append
encoding?: string; // File encoding (default: 'utf8')
}
분석 작업
분석_텍스트
텍스트 파일 속성을 분석합니다.
interface AnalyzeTextParams {
path: string; // File path
}
interface AnalyzeTextResult {
lineCount: number;
wordCount: number;
charCount: number;
encoding: string;
mimeType: string;
}
해시 계산
지정된 알고리즘을 사용하여 파일 해시를 계산합니다.
interface CalculateHashParams {
path: string; // File path
algorithm?: 'md5' | 'sha1' | 'sha256' | 'sha512'; // Hash algorithm
}
interface CalculateHashResult {
hash: string;
algorithm: string;
}
중복 찾기
디렉토리에서 중복된 파일을 식별합니다.
interface FindDuplicatesParams {
path: string; // Directory path
}
interface FindDuplicatesResult {
duplicates: {
hash: string;
size: number;
files: string[];
}[];
}
압축 작업
생성_zip
ZIP 아카이브를 생성합니다.
interface CreateZipParams {
files: string[]; // Files to include
output: string; // Output ZIP path
}
추출_zip
ZIP 아카이브를 추출합니다.
interface ExtractZipParams {
path: string; // ZIP file path
output: string; // Output directory
}
오류 처리
서버는 표준 MCP 오류 코드를 사용합니다.
enum ErrorCode {
ParseError = -32700,
InvalidRequest = -32600,
MethodNotFound = -32601,
InvalidParams = -32602,
InternalError = -32603
}
오류 응답에는 다음이 포함됩니다.
오류 코드
사람이 읽을 수 있는 메시지
추가 컨텍스트가 있는 경우
오류 예:
{
"code": -32602,
"message": "File not found: /path/to/file.txt"
}
개발
프로젝트 구조
src/
├── operations/ # Core operations implementation
├── tools/ # MCP tool definitions and handlers
├── __tests__/ # Test suites
├── index.ts # Entry point
├── server.ts # MCP server setup
├── types.ts # Type definitions
└── utils.ts # Utility functions
테스트 실행
테스트 모음을 실행합니다.
적용 범위:
개발 모드
시계 모드에서 실행:
코드 품질
코드베이스를 린트합니다.
유형 검사:
종속성
핵심 종속성:
개발 종속성:
타입스크립트: 타입 시스템
농담: 테스트
eslint: 린팅
더 예쁘게: 서식
ts-node: TypeScript 실행
nodemon: 개발 서버
기여하다
저장소를 포크하세요
기능 브랜치를 생성하세요
새로운 기능에 대한 테스트를 작성하세요
모든 테스트가 통과되었는지 확인하세요
풀 리퀘스트 제출
특허
MIT