Mcp File Processor

io.github.Opafex由 GitHub 帳號 Opafex 發布v0.1.1更新於 Oct 26, 2026

Text extraction, keyword extraction, language detection, and chunking for RAG

已驗證STDIO僅桌面檔案與儲存知識與記憶

概覽

AI 產生的概覽

本機 MCP 伺服器,可從 PDF、DOCX 及文字/程式碼檔案擷取文字,並進行關鍵字擷取、內容類型辨識與供 RAG 使用的文字切塊。

可以做什麼
  • 從 PDF、DOCX、CSV、JSON、Markdown、HTML 與程式碼檔案擷取文字,並回傳字數與頁數
  • 從文字擷取依詞頻排序的關鍵字,並過濾停用詞
  • 判斷內容是程式碼、自然語言或混合,可選擇辨識程式語言
  • 將文字切成帶位置中繼資料的重疊區塊,供 RAG 或向量化流程使用
  • 以單次呼叫完成單一檔案的全部處理
  • 回傳伺服器中繼資料、已註冊工具與資源,並提供支援類型的資源清單
適用情境
適合需要讓助理讀取 PDF 或 Word 文件、為文字加上標籤或建立索引,以及為嵌入與檢索準備文件的情境。也適合希望檔案留在本機處理的本機 RAG 前置作業。
執行需求
透過 npx 從 npm 套件 @opafex/mcp-file-processor 以 stdio 在本機執行,需要 Node.js 20 以上版本。不需要 API 金鑰、環境變數或標頭,僅支援桌面端。
安裝前請注意
檔案內容會以 base64 或原始文字傳給工具,助理送出的內容都會由此伺服器處理;README 說明全部在本機執行且不需 API 金鑰。這些工具只讀取與轉換內容,不會寫入、傳送或刪除資料。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp File Processor,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@opafex/mcp-file-processor

MCP server for universal text extraction, keyword extraction, language detection, and text chunking — designed for RAG pipelines.

Supports PDF, DOCX, CSV, JSON, Markdown, HTML, and code files. Zero platform dependencies.

Installation

bash
npm install @opafex/mcp-file-processor

Requires Node.js 20+.

Quick Start

Add to Claude Code / Claude Desktop

json
{  "mcpServers": {    "file-processor": {      "command": "npx",      "args": ["@opafex/mcp-file-processor"]    }  }}

No API keys needed — everything runs locally.

Tools

extract_text

Extract text content from a file.

ParameterTypeRequiredDescription
contentstringYesFile content — base64 for binary formats (PDF, DOCX), raw text for text formats
fileTypestringYesMIME type (e.g. "application/pdf") or extension (e.g. ".pdf", "pdf")
Example response
json
{  "success": true,  "text": "Extracted text content here...",  "wordCount": 142,  "pageCount": 3,  "processingTimeMs": 45}

extract_keywords

Extract ranked keywords from text. Filters stop words, sorted by frequency.

ParameterTypeRequiredDescription
textstringYesText to extract keywords from
limitnumberNoMax keywords to return (default: 20)
Example response
json
{  "success": true,  "keywords": [    { "word": "javascript", "frequency": 8 },    { "word": "framework", "frequency": 4 },    { "word": "react", "frequency": 3 }  ],  "totalWords": 156}

detect_language

Detect whether content is code, natural language, or mixed.

ParameterTypeRequiredDescription
textstringYesText to analyse
fileNamestringNoFile name for extension-based detection (e.g. "app.ts")
Example response
json
{  "success": true,  "contentType": "code",  "programmingLanguage": "typescript"}

chunk_text

Split text into overlapping chunks for RAG/embedding pipelines.

ParameterTypeRequiredDescription
textstringYesText to chunk
chunkSizenumberNoTarget chunk size in characters (default: 1000)
overlapnumberNoOverlap between chunks in characters (default: 200)
Example response
json
{  "success": true,  "chunks": [    { "index": 0, "text": "...", "startOffset": 0, "endOffset": 1000, "wordCount": 167 },    { "index": 1, "text": "...", "startOffset": 800, "endOffset": 1800, "wordCount": 172 }  ],  "totalChunks": 5,  "totalCharacters": 4200}

process_file

All-in-one: extract text, detect content type, extract keywords, and chunk.

ParameterTypeRequiredDescription
contentstringYesFile content (base64 or raw text)
fileTypestringYesMIME type or file extension
chunkSizenumberNoChunk size in characters (default: 1000)
chunkOverlapnumberNoOverlap in characters (default: 200)
keywordLimitnumberNoMax keywords (default: 20)

server_info (built-in)

Returns server metadata, registered tools, and resources.

Resources

ResourceDescription
file-processor://supported-typesLists all supported MIME types and file extensions

Supported Formats

FormatExtensionInput
PDF.pdfbase64
Word.docx, .docbase64
Plain text.txtraw text
Markdown.mdraw text
CSV.csvraw text
JSON.jsonraw text
HTML.htmlraw text
XML.xmlraw text
JavaScript.js, .jsx, .mjsraw text
TypeScript.ts, .tsxraw text
Python.pyraw text
Java.javaraw text
Go.goraw text
Rust.rsraw text
C/C++.c, .cpp, .hraw text

Development

bash
npm run build    # Compile TypeScriptnpm run dev      # Run with tsxnpm test         # Run testsnpm start        # Run compiled server

Library Usage

typescript
import { FileProcessorService } from '@opafex/mcp-file-processor/service';
const service = new FileProcessorService();
const result = await service.processFile(  'Hello world, this is a document.',  '.txt',  500,  // chunk size  100   // overlap);

Contributing

Found a bug or have a feature request? Open an issue.

License

MIT — see LICENSE.

來源:packages/file-processor/README.md,提交 f85607b

工具

6

extract_text

Extract text content from a file. Supports PDF, DOCX, CSV, JSON, Markdown, HTML, and code files. Pass file content as base64 (for binary formats like PDF/DOCX) or raw text (for text formats). Returns extracted text, word count, and processing time.

輸入參數content必填fileType必填

extract_keywords

Extract ranked keywords from text. Returns keywords sorted by frequency, useful for tagging, search indexing, and topic identification.

輸入參數text必填limit

detect_language

Detect whether content is code, natural language, or mixed. Optionally detects the programming language from file extension. Useful for routing content to appropriate processing pipelines.

輸入參數text必填fileName

chunk_text

Split text into overlapping chunks suitable for RAG/embedding pipelines. Configurable chunk size and overlap. Returns chunks with positional metadata.

輸入參數text必填overlapchunkSize

process_file

All-in-one file processing: extract text, detect content type, extract keywords, and chunk for RAG. Returns the complete processed result in a single call.

輸入參數content必填fileType必填chunkSizechunkOverlapkeywordLimit

server_info

Returns server metadata: name, version, registered tools, and registered resources. Useful for introspection and health checks.

無需輸入參數。

版本歷史

1
  1. v0.1.1最新Oct 25, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分