Skip to main content
Glama
MCP File Context Server

MCP File Context Server

by bsmi021

파일 컨텍스트 서버

대장간 배지

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

특징

  • 파일 작업

    • 파일 및 디렉토리 내용 읽기

    • 자세한 메타데이터가 포함된 파일 나열

    • 실시간 파일 감시 및 캐시 무효화

    • 여러 파일 인코딩 지원

    • 재귀적 디렉토리 탐색

    • 파일 유형 필터링

  • 코드 분석

    • 순환 복잡도 계산

    • 종속성 추출

    • 댓글 분석

    • 품질 측정 항목:

      • 중복 라인 감지

      • 긴 줄 감지(>100자)

      • 복소 함수 식별

      • 줄 수(전체, 비어 있지 않음, 주석)

  • 스마트 캐싱

    • LRU(최근 사용 횟수) 캐싱 전략

    • 파일 변경 시 자동 캐시 무효화

    • 구성 가능한 제한을 갖춘 크기 인식 캐싱

    • 캐시 통계 및 성능 측정 항목

    • 효율적인 검색을 위한 마지막 읽기 결과 캐싱

  • 고급 검색

    • 정규식 패턴 매칭

    • 구성 가능한 주변 라인을 통한 상황 인식 결과

    • 파일 유형 필터링

    • 다중 패턴 검색 지원

    • 캐시된 결과 검색

    • 제외 패턴

Related MCP server: TokenScope

설치

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 사용합니다.

  • 이 변경을 통해 서로 다른 운영 체제에서 경로 구분 기호 및 파일 일치와 관련된 문제가 방지됩니다.

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

Available Tools

6 tools
generate_outlineC

Generate a code outline for a file, showing its structure (classes, functions, imports, etc). Supports TypeScript/JavaScript and Python files.

Inputs: path (required).

get_chunk_countA

Get the total number of chunks that will be returned for a read_context request. Use this tool FIRST before reading content to determine how many chunks you need to request. The parameters should match what you'll use in read_context.

Inputs: path (required), encoding, maxSize, recursive, +1 more.

getFilesC

Retrieve multiple files by their paths, returning content and metadata for each file

Inputs: filePathList (required).

get_profile_contextC

Get repository context based on current profile settings

Inputs: refresh.

read_contextA

Read and analyze code files with advanced filtering and chunking. The server automatically ignores common artifact directories and files:

  • Version Control: .git/

  • Python: .venv/, pycache/, *.pyc, etc.

  • JavaScript/Node.js: node_modules/, bower_components/, .next/, dist/, etc.

  • IDE/Editor: .idea/, .vscode/, .env, etc.

For large files or directories, use get_chunk_count first to determine total chunks, then request specific chunks using chunkNumber parameter.

Inputs: path (required), maxSize, encoding, recursive, +2 more.

set_profileC

Set the active profile for context generation

Inputs: profile_name (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 6 tools

    Disambiguation4/5

    Most tools have distinct purposes, but 'getFiles' and 'read_context' both involve retrieving file content, which could cause confusion. 'generate_outline' and 'get_profile_context' are clearly separate, and 'set_profile' and 'get_chunk_count' are specialized utilities.

    Naming Consistency2/5

    Naming is inconsistent with mixed conventions: 'generate_outline' and 'read_context' use snake_case, while 'getFiles' uses camelCase. Verb styles vary (e.g., 'generate' vs. 'get' vs. 'read'), and 'get_chunk_count' includes an underscore while 'getFiles' does not, creating a chaotic pattern.

    Tool Count5/5

    With 6 tools, the count is well-scoped for a file context server, covering core operations like file retrieval, analysis, and profile management without being overwhelming or too sparse.

    Completeness4/5

    The toolset covers key file context operations: retrieving files, analyzing code, generating outlines, and managing profiles. A minor gap exists in update or delete operations for profiles or contexts, but agents can likely work around this for the server's purpose.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables token-aware directory exploration and file analysis for LLMs, helping them understand codebases through intelligent scanning and reporting.
      22 PyPI
      4
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A Model Context Protocol server that enhances AI agents by providing deep semantic understanding of codebases, enabling more intelligent interactions through advanced code search and contextual awareness.
      90
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server that enables AI applications to access and analyze local code repositories without manual uploads, providing file listing, content reading, code searching, and project structure analysis capabilities.
      7
      MIT