Skip to main content
Glama
jm333-B

file-insight-mcp

by jm333-B

File Analysis MCP (file-insight-mcp)

A personal local MCP server that reads unstructured documents in a specified folder, analyzes their structure, and writes per-document summaries and a folder-wide summary report.

All documents in this package's data/sample_docs/ are synthetic data created for demo purposes.

References

Related MCP server: file-analyzer

What this server does

  1. Scans the structure of a fixed target folder (data/sample_docs/).

  2. Reads only documents with allowed extensions (.txt .md .csv .log).

  3. Extracts table of contents (heading structure), dates, numbers, and key term candidates from documents using rule-based logic.

  4. Builds a combined summary prompt from all documents. The summary itself is written by the host LLM (Claude/Codex); this MCP does not call any LLM API.

  5. Validates the structure of the written summary report and cross-checks that mentioned filenames actually exist.

  6. Saves the report to a file only after the user explicitly approves.

Quick start

Required environment: Python 3.11 or later, uv

uv sync --extra dev

After installation, verify that all four commands in the Verification section below pass.

To visually inspect the tools with MCP Inspector:

uv run mcp dev src/file_insight_mcp/server.py

Project structure

Domain logic and tool conventions are separated so that changing validation rules does not require touching the tool layer.

Path

Role

src/file_insight_mcp/security.py

Path safety checks, extension allowlist, size and item count limits

src/file_insight_mcp/core.py

Folder scan, document reading, report structure validation, approval-based saving

src/file_insight_mcp/outline.py

Table of contents, date, number, and key term extraction (rule-based, deterministic)

src/file_insight_mcp/grounding.py

Cross-checking filenames mentioned in summaries (advisory check)

src/file_insight_mcp/harness.py

Common tool convention elements — NextAction, ToolFailure, truncation and line numbers

src/file_insight_mcp/server.py

MCP tool, resource, and prompt registration (harness layer)

src/file_insight_mcp/evalkit.py

Pure logic for path expressions, verdicts, and variable substitution in eval cases

evals/cases.jsonl

Deterministic regression cases (data, not code)

scripts/run_evals.py

Runner that executes cases over the actual MCP protocol

scripts/smoke_stdio.py

STDIO startup, schema, and harness convention smoke test

scripts/validate_package.py

Pre-release static checks (credentials, dangerous calls, tool annotations)

tests/

Domain function unit tests (run without starting the server)

SCAN → LIST → READ → EXTRACT → DRAFT → CHECK → PREVIEW → [사용자 승인] → SAVED

Step

Tool

Read/Write

Role

SCAN

scan_folder_structure

Read

Target folder structure, per-extension counts, allowed status

LIST

list_target_documents

Read

List of documents that can actually be read

READ

read_document_chunk

Read

View source text. Supports line range specification and L14 citation anchors

EXTRACT

extract_document_outline

Read

Extract table of contents (heading/numbering) structure

EXTRACT

extract_key_terms

Read

Extract key term candidates based on dates, numbers, and frequency

DRAFT

build_summary_prompt

Read

Generate a prompt combining all documents + the standard report format

CHECK

validate_report_draft

Read

Structure validation. Provides rule_id·severity·line·fix (save gate)

CHECK

check_summary_grounding

Read

Cross-check that filenames mentioned in the summary actually exist (advisory, does not block saving)

PREVIEW

diff_report_against_saved

Read

Check differences against the previously saved version

PREVIEW

preview_save_report

Read

Shows validation and diff together and issues an approval token

SAVED

save_approved_report

Write

Saves only when the approval token matches (the only write tool)

OBSERVE

list_saved_reports

Read

List of saved reports

OBSERVE

read_report_audit_log

Read

View the save audit log

Resources and prompts

Type

URI or name

Role

Resource

document://{relative_path}

Document source text

Resource

report://{report_id}

Saved summary report

Prompt

analyze_folder

Analysis workflow from scan to save approval

Harness design

This server treats not only functionality but also the way the model uses tools as a design target.

  • Every response includes stage and next_actions, so the model can choose the next tool from the response alone. blocking: true is a guidance hint meaning "do not skip this step." What actually blocks saving is structure validation and the approval token; the hint does not take over that role.

  • Errors are returned as ToolFailure with a cause code, recovery method, and selectable values. The goal is to let the model recover on its own without asking again.

  • Argument schemas are kept flat ({"relative_path": "..."}). Using Pydantic models as argument types would nest them as {"params": {...}} and change the call shape.

  • Return values are Pydantic models, so outputSchema is generated automatically.

  • Every tool has readOnlyHint / destructiveHint so the host can show a different approval UI for write tools.

  • Only certain checks (structure) block saving; heuristic checks (filename cross-check) are reported as warnings only.

Context budget

Following the principle that "the context window is not a dumping ground but a working-memory budget," every tool has an explicit cap on response size.

  • scan_folder_structure: If MAX_SCAN_ENTRIES (500) is exceeded, it reports truncated: true and truncates.

  • read_document: Files larger than MAX_FILE_BYTES (200KB) are not read in full; instead, an error guides the caller to read only part of the file via read_document_chunk.

  • extract_key_terms: Limits the number of items per category with max_terms.

  • preview_save_report: include_preview=False is the default, so a draft the model already has is not included in the response again. When it must be included, max_preview_chars limits the length.

  • harness.truncate() / harness.number_lines(): Always makes truncation status and citation anchors (line numbers) explicit so the model does not have to guess whether "this is the whole thing or part of it."

Safety boundaries

  • The server only handles security.TARGET_DIR (data/sample_docs/). It cannot access anything outside that directory via .., absolute paths, drive letters, or symbolic links (security.safe_relative_path).

  • Files outside the extension allowlist (.txt .md .csv .log) are not read. Executable/script extensions are always excluded from targets.

  • If a file exceeds MAX_FILE_BYTES (200KB), it is not read in full; an error guides the caller instead.

  • Hidden files and folders whose names start with . are excluded from scanning.

  • The only write tool is save_approved_report, which works only when the (report_id, body) hash token issued by preview_save_report matches.

  • This server only reads documents. If code or shell execution calls such as eval/exec/subprocess appear in the source, scripts/validate_package.py fails.

Verification

uv run pytest -q
uv run python scripts/smoke_stdio.py
uv run python scripts/run_evals.py
uv run python scripts/validate_package.py

The four commands each check different things, so all of them must pass.

Command

Scope of checks

Server startup

pytest -q

core·outline·grounding·security·evalkit domain functions

No

smoke_stdio.py

Tool registration, schema flatness, annotations, error message conventions

Yes

run_evals.py

Deterministic regression cases in evals/cases.jsonl

Yes

validate_package.py

Static checks for credential leaks, dangerous calls, tool annotations

No

run_evals.py includes the full save flow, covering whether saving succeeds or is rejected when the approval token is correct or incorrect. Whenever you fix a bug, add one line to evals/cases.jsonl with a case that reproduces that bug. See evals/README.md for the case syntax.

If you want to analyze a different folder

For safety, this project fixes the target folder to TARGET_DIR in src/file_insight_mcp/security.py (the data/sample_docs/ inside the package). To analyze a real work folder:

  1. Change TARGET_DIR to the desired absolute path, or modify it to be injected via an environment variable.

  2. Reflect the extensions that actually exist in that folder in ALLOWED_EXTENSIONS.

  3. First check that there are no sensitive subfolders (credentials, personal information, etc.).

Claude Desktop connection

Replace ABSOLUTE_PROJECT_PATH in config/claude_desktop_config.example.json with the absolute path of this folder, then apply it to the Claude Desktop configuration. You must fully quit the app and relaunch it.

Design principles

  • The MCP does not call any separate LLM API. Claude or Codex writes the summary sentences; this MCP handles the source text, structure, validation, and saving.

  • It never fabricates filenames, numbers, or dates not confirmed in the documents; the grounding checker mechanically cross-checks them.

  • Final saving requires both the approval token issued at preview and the user's explicit approval.

  • Domain logic (core, outline, grounding) is separated from tool conventions (server, harness, security).

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables real-time indexing and semantic search of local documents (PDF, Word, text, Markdown, RTF) using vector embeddings and local LLMs. Monitors folders for changes and provides natural language search capabilities through Claude Desktop integration.
    22
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Enables read-only analysis of local unstructured documents by scanning a folder, extracting text and structural metadata, and passing content with truncation and error-awareness to an LLM for summarization.
    9
  • A
    license
    A
    quality
    C
    maintenance
    Enables reading and extracting text from local documents (PDF, Word, Excel, PowerPoint, HWP, Markdown, CSV, etc.) without network access, and provides approval-gated summary saving and file organization.
    11
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jm333-B/temp_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server