Mistral MCP — Document Extraction
mistral-mcp
Mistral AI の機能をあらゆる MCP クライアント(Claude Code、Cursor、Zed、Windsurf、Claude Desktop など)に提供する MCP サーバー
フランス語版: README.fr.md
目的
Mistral はフランス語、コード、OCR、モデレーション、音声、エージェント型ワークフローに優れたモデルを持っていますが、ほとんどの MCP 対応 IDE はデフォルトで Anthropic や OpenAI を使用します。mistral-mcp は、それらの Mistral の機能をクリーンな MCP インターフェースとして提供するため、エージェントループを再構築することなく、適切なサブタスクを適切なモデルにルーティングできます。
このリポジトリの目的は「単なる薄いラッパー」を作ることではありません。明確なスキーマ、予測可能な出力、トランスポートの柔軟性、そして優れたテストカバレッジを備えた、堅牢で保守性の高い MCP サーバーを目指しています。
Related MCP server: MCP Server TypeScript
現在の機能 (v0.4.0)
ツール (22)
コア生成:
mistral_chatmistral_chat_streammistral_embedmistral_tool_callcodestral_fim
ビジョンと音声:
mistral_visionmistral_ocrvoxtral_transcribevoxtral_speak
エージェントと分類器:
mistral_agentmistral_moderatemistral_classify
ファイルとバッチ:
files_uploadfiles_listfiles_getfiles_deletefiles_signed_urlbatch_createbatch_listbatch_getbatch_cancel
MCP ネイティブユーティリティ:
mcp_sample- MCP サンプリングを介してクライアントモデルに生成を委任します
リソース (2)
mistral://models- 利用可能なエイリアスとライブモデルカタログmistral://voices- Voxtral TTS 用のライブ音声カタログ
プロンプト (6)
フランス語の厳選プロンプト:
french_invoice_reminderfrench_meeting_minutesfrench_email_replyfrench_commit_messagefrench_legal_summary
英語の厳選プロンプト:
codestral_review
プロンプトの列挙型引数は completable() でラップされているため、MCP クライアントは completion/complete を介してプロンプト引数の補完を呼び出すことができます。
特徴
すべてのツールに
inputSchema、outputSchema、アノテーションを備えた高レベルなMcpServerAPIデュアルトランスポートサポート: デフォルトの stdio、およびリモートデプロイ用のストリーム配信可能な HTTP
あらゆる場所での構造化出力:
structuredContentとテキストフォールバックmcp_sampleによる MCP サンプリングのサポート列挙型のようなプロンプト引数に対するプロンプト補完のサポート
ツールと並行して登録されるリソースとプロンプト(後付けではありません)
Mistral SDK クライアントでのリトライ/バックオフおよびリクエストタイムアウト
トランスポート
Stdio
デフォルトモード。Claude Code やほとんどのローカル MCP クライアントで使用されます。
node dist/index.jsストリーム配信可能な HTTP
--http または MCP_TRANSPORT=http で有効にします。
MCP_TRANSPORT=http node dist/index.js関連する環境変数:
MCP_HTTP_HOST- デフォルト127.0.0.1MCP_HTTP_PORT- デフォルト3333MCP_HTTP_PATH- デフォルト/mcpMCP_HTTP_TOKEN- オプションのベアラートークンMCP_HTTP_ALLOWED_ORIGINS- オプションのカンマ区切り許可リストMCP_HTTP_STATELESS=1- ステートレスセッションモード
/healthz は意図的に公開されており、MCP サーバーにはアクセスしません。
インストール
git clone https://github.com/Swih/mistral-mcp.git
cd mistral-mcp
npm install
npm run buildAPI キーを設定します:
export MISTRAL_API_KEY=your_key_hereまたは、リポジトリルートの .env を使用してください。決してコミットしないでください。
Claude Code での使用
claude mcp add mistral -- node /absolute/path/to/mistral-mcp/dist/index.jsプロンプトの例:
この PDF に対して
mistral_ocrを使用し、抽出されたテキストに対してfrench_meeting_minutesを実行してください。
開発
npm run dev
npm run build
npm run lint
npm test
npm run inspectorテスト戦略
スイートには現在、4 つのレイヤーにわたる 148 個のテストが含まれています:
ツール、リソース、プロンプト、トランスポート、音声、エージェント、ファイル、バッチ、サンプリングのユニットテスト
ツールメタデータと MCP 準拠の保証に関するコントラクトテスト
MISTRAL_API_KEYが設定されている場合の実際の Mistral API に対するライブ API テストビルドされたサーバーに対する Stdio エンドツーエンドテスト
MISTRAL_API_KEY がない場合、ローカルのデフォルトは 139 passing と 9 gated(ライブ/stdio テスト)になります。
プロジェクト構成
mistral-mcp/
|-- src/
| |-- index.ts
| |-- transport.ts
| |-- tools.ts
| |-- tools-fn.ts
| |-- tools-vision.ts
| |-- tools-audio.ts
| |-- tools-agents.ts
| |-- tools-files.ts
| |-- tools-batch.ts
| |-- tools-sampling.ts
| |-- resources.ts
| `-- prompts.ts
|-- test/
|-- examples/
|-- .github/workflows/ci.yml
|-- package.json
`-- tsconfig.test.jsonステータス
v0.4.0 — リリース済み。v0.3.0 からの完全な差分については CHANGELOG.md を参照してください:
共有ヘルパー、ライブモデル + 音声カタログ、コントラクトテスト
ビジョン + OCR
音声文字起こし + 音声合成
エージェント + モデレーション + 分類
ファイル + バッチ API
ストリーム配信可能な HTTP トランスポート + MCP サンプリング
5 つのフランス語厳選プロンプト + 1 つの英語プロンプト + プロンプト引数補完
例
実行可能なスクリプトは examples/ にあります。examples/README.md を参照してください。
ライセンス
MIT Copyright Dayan Decamp
Available Tools
6 toolscodestral_fimCodestral fill-in-the-middle completionARead-only
Fill-in-the-middle code completion with Codestral.
Given prompt (code preceding the cursor) and suffix (code after the cursor),
Codestral writes the middle. Use for editor autocomplete scenarios, code-patching
agents, or structured refactors where you know the target boundaries.
Default stop tokens: [] — let the model decide. Override with stop if needed.
Inputs: prompt (required), suffix (required), seed, stop, +4 more. Returns: text, model, usage, finish_reason
mistral_chatMistral chat completionARead-only
Generate a chat completion using a Mistral model.
When to use:
Drafting French (or any European-language) content where Mistral shines.
Codestral for code-specific generation/review.
Ministral for cheap / low-latency classification.
Returns structured content with the assistant text and token usage. Does NOT stream — use mistral_chat_stream for long outputs with progress updates.
Inputs: messages (required), seed, model, top_p, +4 more. Returns: text, model, usage, finish_reason, +1 more
mistral_ocrMistral OCR (document to markdown)ARead-onlyIdempotent
Run Mistral OCR on a PDF or image, returning structured markdown per page.
Input document is one of:
{ type: "document_url", documentUrl: "https://...pdf" }
{ type: "image_url", imageUrl: "https://..." | "data:image/..." }
{ type: "file", fileId: "" }
Options:
pages: array of 0-indexed page numbers or string like "0-5,7".tableFormat: 'markdown' (default) or 'html'.extractHeader/extractFooter: include page header/footer when present.includeImageBase64: embed extracted image bytes as base64 in the response.document_annotation_format: JSON schema for whole-document structured extraction.bbox_annotation_format: JSON schema for extracted image / bbox annotations.confidence_scores_granularity: 'page', 'word', or 'block'. 'block' adds per-block content/type confidence underpages[].blocks[].confidence_scoresand requires OCR 4.1 or newer.includeBlocks: return paragraph-level blocks (bounding box + type) in reading order — titles, lists, tables, images, equations, captions, code, references, aside text, header, footer, signature. Requires OCR 4 (mistral-ocr-4-0) or newer; older models accept the flag but return an emptyblocksarray.
Returns pages[].markdown plus optional pages[].hyperlinks, header, footer,
images bounding boxes, blocks, annotations, confidence scores, and dimensions.
Inputs: document (required), model, pages, imageLimit, +10 more. Returns: model, pages, usage, annotations, +2 more
mistral_visionMistral multimodal chat (vision)ARead-only
Chat completion with multimodal input: text + image_url parts.
Requires a vision-capable model. Accepted:
pixtral-large-latest
pixtral-12b-latest
mistral-large-latest
mistral-medium-latest
mistral-small-latest
Each message's content is either a plain string (pure text) or an array of
parts { type: 'text', text } / { type: 'image_url', imageUrl }. The image URL
can be an https URL or a data: URI base64 payload.
Returns the assistant text + token usage. For non-visual requests, prefer mistral_chat.
Inputs: messages (required), seed, model, top_p, +2 more. Returns: text, model, usage, finish_reason
process_documentProcess a business document end-to-endARead-onlyIdempotent
Single-call pipeline: provided text/Markdown or Mistral OCR → classify (if kind=auto) → typed extraction → validation. source.type=text skips OCR and Files uploads. Text with kind=generic makes no API calls; classification and typed extraction use Mistral chat. Results expose extraction_source. Provided text has null ocr_confidence and page_count; ocr_text contains the supplied text unchanged. Replaces the manual chain of mistral_ocr + mistral_chat + JSON parsing.
Kinds: contract | invoice | id_document | generic. Use kind=auto to let the server classify.
Returns a discriminated union — switch on kind to access typed fields.
Validation checks schema and, for OCR sources, OCR confidence; not factual or accounting accuracy.
Typed extraction rejects text longer than 60000 characters rather than truncating it.
Cache keys include source, kind, page limit, endpoint, models and pipeline version. Override location with MISTRAL_MCP_CACHE_DIR. Override mode with options.cache. Default cache mode is 'read_write' EXCEPT for kind=id_document (auto-bypass to avoid persisting PII). Set options.cache='read_write' explicitly to opt in for id documents.
options.maxPages and options.minOcrConfidence apply only to OCR sources. The confidence floor defaults to 0.3. Below the floor the
tool returns isError. Missing or partial confidence scores also return isError;
use mistral_ocr directly if you need raw OCR without a confidence guarantee.
0.3 is a conservative starting point, not a measured one: calibrate it for your
corpus with npm run eval:docs.
Inputs: source (required), kind, options. Returns: dob, kind, name, total, +22 more
voxtral_transcribeVoxtral speech-to-textARead-onlyIdempotent
Transcribe an audio file to text using Mistral Voxtral.
Accepted models:
voxtral-mini-latest
voxtral-small-latest
Audio source is one of:
{ type: "file_url", fileUrl: "https://..." } (public URL)
{ type: "file", fileId: "" }
Options:
language: ISO-639-1 hint (e.g. 'fr', 'en'). Boosts accuracy when known.temperature: sampling temperature.diarize: return per-speaker segments (default false).timestampGranularities: ['segment'] to return per-segment timestamps.contextBias: list of phrases/terms that should bias the decoder.
Returns plain text, detected language, optional segments[], and token usage.
Inputs: audio (required), model, diarize, language, +3 more. Returns: text, model, usage, language, +1 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct modality/action: code FIM, text chat, OCR, vision chat, document pipeline, and audio transcription. There is minor overlap between mistral_chat and mistral_vision (both chat) and between process_document and mistral_ocr, but the descriptions explicitly steer selection, so confusion is limited.
Names mix provider-prefixed conventions (codestral_fim, mistral_chat, mistral_ocr, mistral_vision, voxtral_transcribe) with a plain action name (process_document). The pattern is somewhat readable but not a predictable verb_noun scheme and the provider prefixes fragment consistency.
Six tools is well-scoped for a multimodal Mistral wrapper, with each tool covering a distinct capability rather than redundancy. Slightly broad for a server named 'Document Extraction' since it also includes code completion and chat, but not excessive.
Covers OCR, vision, chat, transcription, and a combined pipeline, but several tools reference a Files API (fileId) that is not exposed as a tool, creating a dead-end for uploading files. No model-listing or file-management operations leave workflows partially blocked.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for progressive tool usage at any scale (see https://klavis.ai)
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Related MCP Servers
- -licenseNot gradedqualityDmaintenanceA TypeScript implementation of a Model Context Protocol server and client that enables interaction with language models (specifically Mistral running on Ollama).-
- -licenseNot gradedqualityNot gradedmaintenanceA production-ready TypeScript MCP server providing basic tools (add, echo, timestamp), resources (server info, greetings, data access), and prompt templates (analyze, code-review, summarize). Serves as a foundation for building custom MCP servers with extensible architecture.547 npm-
- AlicenseBqualityDmaintenanceA TypeScript-based MCP server that provides tools to interact with local Codex and Gemini CLIs via stdio transport. It enables users to execute prompts through the ask_codex and ask_gemini tools, supporting custom models and timeout configurations.111 npm6MIT
- FlicenseAqualityDmaintenanceA TypeScript MCP server template with Zod validation, dual transport (stdio/HTTP), and modular architecture for building MCP-compatible tools, resources, and prompts.11-