MCP File Context Server

by bsmi021

Integrations

  • Enables installation of the MCP server via npm, providing access to NPM package management for installing and running the file context server.

파일 컨텍스트 서버

대규모 언어 모델(LLM)에 파일 시스템 컨텍스트를 제공하는 모델 컨텍스트 프로토콜(MCP) 서버입니다. 이 서버를 통해 LLM은 고급 캐싱 및 실시간 파일 감시 기능을 통해 코드 파일을 읽고, 검색하고, 분석할 수 있습니다.

특징

  • 파일 작업
    • 파일 및 디렉토리 내용 읽기
    • 자세한 메타데이터가 포함된 파일 나열
    • 실시간 파일 감시 및 캐시 무효화
    • 여러 파일 인코딩 지원
    • 재귀적 디렉토리 탐색
    • 파일 유형 필터링
  • 코드 분석
    • 순환 복잡도 계산
    • 종속성 추출
    • 댓글 분석
    • 품질 측정 항목:
      • 중복 라인 감지
      • 긴 줄 감지(>100자)
      • 복소 함수 식별
      • 줄 수(전체, 비어 있지 않음, 주석)
  • 스마트 캐싱
    • LRU(최근 사용 횟수) 캐싱 전략
    • 파일 변경 시 자동 캐시 무효화
    • 구성 가능한 제한을 갖춘 크기 인식 캐싱
    • 캐시 통계 및 성능 측정 항목
    • 효율적인 검색을 위한 마지막 읽기 결과 캐싱
  • 고급 검색
    • 정규식 패턴 매칭
    • 구성 가능한 주변 라인을 통한 상황 인식 결과
    • 파일 유형 필터링
    • 다중 패턴 검색 지원
    • 캐시된 결과 검색
    • 제외 패턴

설치

Smithery를 통해 설치

Smithery 를 통해 Claude Desktop용 File Context Server를 자동으로 설치하려면:

지엑스피1

수동 설치

npm install @modelcontextprotocol/file-context-server

용법

서버 시작

npx file-context-server

사용 가능한 도구

  1. 목록_컨텍스트_파일
    • 자세한 메타데이터와 함께 디렉토리의 파일을 나열합니다.
    { "path": "./src", "recursive": true, "includeHidden": false }
  2. 읽기_컨텍스트
    • 메타데이터가 포함된 파일 또는 디렉토리 내용을 읽습니다.
    { "path": "./src/index.ts", "encoding": "utf8", "maxSize": 1000000, "recursive": true, "fileTypes": ["ts", "js"] }
  3. 검색 컨텍스트
    • 컨텍스트가 있는 파일에서 패턴 검색
    { "pattern": "function.*", "path": "./src", "options": { "recursive": true, "contextLines": 2, "fileTypes": ["ts"] } }
  4. 분석_코드
    • 품질 측정 항목을 위해 코드 파일을 분석합니다.
    { "path": "./src", "recursive": true, "metrics": ["complexity", "dependencies", "quality"] }
  5. 캐시 통계
    • 캐시 통계 및 성능 측정 항목을 가져옵니다.
    { "detailed": true }

오류 처리

서버는 특정 오류 코드와 함께 자세한 오류 메시지를 제공합니다.

  • FILE_NOT_FOUND : 파일이나 디렉토리가 존재하지 않습니다.
  • PERMISSION_DENIED : 액세스 권한 문제
  • INVALID_PATH : 잘못된 파일 경로 형식입니다.
  • FILE_TOO_LARGE : 파일 크기 제한을 초과했습니다.
  • ENCODING_ERROR : 파일 인코딩 문제
  • UNKNOWN_ERROR : 예상치 못한 오류

구성

사용자 정의를 위한 환경 변수:

  • MAX_CACHE_SIZE : 캐시된 항목의 최대 수(기본값: 1000)
  • CACHE_TTL : 캐시 수명(밀리초)(기본값: 1시간)
  • MAX_FILE_SIZE : 읽기를 위한 최대 파일 크기(바이트)

개발

# Install dependencies npm install # Build npm run build # Run tests npm test # Start in development mode npm run dev

특허

MIT

기여하다

기여를 환영합니다! 행동 강령과 풀 리퀘스트 제출 절차에 대한 자세한 내용은 기여 가이드를 참조하세요.

크로스 플랫폼 경로 호환성

참고: 2025년 4월부터 File Context Server의 모든 파일 및 디렉터리 경로 처리가 개선된 크로스 플랫폼(Windows, macOS, Linux) 호환성을 위해 업데이트되었습니다.

  • 모든 글로브 패턴은 내부적으로 POSIX 스타일 경로(슬래시)를 사용하여 OS에 관계없이 일관된 파일 일치를 보장합니다.
  • 모든 파일 시스템 작업(읽기, 쓰기, 통계 등)은 안정성을 위해 정규화된 절대 경로를 사용합니다.
  • 서버를 개발하거나 확장하는 경우 glob 패턴에는 path.posix.join 사용하고 파일 시스템 액세스에는 path.normalize 사용합니다.
  • 이 변경을 통해 서로 다른 운영 체제에서 경로 구분 기호 및 파일 일치와 관련된 문제가 방지됩니다.

최종 사용자에게는 아무런 변경이 필요하지 않지만, 개발자는 프로젝트에 참여할 때 이러한 규칙을 따라야 합니다.

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

LLM이 고급 캐싱 및 실시간 파일 감시 기능을 통해 코드 파일을 읽고, 검색하고, 분석할 수 있도록 하는 모델 컨텍스트 프로토콜 서버입니다.

  1. Features
    1. Installation
      1. Installing via Smithery
      2. Manual Installation
    2. Usage
      1. Starting the Server
      2. Available Tools
    3. Error Handling
      1. Configuration
        1. Development
          1. License
            1. Contributing
              1. Cross-Platform Path Compatibility

                Related MCP Servers

                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that extracts and analyzes Python code structures, focusing on import/export relationships between files to help LLMs understand code context.
                  Last updated -
                  2
                  Python
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that enables LLMs to extract and use content from unstructured documents across a wide variety of file formats.
                  Last updated -
                  2
                  Python
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that connects LLMs to the Compiler Explorer API, enabling them to compile code, explore compiler features, and analyze optimizations across different compilers and languages.
                  Last updated -
                  Python
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).
                  Last updated -
                  0
                  JavaScript
                  Apache 2.0

                View all related MCP servers

                ID: x133mt0q3l