{"id":14967,"date":"2025-05-30T17:07:50","date_gmt":"2025-05-30T17:07:50","guid":{"rendered":"https:\/\/unstractnew.wpenginepowered.com\/?p=14967"},"modified":"2025-12-18T06:59:08","modified_gmt":"2025-12-18T06:59:08","slug":"unstract-mcp-server","status":"publish","type":"post","link":"https:\/\/unstract.com\/blog\/unstract-mcp-server\/","title":{"rendered":"Unstract MCP Server: Document Processing Automation on the Go"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Given the complex data ecosystems that we have today, the ability to seamlessly connect intelligent APIs with familiar development and productivity tools is no longer a luxury\u2014it\u2019s a necessity.<\/p>\n\n\n\n<p>This article provides an in-depth walkthrough of Unstract\u2019s MCP (Model Context Protocol) Server and demonstrates how it can be integrated with popular MCP hosts such as Cursor and Claude Desktop.<\/p>\n\n\n\n<p>Through a working demonstration, you\u2019ll see exactly how Unstract turns complex document extraction workflows into a few simple API calls, all from within the applications you already use every day.<\/p>\n\n\n\n<p>By the end of this guide, you will have a clear understanding of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Unstract\u2019s MCP capabilities<\/strong> \u2013 how the server implements the MCP specification to deliver context-aware extraction services.<\/li>\n\n\n\n<li><strong>Host integration<\/strong> \u2013 the steps required to hook Unstract into Cursor and Claude Desktop, enabling in-app querying of source documents without switching contexts.<\/li>\n\n\n\n<li><strong>Practical use cases<\/strong> \u2013 real-world scenarios showing how data engineers and insurance underwriters can dramatically speed up their workflows.<\/li>\n<\/ul>\n\n\n\n<p>For customers and prospects evaluating document-extraction platforms, knowing that Unstract is fully MCP-ready means you can plug it into your existing toolchain with minimal friction.<\/p>\n\n\n\n<p>Whether you\u2019re embedding extraction logic in a developer IDE or empowering business teams with conversational AI assistants, Unstract\u2019s MCP Server ensures that your organization can scale intelligent data access wherever it\u2019s needed most.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Understanding the MCP Ecosystem<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is an MCP Server?<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>The <strong>Model Context Protocol (MCP)<\/strong> is an open specification designed to standardize how AI models\u2014particularly large language models\u2014interact with external tools, data sources, and applications.<\/p>\n\n\n\n<p>At its core, MCP defines:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>A unified API surface<\/strong>: A consistent set of endpoints and message formats that any compliant client or server can implement.<\/li>\n\n\n\n<li><strong>A discoverable tool registry<\/strong>: A way for AI clients to learn what \u201ctools\u201d (e.g., document extractors, search engines, calculators) a host application can expose.<\/li>\n\n\n\n<li><strong>Contextual execution semantics<\/strong>: A protocol for passing rich context (prompts, metadata, user inputs) along with tool invocations, so the model can reason about which tool to call and how to interpret its response.<\/li>\n<\/ul>\n\n\n\n<p>An <strong>MCP server<\/strong> sits at the heart of this ecosystem as the \u201ctool provider\u201d:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1-1024x1024.png\" alt=\"\" class=\"wp-image-14971\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1-1024x1024.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1-300x300.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1-150x150.png 150w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1-768x768.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1-180x180.png 180w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1-79x79.png 79w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp1.png 1080w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Tool Catalog &amp; Metadata<\/strong>: It advertises the set of extraction routines, prompt templates, and helper functions that AI clients can invoke.<\/li>\n<\/ol>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Request Dispatcher<\/strong>: It receives standardized MCP calls from AI hosts (e.g., \u201cextract loan terms from this PDF\u201d), maps them to the appropriate internal routines or microservices, and returns structured results.<\/li>\n<\/ol>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Context Manager<\/strong>: It maintains session state and shared context\u2014document locations, user preferences, authentication tokens\u2014so that multi-step or conversational workflows remain coherent.<\/li>\n<\/ol>\n\n\n\n<p>By conforming to MCP, Unstract\u2019s MCP server becomes a drop-in component for any host or client that speaks the protocol, ensuring seamless, context-aware integration across IDEs, chat interfaces, and automated pipelines.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why MCP Matters<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>Modern AI-driven workflows often span multiple tools, data repositories, and user interfaces\u2014each with its own API or plugin model.<\/p>\n\n\n\n<p>MCP unifies these disparate components under a single, well-defined contract, delivering three key advantages:<\/p>\n\n\n\n<p><strong>Enhanced Productivity for Developers &amp; Data Engineers<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Rapid tooling adoption<\/strong>: Rather than writing bespoke adapters for every new service or model, teams implement MCP once and immediately gain access to any compliant host or server.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Consistent debugging<\/strong>: Standardized request and response formats mean logs, error messages, and test harnesses work the same way across all integrations, reducing cognitive overhead when troubleshooting.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Extensible architecture<\/strong>: Adding new extraction routines, prompt templates, or data sources is as simple as registering them in the MCP server\u2019s catalog\u2014no changes required in the host application.<\/li>\n<\/ul>\n\n\n\n<p><strong>Empowered Analysts &amp; Business Users<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>In-app querying<\/strong>: Analysts can submit natural-language queries (e.g., \u201cWhat are the key terms in this contract?\u201d) directly from their IDE or chat assistant, rather than exporting and reimporting documents across multiple tools.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Self-service insights<\/strong>: By surfacing extraction capabilities as discoverable \u201ctools,\u201d MCP enables non-technical users to explore and leverage advanced features without writing custom scripts.<\/li>\n<\/ul>\n\n\n\n<p><strong>Seamless Integration &amp; Reduced Context-Switching<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Single pane of glass<\/strong>: Whether you\u2019re in Cursor, Claude Desktop, or another MCP-enabled host, the interface for invoking document-extraction, search, or transformation remains identical.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Fluid workflows<\/strong>: Engineers no longer juggle multiple windows or manual data transfers\u2014every step from prompt formulation to API invocation happens inline, preserving focus and minimizing interruptions.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Consistent security boundary<\/strong>: Authentication, authorization, and auditing are centralized in the MCP server, so hosts don\u2019t need custom security logic for each integration.<\/li>\n<\/ul>\n\n\n\n<p>By adopting MCP, organizations gain a future-proof integration layer that scales with evolving AI capabilities\u2014delivering faster time-to-value, lower maintenance costs, and a better end-user experience across teams.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Components of an MCP Ecosystem<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>An MCP ecosystem is built around three fundamental elements, each playing a distinct role in enabling seamless AI\u2013tool interoperability:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1-1024x1024.png\" alt=\"unstract mcp server\" class=\"wp-image-14972\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1-1024x1024.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1-300x300.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1-150x150.png 150w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1-768x768.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1-180x180.png 180w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1-79x79.png 79w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-mcp-1.png 1080w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p><strong>MCP Host<\/strong><br>The host is the client application that initiates MCP calls and presents results to the user.<\/p>\n\n\n\n<p>Examples include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Claude Desktop<\/strong>: A chat-based interface that can call out to external tools to enrich its conversational context.<\/li>\n\n\n\n<li><strong>Cursor<\/strong>: Developer-focused environments where code editors and terminals can embed MCP-triggered panels or command palettes for in-IDE queries.<\/li>\n\n\n\n<li><strong>Custom Python Scripts<\/strong>: Lightweight scripts to invoke MCP endpoints directly for ad-hoc data extraction or automation tasks.<\/li>\n\n\n\n<li><strong>Business Intelligence Platforms<\/strong>: BI tools (e.g. Tableau, Power BI) with MCP plugins that allow end users to run natural-language extraction queries on connected document repositories.<\/li>\n<\/ul>\n\n\n\n<p><strong>MCP Server<\/strong><br>The server acts as the \u201ctool provider,\u201d implementing the MCP specification to expose and execute a catalog of services.<\/p>\n\n\n\n<p>For Unstract\u2019s MCP server, this includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Extraction routines<\/strong> for PDFs, Word docs, insurance forms, and more.<\/li>\n\n\n\n<li><strong>Prompt templates<\/strong> and helper functions for specialized tasks (e.g., table parsing, key-value extraction).<\/li>\n\n\n\n<li><strong>Session management<\/strong> to track user context and maintain authentication across multiple requests.<\/li>\n<\/ul>\n\n\n\n<p><strong>Communication Layer<\/strong><br>This is the standardized protocol that glues hosts and servers together.<\/p>\n\n\n\n<p>It consists of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>API Endpoints<\/strong>: Well-defined HTTP routes (e.g., \/mcp\/discover, \/mcp\/invoke) that hosts use to fetch tool metadata and submit execution requests.<\/li>\n\n\n\n<li><strong>Message Formats<\/strong>: JSON schemas for tool descriptions, invocation payloads (prompt, parameters, document references), and structured responses (extracted fields, debug logs).<\/li>\n\n\n\n<li><strong>Context Tokens<\/strong>: Session or conversation identifiers that flow with each request, ensuring that multi-turn or stateful workflows remain coherent.<\/li>\n<\/ul>\n\n\n\n<p>Together, these components form a flexible, extensible framework: hosts consume the server\u2019s available tools through the communication layer, while the server handles execution, context management, and result formatting\u2014allowing users to focus on solving domain problems rather than plumbing.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introducing the Unstract MCP Server<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Unstract\u2019s MCP Server is a purpose-built implementation of the Model Context Protocol, combining Unstract\u2019s leading document-extraction engine with a standardized, discoverable tool interface.<\/p>\n\n\n\n<p>By packaging extraction routines, prompt templates, and session management into a single, MCP-compliant service, it enables rapid integration across a range of AI hosts and developer environments.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What Makes Unstract\u2019s MCP Server Unique<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Native Prompt Studio Integration<\/strong>: Unstract\u2019s no-code Prompt Studio sits alongside the MCP server, enabling prompt engineers to spin up new extraction workflows (e.g., key-value mappings, table parsers) from sample documents in minutes\u2014automatically exposed as MCP tools.<\/p>\n\n\n\n<p><strong>End-to-End Extraction Engine<\/strong>: Under the hood, the same high-accuracy, layout-preserving extraction pipeline that powers Unstract\u2019s API is leveraged by the MCP server, ensuring consistent results whether you call the API directly or via an MCP host.<\/p>\n\n\n\n<p><strong>Built-in Session &amp; Context Management<\/strong>: The server maintains conversation and extraction state\u2014document pointers, authentication tokens, user preferences\u2014eliminating the need for hosts to re-implement context tracking for multi-turn workflows.<\/p>\n\n\n\n<p><strong>Robust Error Handling &amp; Observability<\/strong> Timeouts, retries, configurable back-off, and detailed logs make MCP integrations reliable and easy to debug in production.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Capabilities and Compatibility<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Full MCP Specification Compliance<\/strong>: Supports MCP discovery (\/mcp\/discover), invocation (\/mcp\/invoke), and context propagation endpoints, making it a drop-in tool provider for any MCP-enabled host.<\/p>\n\n\n\n<p><strong>Flexible Deployment Models<\/strong>: Can run as a standalone container behind your firewall, in a public cloud, or as part of a managed Unstract platform\u2014giving you control over data residency, scaling, and security.<\/p>\n\n\n\n<p><strong>Language &amp; Framework Agnostic<\/strong>: Works with any host capable of HTTP\/JSON calls: chat clients (Claude Desktop), IDEs (Cursor), orchestration frameworks (LangChain), custom scripts, notebooks, and BI tools.<\/p>\n\n\n\n<p><strong>Multi-Tenant &amp; Configurable<\/strong>: Namespace isolation, per-project API keys, and environment-driven configurations allow teams to share a single MCP server instance without stepping on each other\u2019s toes.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setup Guide: Deploying an MCP-Ready Project with Unstract<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Unstract\u2019s <strong>Prompt Studio<\/strong> is the interface where users design, test, and refine AI-powered extraction workflows\u2014all without writing a single line of code.<\/p>\n\n\n\n<p>These projects form the core of what is ultimately exposed as tools via an Unstract MCP Server.<\/p>\n\n\n\n<p>In this section, we\u2019ll walk through how to create and deploy a Prompt Studio project that extracts key fields from structured or semi-structured documents, such as insurance or loan forms.<\/p>\n\n\n\n<p>For the examples in this section, we will use a loan form:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"724\" height=\"1024\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/unstract-mcp-document-sample1-724x1024.png\" alt=\"\" class=\"wp-image-15120\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/unstract-mcp-document-sample1-724x1024.png 724w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/unstract-mcp-document-sample1-212x300.png 212w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/unstract-mcp-document-sample1-768x1086.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/unstract-mcp-document-sample1-1086x1536.png 1086w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/unstract-mcp-document-sample1.png 1414w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>And an insurance form:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"1024\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/acord-insurance-document-forunstract-mcp-server-724x1024.png\" alt=\"\" class=\"wp-image-15122\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/acord-insurance-document-forunstract-mcp-server-724x1024.png 724w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/acord-insurance-document-forunstract-mcp-server-212x300.png 212w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/acord-insurance-document-forunstract-mcp-server-768x1086.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/acord-insurance-document-forunstract-mcp-server-1086x1536.png 1086w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/05\/acord-insurance-document-forunstract-mcp-server.png 1414w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>The result: an API-ready tool that can be invoked from any MCP host like Claude Desktop or Cursor.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Getting Started<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>First, visit the <a href=\"https:\/\/unstract.com\/start-for-free\/\">Unstract website<\/a> and create a free account.<\/p>\n\n\n\n<p>You\u2019ll gain access to a 14-day trial with $10 in LLM credits, giving you immediate access to Prompt Studio and Unstract\u2019s advanced extraction engine.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a New Prompt Studio Project<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Navigate to <strong>Prompt Studio<\/strong>.<\/li>\n\n\n\n<li>Click <strong>New Project<\/strong>, and give it a name like Loan Estimate.<\/li>\n\n\n\n<li>Upload your test document (e.g., a Loan Estimate form) under <strong>Manage Documents<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>Now you&#8217;re ready to start crafting prompts that extract structured data from the form.<\/p>\n\n\n\n<p><strong>Example Prompt 1<\/strong> \u2013 Personal Information:&nbsp;<br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server1-1024x576.png\" alt=\"\" class=\"wp-image-14973\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server1-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server1-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server1-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server1-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server1.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>Extract the first name, last name, home address, city, state, and zip code. Return JSON with these exact field names.\n<\/code><\/pre><\/div>\n\n\n\n<p>Make sure the <strong>output format is set to JSON<\/strong>. On running the prompt, the response will be a structured object like:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n    &quot;city&quot;: &quot;Anytown&quot;,\n    &quot;first name&quot;: &quot;Michael&quot;,\n    &quot;home address&quot;: &quot;123 Anywhere Street&quot;\n    &quot;last name&quot;: &quot;Jones&quot;,\n    &quot;state&quot;: &quot;ST&quot;,\n    &quot;zip code&quot;: &quot;12345&quot;\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Example Prompt 2<\/strong> \u2013 Loan Terms:&nbsp;<br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server2-1024x576.png\" alt=\"\" class=\"wp-image-14974\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server2-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server2-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server2-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server2-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server2.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>Extract the loan amount, interest rate and monthly principal. Return JSON with these exact field names.\n<\/code><\/pre><\/div>\n\n\n\n<p>Make sure the <strong>output format is set to JSON<\/strong>. On running the prompt, the response will be a structured object like:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n    &quot;interest rate&quot;: &quot;3.875%&quot;,\n\n    &quot;loan amount&quot;: &quot;$162,000&quot;,\n\n    &quot;monthly principal&quot;: &quot;$761.78&quot;\n\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<p>You can test and iterate on your prompts until extraction is accurate and repeatable.<\/p>\n\n\n\n<p>The combined output should be similar to:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  &quot;personal_details&quot;: {\n    &quot;city&quot;: &quot;Anytown&quot;,\n    &quot;first name&quot;: &quot;Michael&quot;,\n    &quot;home address&quot;: &quot;123 Anywhere Street&quot;,\n    &quot;last name&quot;: &quot;Jones&quot;,\n    &quot;state&quot;: &quot;ST&quot;,\n    &quot;zip code&quot;: &quot;12345&quot;\n  },\n  &quot;loan_terms&quot;: {\n    &quot;interest rate&quot;: &quot;3.875%&quot;,\n    &quot;loan amount&quot;: &quot;$162,000&quot;,\n    &quot;monthly principal&quot;: &quot;$761.78&quot;\n  }\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Deploying as an API (MCP-Ready)<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>Once your prompts are configured and tested, you can deploy the project as an API\u2014which will enable it to be used with the Unstract MCP server.<\/p>\n\n\n\n<p><strong>Step 1: Export as Tool<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In Prompt Studio, click <strong>Export as Tool<\/strong> (top-right corner).<\/li>\n\n\n\n<li>This action makes your prompt logic callable from any MCP-compatible host.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Create a Workflow<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to <strong>BUILD \u2192 Workflows<\/strong>.<\/li>\n\n\n\n<li>Click <strong>+ New Workflow<\/strong>, and drag your tool (e.g., Loan Estimate) into the editor.<\/li>\n\n\n\n<li>This workflow defines the logic and order of operations that the server will execute.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server3-1024x576.png\" alt=\"\" class=\"wp-image-14975\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server3-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server3-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server3-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server3-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server3.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p><strong>Step 3: Deploy API<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to <strong>MANAGE \u2192 API Deployments<\/strong>.<\/li>\n\n\n\n<li>Click <strong>+ API Deployment<\/strong> and select your workflow.<\/li>\n\n\n\n<li>The deployment page provides management tools:\n<ul class=\"wp-block-list\">\n<li>Generate API keys<\/li>\n\n\n\n<li>Download a Postman collection for testing<\/li>\n\n\n\n<li>Monitor logs and usage<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server4-1024x576.png\" alt=\"\" class=\"wp-image-14976\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server4-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server4-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server4-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server4-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server4.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>You can repeat the same steps for the insurance form. At the end, you should have a JSON output for the insurance form similar to:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  &quot;personal_details&quot;: {\n    &quot;email&quot;: &quot;john@surelogic.com&quot;,\n    &quot;name&quot;: &quot;John Updike&quot;,\n    &quot;phone&quot;: &quot;(555) 674 9940&quot;\n  },\n  &quot;line_business&quot;: {\n    &quot;BOILER & MACHINERY&quot;: &quot;$9000&quot;,\n    &quot;BUSINESS AUTO&quot;: &quot;$89900&quot;,\n    &quot;COMMERCIAL PROPERTY&quot;: &quot;$900&quot;,\n    &quot;MOTOR TRUCKERS&quot;: &quot;$3000&quot;,\n    &quot;YACHT&quot;: &quot;$4000&quot;\n  }\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<p>And the corresponding API:<br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-5-1024x576.png\" alt=\"\" class=\"wp-image-14977\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-5-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-5-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-5-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-5-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-5.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Use Case Demonstrations<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Use Case 1: Integration with Cursor<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Scenario<\/strong>: A data engineer queries a PDF source document (e.g., Loan Estimate) directly via Unstract API inside the Cursor chat.<\/p>\n\n\n\n<p>Open &#8216;Cursor Settings&#8217; and navigate to the option &#8216;MCP&#8217;:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-6-1024x576.png\" alt=\"\" class=\"wp-image-14978\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-6-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-6-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-6-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-6-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/unstract-platform-mcp-server-6.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>Then click on &#8216;Add new global MCP server&#8217;:<br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-7-1024x576.png\" alt=\"\" class=\"wp-image-14979\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-7-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-7-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-7-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-7-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-7.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>Fill in the following information:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  &quot;mcpServers&quot;: {\n        &quot;unstract_tool&quot;:{\n            &quot;command&quot;: &quot;\/usr\/local\/bin\/docker&quot;,\n            &quot;args&quot;: [\n                &quot;run&quot;,\n                &quot;-i&quot;,\n                &quot;--rm&quot;,\n                &quot;-v&quot;,\n                &quot;\/tmp:\/tmp&quot;,\n                &quot;-e&quot;,\n                &quot;UNSTRACT_API_KEY&quot;,\n                &quot;-e&quot;,\n                &quot;API_BASE_URL&quot;,\n                &quot;unstract\/mcp-server&quot;,\n                &quot;unstract&quot;\n            ],\n            &quot;env&quot;: {\n                    &quot;UNSTRACT_API_KEY&quot;: &quot;&quot;,\n                    &quot;API_BASE_URL&quot;: &quot;https:\/\/us-central.unstract.com\/deployment\/api\/.....\/&quot;\n            }\n        }\n    }\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<p>If on Windows, then:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  &quot;mcpServers&quot;: {\n    &quot;unstract_tool&quot;: {\n      &quot;command&quot;: &quot;docker&quot;,\n      &quot;args&quot;: [\n        &quot;run&quot;,\n        &quot;-i&quot;,\n        &quot;--rm&quot;,\n        &quot;-v&quot;,\n        &quot;d:\\\\:\/tmp&quot;,\n        &quot;-e&quot;,\n        &quot;UNSTRACT_API_KEY&quot;,\n        &quot;-e&quot;,\n        &quot;API_BASE_URL&quot;,\n        &quot;unstract\/mcp-server&quot;,\n        &quot;unstract&quot;\n      ],\n      &quot;env&quot;: {\n                    &quot;UNSTRACT_API_KEY&quot;: &quot;&quot;,\n                    &quot;API_BASE_URL&quot;: &quot;https:\/\/us-central.unstract.com\/deployment\/api\/.....\/&quot;\n      }\n    }\n  }\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<p>Make sure to replace UNSTRACT_API_KEY and API_BASE_URL with your correct information as shown in the previous section.<\/p>\n\n\n\n<p>And fill in your appropriate folder where the documents will be placed.<\/p>\n\n\n\n<p>Once the Docker container starts up, you will see a list of available tools:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-8-1024x576.png\" alt=\"\" class=\"wp-image-14980\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-8-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-8-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-8-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-8-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-8.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p><strong>Note<\/strong>: If it doesn&#8217;t show the green icon, click the refresh icon to restart it.<\/p>\n\n\n\n<p>Open a chat and process the document:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-9-1024x576.png\" alt=\"\" class=\"wp-image-14981\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-9-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-9-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-9-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-9-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-9.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p><strong>Note:<\/strong> In case there is an error message mentioning &#8216;file not found&#8217;, restart Cursor to make sure the MCP server can find the correct file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Use Case 2: Integration with Claude Desktop<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Scenario<\/strong>: An insurance underwriter queries an Acord Insurance document using Claude Desktop + Unstract API.<\/p>\n\n\n\n<p>First, start by downloading and installing Claude Desktop if you have not done so already: <a href=\"https:\/\/claude.ai\/download\">https:\/\/claude.ai\/download<\/a><\/p>\n\n\n\n<p>After installing and logging in, navigate to the menu &#8216;File-&gt;Settings&#8217; and then &#8216;Developer&#8217;:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-10-1024x576.png\" alt=\"\" class=\"wp-image-14982\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-10-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-10-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-10-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-10-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-10.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>Click on &#8216;Edit Config&#8217; and it will navigate to the location of the file claude_desktop_config.json.&nbsp;<\/p>\n\n\n\n<p>Open the file in your preferred text editor and fill in the corresponding information:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  &quot;mcpServers&quot;: {\n        &quot;unstract_tool&quot;:{\n            &quot;command&quot;: &quot;\/usr\/local\/bin\/docker&quot;,\n            &quot;args&quot;: [\n                &quot;run&quot;,\n                &quot;-i&quot;,\n                &quot;--rm&quot;,\n                &quot;-v&quot;,\n                &quot;\/tmp:\/tmp&quot;,\n                &quot;-e&quot;,\n                &quot;UNSTRACT_API_KEY&quot;,\n                &quot;-e&quot;,\n                &quot;API_BASE_URL&quot;,\n                &quot;unstract\/mcp-server&quot;,\n                &quot;unstract&quot;\n            ],\n            &quot;env&quot;: {\n                    &quot;UNSTRACT_API_KEY&quot;: &quot;&quot;,\n                    &quot;API_BASE_URL&quot;: &quot;https:\/\/us-central.unstract.com\/deployment\/api\/.....\/&quot;\n            }\n        }\n    }\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<p>If on Windows, then:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  &quot;mcpServers&quot;: {\n    &quot;unstract_tool&quot;: {\n      &quot;command&quot;: &quot;docker&quot;,\n      &quot;args&quot;: [\n        &quot;run&quot;,\n        &quot;-i&quot;,\n        &quot;--rm&quot;,\n        &quot;-v&quot;,\n        &quot;d:\\\\:\/tmp&quot;,\n        &quot;-e&quot;,\n        &quot;UNSTRACT_API_KEY&quot;,\n        &quot;-e&quot;,\n        &quot;API_BASE_URL&quot;,\n        &quot;unstract\/mcp-server&quot;,\n        &quot;unstract&quot;\n      ],\n      &quot;env&quot;: {\n                    &quot;UNSTRACT_API_KEY&quot;: &quot;&quot;,\n                    &quot;API_BASE_URL&quot;: &quot;https:\/\/us-central.unstract.com\/deployment\/api\/.....\/&quot;\n      }\n    }\n  }\n}\n\n<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Make sure to replace UNSTRACT_API_KEY and API_BASE_URL with your correct information as shown in the previous section.<\/p>\n\n\n\n<p>And fill in your appropriate folder where the documents will be placed.<\/p>\n\n\n\n<p>Restart Claude Desktop for changes to take effect.&nbsp;<\/p>\n\n\n\n<p>After restarting, create a new chat and you should have access to the unstract_tool:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-11-1024x576.png\" alt=\"\" class=\"wp-image-14983\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-11-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-11-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-11-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-11-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-11.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>You can type the following prompt:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>process the document at \/tmp\/ACORD-Insurance-form.pdf<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>On the first use of the unstract_tool, Claude Desktop will ask for confirmation:<br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-12-1024x576.png\" alt=\"\" class=\"wp-image-14984\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-12-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-12-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-12-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-12-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-12.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>You can allow always or only once, according to your preferences.<\/p>\n\n\n\n<p>After processing, you will have the following output:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-13-1024x576.png\" alt=\"\" class=\"wp-image-14985\" srcset=\"https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-13-1024x576.png 1024w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-13-300x169.png 300w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-13-768x432.png 768w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-13-1536x864.png 1536w, https:\/\/unstract.com\/wp-content\/uploads\/2025\/06\/mcp-server-unstract-13.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Use Case 3: Custom Python Script<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p>Another way to use the Unstract MCP server is in a Python script with StdioServerParameters, which is a Langchain MCP adapter.<\/p>\n\n\n\n<p>In this example, we will also use a Mistral AI chat model, for which you will need an API key, which can be generated at the <a href=\"https:\/\/admin.mistral.ai\/organization\/api-keys\">&#8216;API Keys&#8217;<\/a> section in the Admin panel.<\/p>\n\n\n\n<p>Let&#8217;s start by initializing a uv project:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>uv init .<\/code><\/pre><\/div>\n\n\n\n<p>Create a virtual environment and activate it:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>uv venv<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>.venv\\Scripts\\activate<\/code><\/pre><\/div>\n\n\n\n<p>Then install the requirements:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>uv pip install -r requirements.txt<\/code><\/pre><\/div>\n\n\n\n<p>For reference, the requirements are:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>langchain-mistralai\npython-dotenv\nlangchain-mcp-adapters\nlanggraph\n<\/code><\/pre><\/div>\n\n\n\n<p>Next, you need to create an .env file with :<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>MISTRALAI_API_KEY=&lt;YOUR_MISTRALAI_API_KEY&gt;\nUNSTRACT_API_KEY=&lt;YOUR_UNSTRACT_API_KEY&gt;\nAPI_BASE_URL=&lt;YOUR_API_BASE_URL&gt;\n<\/code><\/pre><\/div>\n\n\n\n<p>Make sure to replace them with your appropriate values.<br>Then create the main.py file:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code># Imports\nfrom mcp import ClientSession, StdioServerParameters\nfrom mcp.client.stdio import stdio_client\nfrom langchain_mcp_adapters.tools import load_mcp_tools\nfrom langgraph.prebuilt import create_react_agent\nfrom langchain_mistralai import ChatMistralAI\nfrom dotenv import load_dotenv\nimport asyncio\nimport os\n\n# Load environment variables\nload_dotenv()\n\n# Initialize the model\nmodel = ChatMistralAI(model=&quot;mistral-large-latest&quot;, api_key=os.getenv(&quot;MISTRALAI_API_KEY&quot;))\n\n# Initialize the server parameters for Docker\nserver_params = StdioServerParameters(\n    command=&quot;C:\\\\Program Files\\\\Docker\\\\Docker\\\\resources\\\\bin\\\\docker.exe&quot;,\n    args=[\n        &quot;run&quot;,\n        &quot;-i&quot;,\n        &quot;--rm&quot;,\n        &quot;-v&quot;,\n        &quot;d:\\\\:\/tmp&quot;,  # Windows path mapped to \/tmp in container\n        &quot;-e&quot;, &quot;UNSTRACT_API_KEY&quot;,\n        &quot;-e&quot;, &quot;API_BASE_URL&quot;,\n        &quot;unstract\/mcp-server&quot;,\n        &quot;unstract&quot;\n    ],\n    env={\n        &quot;UNSTRACT_API_KEY&quot;: os.getenv(&quot;UNSTRACT_API_KEY&quot;),\n        &quot;API_BASE_URL&quot;: os.getenv(&quot;API_BASE_URL&quot;)\n    }\n)\n\n# Define the chat function\nasync def chat_with_agent():\n    # Initialize the client\n    async with stdio_client(server_params) as (read, write):\n        # Initialize the session\n        async with ClientSession(read, write) as session:\n            # Initialize the session\n            await session.initialize()\n            # Load the tools\n            tools = await load_mcp_tools(session)\n            # Create the agent\n            agent = create_react_agent(model, tools)\n\n            # Start conversation history, this is the initial message from the system prompt\n            messages = [\n                {\n                    &quot;role&quot;: &quot;system&quot;,\n                    &quot;content&quot;: &quot;You can use multiple tools in sequence to answer complex questions. Think step by step.&quot;,\n                }\n            ]\n\n            # Start the conversation\n            print(&quot;Type &#39;exit&#39; or &#39;quit&#39; to end the chat.&quot;)\n            while True:\n                # Get the user&#39;s message\n                user_input = input(&quot;\\nYou: &quot;)\n\n                # Check if the user wants to end the conversation\n                if user_input.strip().lower() in {&quot;exit&quot;, &quot;quit&quot;}:\n                    print(&quot;Goodbye!&quot;)\n                    break\n\n                # Add the user&#39;s message to the conversation history\n                messages.append({&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: user_input})\n\n                # Invoke the agent with the full message history\n                agent_response = await agent.ainvoke({&quot;messages&quot;: messages})\n\n                # Get the agent&#39;s reply\n                ai_message = agent_response[&quot;messages&quot;][-1].content\n                \n                # Add the agent&#39;s reply to the conversation history\n                messages.append({&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: ai_message})\n                \n                # Print the agent&#39;s reply\n                print(f&quot;Agent: {ai_message}&quot;)\n\n\n# Run the chat function\nif __name__ == &quot;__main__&quot;:\n    # Run the chat function asynchronously\n    asyncio.run(chat_with_agent())\n\n<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Here is a description of the major components used in the code:<\/p>\n\n\n\n<p><strong>Docker-Based MCP Server Setup<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Runs the unstract\/mcp-server Docker container.<\/li>\n\n\n\n<li>Mounts your D:\\ drive as \/tmp in the container (this is in Windows, adjust for Linux).<\/li>\n\n\n\n<li>Passes environment variables (UNSTRACT_API_KEY, API_BASE_URL) into Docker.<\/li>\n<\/ul>\n\n\n\n<p>This example is for Windows; for Linux, adjust the command and path, for example:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>server_params = StdioServerParameters(\n    command=&quot;\/usr\/local\/bin\/docker&quot;,\n    args=[\n        &quot;run&quot;,\n        &quot;-i&quot;,\n        &quot;--rm&quot;,\n        &quot;-v&quot;,\n        &quot;\/tmp:\/tmp&quot;,\n        &quot;-e&quot;, &quot;UNSTRACT_API_KEY&quot;,\n        &quot;-e&quot;, &quot;API_BASE_URL&quot;,\n        &quot;unstract\/mcp-server&quot;,\n        &quot;unstract&quot;\n    ],\n    env={\n        &quot;UNSTRACT_API_KEY&quot;: os.getenv(&quot;UNSTRACT_API_KEY&quot;),\n        &quot;API_BASE_URL&quot;: os.getenv(&quot;API_BASE_URL&quot;)\n    }\n)\n\n<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Chat Loop Function<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Launches and connects to the MCP Docker container via stdio.<\/li>\n\n\n\n<li>Opens a session for communication with the MCP server.<\/li>\n\n\n\n<li>Initializes the MCP session.<\/li>\n\n\n\n<li>Loads available tools (e.g., unstract_tool).<\/li>\n\n\n\n<li>Constructs a LangGraph agent that can call tools <strong>step by step<\/strong> to answer questions.<\/li>\n<\/ul>\n\n\n\n<p><strong>Conversation Loop<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Starts with a system prompt instructing the agent to think step by step.<\/li>\n\n\n\n<li>Reads user input.<\/li>\n\n\n\n<li>If the user types exit or quit, the loop ends.<\/li>\n\n\n\n<li>Sends the full conversation history to the agent.<\/li>\n\n\n\n<li>The agent uses the model + available tools to answer.<\/li>\n\n\n\n<li>Extracts the agent\u2019s latest reply.<\/li>\n\n\n\n<li>Adds it to the conversation history for context.<\/li>\n<\/ul>\n\n\n\n<p>Now you can ask the AI to process documents, let&#8217;s see again the example of the insurance form.<\/p>\n\n\n\n<p>You can run the script with:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>uv run main.py<\/code><\/pre><\/div>\n\n\n\n<p>Then process the document:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>You: process the document at \/tmp\/ACORD-Insurance-form.pdf\n\nAgent: The structured data extracted from the file at `\/tmp\/ACORD-Insurance-form.pdf` is as follows:\n\n- **Line of Business:**\n  - BOILER & MACHINERY: $9000\n  - BUSINESS AUTO: $89900\n  - COMMERCIAL PROPERTY: $900\n  - MOTOR TRUCKERS: $3000\n\n- **Personal Details:**\n  - Name: John Updike\n  - Phone: (555) 674 9940\n  - Email: john@surelogic.com\n\n<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>As you can see, it uses the unstract_tool to process and extract the JSON from the document, which MistralAI model formats for the output.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>In this guide, we explored the foundations of the Model Context Protocol ecosystem\u2014how standardized discovery, invocation, and context propagation enable seamless AI\u2013tool integrations.<\/p>\n\n\n\n<p>We saw that by acting as the central \u201ctool provider,\u201d an MCP server simplifies everything from prompt orchestration to multi-turn session tracking.<\/p>\n\n\n\n<p>Unstract\u2019s MCP Server distinguishes itself by embedding its high-accuracy extraction engine, no-code Prompt Studio, and robust observability into a single, compliant service that works effortlessly with any MCP host.<\/p>\n\n\n\n<p>By leveraging Unstract\u2019s MCP Server, organizations unlock a new level of productivity: data engineers can query PDFs and contracts directly from IDEs, analysts can run natural-language extractions in chat interfaces, and prompt engineers can iterate on workflows without touching code.<\/p>\n\n\n\n<p>All of this happens within your existing tools, dramatically reducing context-switching and accelerating time-to-value.<\/p>\n\n\n\n<p>Ready to experience it for yourself?<\/p>\n\n\n\n<p>Spin up an Unstract MCP Server instance, connect it to your preferred host (Cursor, Claude Desktop, LangChain, and more), and start extracting structured insights from your documents in minutes.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<p>Partner with Unstract today to modernize your mortgage processing workflows. Access our <a href=\"https:\/\/youtu.be\/wUmszBY4S10\" target=\"_blank\" rel=\"noopener\" title=\"\">demo<\/a>, <a href=\"https:\/\/docs.unstract.com\/unstract\/unstract_platform\/quick_start\/\" target=\"_blank\" rel=\"noopener\" title=\"\">API documentation<\/a>, to experience the power of AI-driven mortgage document processing.<\/p>\n\n\n\n<p><a href=\"https:\/\/unstract.com\/start-for-free\/\" target=\"_blank\" rel=\"noopener\" title=\"\"><strong>Signup for a free trial<\/strong><\/a> to get hands-on experience with Unstract.<br>Or better yet,<a href=\"https:\/\/unstract.com\/schedule-a-demo\/\"><strong>schedule a call with us<\/strong><\/a><strong>\u200a<\/strong>\u2014\u200aour team will walk you through how <strong>Unstract\u2019s AI-powered automation<\/strong> is transforming document processing in the mortgage industry, and how it significantly differs from traditional <strong>OCR<\/strong> and <strong>RPA solutions<\/strong>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<h3 class=\"wp-block-heading has-text-align-center\">From Inbox to Database: Automating Document Extraction with Unstract + n8n<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>With <strong>n8n<\/strong>, you can automatically sort and handle incoming emails. It can check subject lines to figure out what kind of form is attached and then send the file to the right process\u2014all while staying within your data rules.<\/p>\n\n\n\n<p><strong>Unstract<\/strong> works alongside this by handling data extraction. In Unstract\u2019s Prompt Studio, you create custom extractors that know how to pull out specific details\u2014like invoice numbers, dates, or tax codes\u2014from different types of documents. These extractors are available as REST APIs.<\/p>\n\n\n\n<p>When <strong>n8n<\/strong> sends a PDF or scanned image to Unstract, it gets back clean, structured JSON data that\u2019s ready to go straight into your database.<\/p>\n\n\n\n<p>Together, n8n and Unstract automate the whole process\u2014from inbox to database\u2014saving time, reducing errors, and removing the need for manual data entry.<\/p>\n\n\n\n<p><a href=\"https:\/\/unstract.com\/blog\/unstract-n8n\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Learn more \u2192<\/a><\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article provides an in-depth walkthrough of Unstract\u2019s MCP (Model Context Protocol) Server and demonstrates how it can be integrated with popular MCP hosts such as Cursor and Claude Desktop.<\/p>\n","protected":false},"author":8,"featured_media":15094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-14967","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-product"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/posts\/14967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/comments?post=14967"}],"version-history":[{"count":0,"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/posts\/14967\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/media\/15094"}],"wp:attachment":[{"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/media?parent=14967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/categories?post=14967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unstract.com\/wp-json\/wp\/v2\/tags?post=14967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}