
An MCP server that merges Google Search Console history with a live first-party crawl of your site to produce a prioritised, evidence-backed technical SEO audit inside Claude, complete with paste-ready fixes.

A Model Context Protocol server that exposes the USPTO Patent File Wrapper API for patent and application search, prosecution document retrieval, OCR text extraction and secure PDF downloads.
USPTO Patent File Wrapper MCP Server is cataloged as an MCP server attributed to john-walkoe. A Model Context Protocol server that exposes the USPTO Patent File Wrapper API for patent and application search, prosecution document retrieval, OCR text extraction and secure PDF downloads. It is categorized under search web. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for USPTO Patent File Wrapper MCP Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
Yes, a USPTO API key is required; a Mistral API key or a Docling endpoint is optional for OCR of scanned documents.
Yes, OCR backends handle scanned USPTO documents when the native text layer is missing or unusable.
Downloads use proxy URLs that conceal the USPTO API key while enforcing rate limits.
README.md · 996f2a457650 · 采集于 2026-11-13 13:53:57 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
A high-performance Model Context Protocol (MCP) server for the USPTO Patent File Wrapper API with token saving context reduction capabilities, smart field mapping, and secure browser-accessible downloads.
| Document | Description |
|---|---|
| 📥 Installation Guide | Complete cross-platform setup with automated scripts |
| 🔑 API Key Guide | Step-by-step instructions for obtaining USPTO and Mistral API keys with screenshots |
| 📖 Usage Examples | Function examples, workflows, and integration patterns |
| 🎯 Prompt Templates | Detailed guide to sophisticated prompt templates for legal & research workflows |
| ⚙️ Field Customization | Comprehensive guidance on customizing field sets for the minimal and balanced tools |
| 🔒 Security Guidelines | Comprehensive security best practices |
| 🛡️ Security Scanning | Automated secret detection and prompt injection protection guide |
| Content Provenance | How retrieved document text is labeled and annotated (data-not-instructions posture) |
| 🧪 Testing Guide | Test suite documentation and API key setup |
| ⚖️ License | MIT License terms and conditions |
Run PowerShell as Administrator, then:
# Navigate to your user profile
cd $env:USERPROFILE
# If git is installed:
git clone https://github.com/john-walkoe/uspto_pfw_mcp.git
cd uspto_pfw_mcp
# If git is NOT installed:
# Download and extract the repository to C:\Users\YOUR_USERNAME\uspto_pfw_mcp
# Then navigate to the folder:
# cd C:\Users\YOUR_USERNAME\uspto_pfw_mcp
# The script detects if uv is installed and if it is not it will install uv - https://docs.astral.sh/uv
# Run setup script (sets execution policy for this session only):
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
.\deploy\windows_setup.ps1
# View INSTALL.md for sample script output.
# Close Powershell Window.
# If choose option to "configure Claude Desktop integration" during the script then restart Claude Desktop
The PowerShell script will:
{
"mcpServers": {
"uspto_pfw": {
"command": "uv",
"args": [
"--directory",
"C:/Users/YOUR_USERNAME/uspto_pfw_mcp",
"run",
"patent-filewrapper-mcp"
],
"env": {
"USPTO_API_KEY": "your_actual_USPTO_api_key_here",
"MISTRAL_API_KEY": "your_mistral_api_key_here_OPTIONAL",
"MISTRAL_OCR_MODEL": "mistral-ocr-latest_OPTIONAL_pin_a_dated_slug",
"DOCLING_SERVE_URL": "http://localhost:5001",
"PROXY_PORT": "8080"
}
}
}
}
For detailed installation, manual setup, and troubleshooting, see INSTALL.md
🔒 Secure API Key Storage - Windows DPAPI encryption for API keys (secure storage option during setup)
🗺️ Smart Field Mapping - Use simple names like "inventionTitle" instead of "applicationMetaData.inventionTitle"
⚙️ User-Customizable Fields - Configure field sets through YAML without code changes
🎯 Context Reduction - Get focused responses instead of massive API dumps
🔍 Multi-Strategy Search - Comprehensive, fuzzy, and exact inventor searches
⚡ Convenience Parameters - Attorney-friendly search parameters (art_unit, examiner_name, applicant_name, etc.) eliminate need for complex query syntax
🏛️ Professional-Grade Fields - additional fields for patent prosecution, international work, and analytics
🔄 Circuit Breaker Resilience - Automatic retry logic with exponential backoff prevents API failures
📊 Progressive Disclosure - context reduction through optimized minimal → balanced → detailed workflows
🔗 Cross-MCP Integration - Purpose-built for multi-database patent research with Developer's other PTAB, FPD, Citations, and Pinecone (Assistant or RAG) MCPs
📝 Attorney-Focused Prompt Templates - 10+ sophisticated workflow templates for legal research, litigation, and due diligence (opt-in server-side: set PFW_ENABLE_PROMPTS=true to register them; off by default)
✨ Intelligent Document Extraction - 4-tier hybrid extraction: USPTO free-text variants → pypdf native text layer → Mistral OCR → Docling OCR (self-hosted, set DOCLING_SERVE_URL). Both OCR backends are optional
🌐 Secure Browser Downloads - Click proxy URLs to download PDFs directly while keeping API keys secure
👁️ Advanced OCR Capabilities - Extract text for LLM use from scanned PDFs, formulas, diagrams, and complex layouts via Mistral OCR or Docling (EasyOCR engine)
📁 Document Bag Integration - Full prosecution document access (Abstract, Claims, NOA, etc.) alongside XML content analysis of patents/applications
🚀 High Performance - Optimized for AI workflows with targeted field selection + retry logic with exponential backoff
🛡️ Production Ready - Enhanced error handling, structured logging with request IDs, and comprehensive security guidelines
💻 Cross-Platform - Works seamlessly on Linux and Windows
📋 Complete API Coverage - All USPTO Patent File Wrapper endpoints supported
NEW: PFW MCP now supports Claude Code's built-in tool search optimization, reducing context window usage by 65-75% through dynamic tool discovery.
These 3 tools are loaded immediately for fast access:
PFW_search_applications_minimal - Primary discovery for patent applicationsPFW_get_guidance - Workflow guidance and documentationPFW_get_application_documents - Document lists for patent applicationsClaude discovers additional tools as needed:
If tool search isn't activating automatically:
Windows:
$env:ENABLE_TOOL_SEARCH = "true"
claude
Linux/Mac:
export ENABLE_TOOL_SEARCH=true
claude
Run /context in Claude Code:
MCP tools: loaded on-demand (N servers) ← Tool search IS working
User Requests the following:
LLM Performs these steps:
Step 1: Discovery minimal → Step 2: Selection (and searches balanced - Optional) → Step 3: Content Analysis → Step 4 (Optional): Select additional prosecution documents for examination → Step 5 (Optional): Retrieve doc_id(s) of the selected from documentBag → Step 6 (Optional): Document Extraction for LLM use and/or Download Links of PDFs for user's use
The field configuration supports an optimized research progression:
This MCP server includes sophisticated AI-optimized prompt templates for complex patent workflows. For detailed documentation on all templates, features, and usage examples, see PROMPTS.md.
| Category | Templates | Purpose |
|---|---|---|
| Legal Analysis | /patent_search, /patent_explanation_for_attorneys, /patent_invalidity_analysis_defense_pinecone_PTAB | Patent discovery, technical translation, defensive litigation |
| Research & Prosecution | /art_unit_quality_assessment_FPD, /litigation_research_setup_PTAB_FPD, /technology_landscape_mapping_PTAB | Examiner analysis, litigation prep, competitive intelligence |
| Document Management | /complete_patent_package, /document_filtering_assistant, /inventor_portfolio_analysis | Organized retrieval, smart filtering, portfolio mapping |
Key Features Across All Templates:
PFW MCP includes four built-in visual views rendered as iframes inside Claude Desktop (a fifth, the user-management panel, appears only on OAuth deployments with PFW_ENABLE_USER_MANAGEMENT=true):
| Trigger | View | What it shows |
|---|---|---|
Any PFW_search_* tool | Search Results | Results table with status/art unit filter pills, Patent Center links |
PFW_get_patent_or_application_xml | Claims & Abstract Reader | Tabbed Claims / Abstract viewer with IND/DEP claim detection |
PFW_get_document_download / PFW_get_granted_patent_documents_download | Recent Downloads | Last 10 downloaded documents with clickable PDF links |
PFW_get_family | Patent Family | Generation-by-generation family tree with CON/CIP/DIV relation labels, Patent Center and Google Patents links |
MCP Apps require FASTMCP_TRANSPORT=http mode. Claude Desktop picks up the ui://pfw/ resources automatically via the FastMCP 4 Apps extension (imported from fastmcp.apps).
Registered MCP tool names: the tables below use the tools' display-style names. In
tools/listthe server registers 17 tools under these exact names:PFW_search_applications,PFW_search_inventor,PFW_search_applications_minimal,PFW_search_applications_balanced,PFW_search_inventor_minimal,PFW_search_inventor_balanced,PFW_get_application_documents,PFW_get_patent_or_application_xml,PFW_get_granted_patent_documents_download,PFW_get_oa_rejections,PFW_get_oa_text,PFW_get_document_content_with_ocr,PFW_get_document_download,PFW_get_family,PFW_get_term_adjustment,PFW_get_guidance, and (OAuth deployments withPFW_ENABLE_USER_MANAGEMENT=trueonly)pfw_manage_users.
A bare 8-digit number is simultaneously a valid US patent number and a valid
application serial (patent numbers passed 12,000,000 in 2024), so the tools
that take an identifier cannot tell them apart on their own. Resolution queries
the patent-number lane first and the application-serial lane second, and every
affected response reports identifier_resolved_as, identifier_lanes_tried
and, when the input was ambiguous, identifier_ambiguous plus an
identifier_note.
Write the identifier in a form that removes the ambiguity:
| You mean | Write it as | Why |
|---|---|---|
| Application serial 11/752,072 | 11/752,072 | A slash marks a serial unambiguously; resolution short-circuits to the application lane |
| Application serial, no slash available | 11752072 plus content_type='application' | Forces the application lane |
| Granted patent 7,971,071 | 7971071 or 7,971,071 | Seven digits or fewer is a patent number, unambiguous |
| Granted patent 11,752,072 | 11752072 or 11,752,072 | A comma-only number stays on the patent-first lane, which is what granted patents want |
11752072 typed bare is therefore patent 11,752,072 (application
16816197, "QUICK SET CEMENTS FOR DENTAL PULP CAPPING AND RELATED METHODS OF
USE"), not application 11/752,072. Passing an unrecognized content_type
value is a 400, not a silent fall back to auto.
An oversized tool result is replaced by a client-side truncation error the
server never sees, so responses are bounded server-side and every bound is
announced. Budgets are CHARACTER budgets (len(json.dumps(...))), never token
estimates. All four markers are absent on a no-op - an unbounded response
comes back byte-identical.
| Marker | Appears on | Carries |
|---|---|---|
_bounds | any response slimmed or truncated to fit | applied, reason ("size" or "window"), size_chars, size_limit, stages, slimmed_fields, items_returned, items_total, note |
_window | paged text (PFW_get_document_content_with_ocr, PFW_get_oa_text) | unit (always "char", the unit of the counters below), edges ("char" or "page": whether the window boundaries snapped to page markers), offset, returned, total, has_more, next_offset, note. Feed next_offset back as char_offset to continue |
paging | every search | limit_requested, limit_applied, offset, returned, total, has_more, next_offset. Rewritten to the rows actually returned when the size guard trims a page, so next_offset never skips a row |
limit_clamped | a search asking for more than MAX_SEARCH_LIMIT (100) | requested, applied, note. The call CLAMPS and runs; it does not 400. limit < 1 is still a 400 |
PFW_get_guidance("limits") prints the live budgets and the same contract.
Environment variables: USPTO_MAX_RESPONSE_CHARS, USPTO_MAX_CONTENT_CHARS,
USPTO_RESPONSE_BOUNDS_ENABLED (see INSTALL.md).
| Function (Display Name) | Context Reduction | Use Case |
|---|---|---|
PFW_search_applications (Search applications custom) | Variable | Custom patent search with user-defined fields |
PFW_search_inventor (Search inventor custom) | Variable | Smart inventor search with multiple strategies |
PFW_search_applications_minimal (Search applications minimal) | typical 95-99% | Ultra-fast search (user-customizable minimal fields) |
PFW_search_applications_balanced (Search applications balanced) | typical 85-95% | Key fields for discovery (no documentBag) |
PFW_search_inventor_minimal (Search inventor minimal) | typical 95-99% | Ultra-fast inventor search (user-customizable) |
PFW_search_inventor_balanced (Search inventor balanced) | typical 85-95% | Balanced inventor search (no documentBag) |
exact - Exact name matching onlyfuzzy - Multiple name format variationscomprehensive - All strategies + partial matching# Exact strategy
"applicationMetaData.inventorBag.inventorNameText:\"John Smith\""
# Comprehensive strategy
[
"applicationMetaData.inventorBag.inventorNameText:\"John Smith\"",
"applicationMetaData.inventorBag.inventorNameText:\"Smith, John\"",
"applicationMetaData.inventorBag.inventorNameText:Smith*",
"applicationMetaData.inventorBag.inventorNameText:*Smith*"
]
| Function (Display Name) | Purpose | Requirements |
|---|---|---|
PFW_get_patent_or_application_xml (Get patent or application xml) | Get structured XML content for patents/applications for LLM use with 91-99% token reduction via include_raw_xml=False (recommended) and optional include_fields for selective extraction | USPTO_API_KEY |
PFW_get_granted_patent_documents_download (Get granted patent documents download) | Get complete granted patent package (Abstract, Drawings, Specification, Claims) in one call as secure browser-accessible download URLs | USPTO_API_KEY |
PFW_get_application_documents (Get application documents) | Get prosecution documents' doc_id from documentBag with advanced filtering (document_code, direction_category) | USPTO_API_KEY |
PFW_get_document_content_with_ocr (PFW get document content with ocr) | 4-tier hybrid text extraction: USPTO free-text variants → pypdf native text layer → Mistral OCR → Docling OCR | USPTO_API_KEY (+ MISTRAL_API_KEY or DOCLING_SERVE_URL for scanned docs) |
PFW_get_document_download (PFW get document download) | Secure browser-accessible download URLs | USPTO_API_KEY |
PFW_get_oa_rejections (PFW get OA rejections) | USPTO ODP Office Action API — rejection types (§101/§102/§103/§112) per non-final/final rejection, plus statement counts from each action's text | USPTO_API_KEY |
PFW_get_oa_text (PFW get OA text) | USPTO ODP Office Action API — full office action text and section-specific excerpts | USPTO_API_KEY |
PFW_get_family (PFW get family) | Normalized continuity family graph (nodes + edges with CON/CIP/DIV relation types, earliest ancestors) plus foreign priority claims. Optional depth-2 walk. | USPTO_API_KEY |
PFW_get_term_adjustment (PFW get term adjustment) | Patent Term Adjustment from the ODP /adjustment endpoint: total days, A/B/C and applicant delay, capped event history. No expiration date is computed. | USPTO_API_KEY |
PFW_get_guidance (PFW get guidance) | RECOMMENDED: Context-efficient selective guidance sections (95-99% token reduction) | None |
PFW_get_patent_or_application_xml): Structured patent/application content with extreme context optimization
include_raw_xml=False - Removes ~50K token raw XML overhead (91% token reduction!)include_fields) - Request only needed fields for 95-99% token reductioninclude_raw_xml=False)PFW_get_granted_patent_documents_download): Single-call granted patent retrieval
PFW_get_application_documents): - Targeted document access from documentBag
document_code (NOA, CTFR, 892, etc.) and direction_category (INCOMING/OUTGOING/INTERNAL)PFW_get_document_content_with_ocr): - auto-optimized extraction
.docx, xmlarchive, or as-uploaded PDF the USPTO API serves alongside the PDF render (USPTO-authored papers and e-filed claims/remarks/IDS); each variant is checked against the requested application numberMISTRAL_API_KEY (optional)DOCLING_SERVE_URL; handles the same scanned documents as Mistral, and can be configured instead of Mistral rather than only after itextraction_method in every responsePFW_get_document_download): Secure proxy downloads
APP-{app_number}_PAT-{patent_number}_{invention_title}_{type}.pdfPET-{date}_APP-{app}_PAT-{patent}_{description}.pdflocalhost; configurable for reverse proxy or MCP gateway deployments via CORS_EXTRA_ORIGIN and MCP_APP_EXTRA_DOMAINS env vars — see INSTALL.mdPFW_get_document_download and PFW_get_granted_patent_documents_downloadThe system automatically generates descriptive filenames using application metadata:
For PFW Documents - Granted Patents:
APP-11752072_PAT-7971071_INTEGRATED_DELIVERY_AND_PROTECTION_ABST.pdf
APP-14171705_PAT-9049188_HYBRID_DEVICE_HAVING_A_PERSONAL_DIGITAL_CLM.pdf
For PFW Documents - Pending Applications:
APP-18462633_SURFACE_DENSITY_DEVICE_CALIBRATION_APPARATU_SPEC.pdf
APP-18823722_BACK_CONTACT_SOLAR_CELL_AND_METHOD_FOR_PREP_DRW.pdf
For FPD Documents - Petition Decisions:
PET-2025-09-03_APP-13632078_PAT-8803593_PATENT_PROSECUTION_HIGHWAY_DECISION.pdf
PET-2024-05-15_APP-17414168_PAT-12252554_REVIVAL_PETITION_DECISION.pdf
The application numbers inside a generated filename are the bare digits the USPTO API returns (
applicationNumberText). When you TYPE an application serial into a tool, use the slash-comma form (11/752,072) instead: see Identifier formats above.
Features:
| Function (Display Name) | Purpose | Requirements |
|---|---|---|
PFW_get_guidance (PFW get guidance) | Context-efficient selective guidance | None |
NEW: PFW_get_guidance Tool - Solves MCP Resources visibility problem with selective guidance sections:
🎯 Quick Reference Chart - Know exactly which section to call:
PFW_get_guidance("fields")PFW_get_guidance("documents")PFW_get_guidance("document_codes")PFW_get_guidance("workflows_ptab")PFW_get_guidance("workflows_fpd")PFW_get_guidance("workflows_citations")PFW_get_guidance("workflows_pinecone")PFW_get_guidance("workflows_complete")PFW_get_guidance("tools")PFW_get_guidance("errors")PFW_get_guidance("cost")Transform complex API field names into user-friendly alternatives:
# User-friendly (automatically mapped)
fields = [
"applicationNumberText", # Direct passthrough
"inventionTitle", # applicationMetaData.inventionTitle
"patentNumber", # applicationMetaData.patentNumber
"filingDate", # applicationMetaData.filingDate
"parentPatentNumber" # parentContinuityBag.parentPatentNumber
]
# Advanced API paths (still supported)
fields = [
"applicationMetaData.inventionTitle",
"applicationMetaData.examinerNameText",
"parentContinuityBag.parentApplicationNumberText"
]
| User-Friendly | Maps To API Field |
|---|---|
inventionTitle | applicationMetaData.inventionTitle |
patentNumber | applicationMetaData.patentNumber |
filingDate | applicationMetaData.filingDate |
applicationStatusDescriptionText | applicationMetaData.applicationStatusDescriptionText |
firstInventorName | applicationMetaData.firstInventorName |
parentPatentNumber | parentContinuityBag.parentPatentNumber |
docketNumber | applicationMetaData.docketNumber |
Full mapping with 30+ fields available in src/patent_filewrapper_mcp/api/helpers.py
For comprehensive usage examples, including:
See the detailed USAGE_EXAMPLES.md documentation.
The MCP server supports user-customizable field sets through YAML configuration for optimal context reduction. You can modify field sets without changing any code!
Configuration file: field_configs.yaml (in project root)
For complete customization guidance, including progressive workflow strategies, token optimization, and advanced field selection patterns, see CUSTOMIZATION.md.
This MCP is designed to work seamlessly with three other USPTO MCPs for comprehensive patent lifecycle analysis:
| MCP Server | Purpose | GitHub Repository |
|---|---|---|
| USPTO Patent File Wrapper (PFW) | Prosecution history & documents | uspto_pfw_mcp |
| USPTO Patent Trial and Appeal Board (PTAB) | Patent Trial and Appeal Board proceedings | uspto_ptab_mcp |
| USPTO Enriched Citation | Information about which references, or prior art, were cited in specific patent application office actions. Uses USPTO Enriched Citation API v3 | uspto_enriched_citation_mcp |
| USPTO Final Petition Decisions (FPD) | Final Petition Decisions | uspto_fpd_mcp |
| Pinecone Assistant MCP | Patent law knowledge base with AI-powered chat and citations (MPEP, examination guidance) - 1 API key, limited free tier | pinecone_assistant_mcp |
| Pinecone RAG MCP | Patent law knowledge base with custom embeddings (MPEP, examination guidance) - Requires Pinecone + embedding model, monthly resetting free tier | pinecone_rag_mcp |
The Patent File Wrapper (PFW) MCP serves as the foundation for patent research, providing prosecution history and document access. When combined with the other MCPs, it enables:
Cross-Referencing Fields:
applicationNumberText - Primary key linking PTAB proceedings to PFW prosecutiongroupArtUnitNumber - Art unit analysis across all MCPsexaminerNameText - Examiner behavior patterns and quality assessmentfirstApplicantName / inventorBag - Party matching across MCPsProgressive Workflow:
assistant_context / RAG MCP: semantic_search)For detailed integration workflows, cross-referencing examples, and complete use cases, see USAGE_EXAMPLES.md.
| Method | Response Size | Context Usage | Features |
|---|---|---|---|
| Direct curl | ~100KB+ | High | Raw API access |
| MCP Balanced | ~5KB | Medium | Key fields + mapping |
| MCP Minimal | ~1KB | Very Low | Essential data only |
Open Claude Desktop with this MCP server connected and paste the prompt from tests/TEST_SUITE.md. This runs 21 tests (Test 0 through Test 20) across the 12 tools it covers against the live USPTO API with known expected outputs - no code required. It does not exercise PFW_get_family, PFW_get_term_adjustment, PFW_search_inventor or PFW_search_inventor_balanced.
Run after initial setup, after upgrades, or after modifying tool logic.
# Full test suite (pytest, asyncio_mode=auto)
# test_unified_key_management.py is excluded because it overwrites the real
# secure-storage keys mid-test — only run it deliberately.
uv run pytest --ignore=tests/test_unified_key_management.py
# If no download proxy is running on port 8080, skip the proxy integration test:
SKIP_PROXY_TESTS=1 uv run pytest --ignore=tests/test_unified_key_management.py
# Single-file smoke test
uv run python tests/test_fields_fix.py
For the full developer test suite including proxy server, OCR extraction, and API key setup, see the Testing Guide.
uspto_pfw_mcp/
├── field_configs.yaml # Root-level field customization
├── launcher.py # Entry point launcher
├── .security/ # Security scanning components
│ ├── patent_prompt_injection_detector.py # Enhanced prompt injection detection
│ ├── check_prompt_injections.py # Standalone scanning script with baseline support
│ └── .prompt_injections.baseline # Baseline tracking for prompt injection findings
├── src/
│ └── patent_filewrapper_mcp/
│ ├── main.py # FastMCP server assembly (instructions, resources, tool registration)
│ ├── server_bootstrap.py # Entry point, transport selection, proxy lifecycle
│ ├── fastmcp_compat.py # FastMCP 4 / MCP SDK 2.x shims (defer_loading, tool titles)
│ ├── middleware.py # Streamable-HTTP probe shim and x-api-key gate
│ ├── guidance.py # PFW_get_guidance section bodies
│ ├── app_uris.py # ui://pfw/ MCP App resource URIs
│ ├── client_registry.py # Shared USPTO API client (lazy init)
│ ├── __init__.py
│ ├── __main__.py
│ ├── exceptions.py
│ ├── shared_secure_storage.py # Cross-platform secure API key storage (DPAPI / Fernet)
│ ├── config/
│ │ ├── field_manager.py # Configuration management
│ │ ├── tool_reflections.py # Migration notices (guidance moved to PFW_get_guidance)
│ │ └── log_config.py # 🆕 Logging configuration with file-based rotation
│ ├── api/
│ │ ├── enhanced_client.py # 4-tier extraction (free-text variants → pypdf → Mistral → Docling)
│ │ ├── docling_client.py # docling-serve REST client (self-hosted OCR via DOCLING_SERVE_URL)
│ │ ├── office_action_client.py # USPTO ODP Office Action API (search + full text)
│ │ ├── field_constants.py # Field constant definitions
│ │ └── helpers.py # Field mapping & utilities
│ ├── models/
│ │ ├── constants.py # System constants
│ │ └── search_params.py # Search parameter models
│ ├── prompts/ # AI prompt templates
│ │ ├── patent_search.py
│ │ ├── patent_explanation_for_attorneys.py
│ │ ├── patent_invalidity_analysis_defense_Pinecone_PTAB_FPD_Citations.py
│ │ ├── litigation_research_setup_PTAB_FPD.py
│ │ ├── technology_landscape_mapping_PTAB.py
│ │ ├── art_unit_quality_assessment_FPD.py
│ │ ├── complete_patent_package_retrieval_PTAB_FPD.py
│ │ ├── document_filtering_assistant.py
│ │ ├── inventor_portfolio_analysis.py
│ │ ├── examiner_behavior_intelligence_CITATION.py
│ │ └── prior_art_analysis_CITATION.py
│ ├── proxy/
│ │ ├── server.py # HTTP proxy for secure downloads
│ │ ├── rate_limiter.py # USPTO rate limiting compliance
│ │ ├── secure_link_cache.py
│ │ ├── models.py
│ │ ├── fpd_document_store.py
│ │ └── ptab_document_store.py
│ ├── reflections/ # Reflection system (legacy)
│ │ ├── base_reflection.py
│ │ ├── pfw_reflections.py
│ │ └── reflection_manager.py
│ ├── services/
│ │ └── ocr_service.py # OCR quality detection and processing
│ ├── tools/ # MCP tool registration (search, documents, OA, guidance, admin)
│ ├── auth/ # Optional OAuth 2.1 sign-in (PFW_AUTH_MODE=oauth)
│ ├── ui/ # MCP App HTML views (ui://pfw/ resources)
│ ├── shared/
│ │ ├── injection_scan.py # Runtime detection-only injection scanner + provenance note
│ │ ├── internal_auth.py # Shared authentication
│ │ ├── log_sanitizer.py # Automatic sensitive data sanitization
│ │ ├── safe_logger.py # Safe logger with auto-sanitization
│ │ ├── response_bounds.py # Shared response-size guard (_bounds / _window)
│ │ ├── fernet_key_store.py
│ │ └── uspto_shared_rate_limiter.py # Cross-process shared USPTO rate limiter
│ ├── util/
│ │ ├── database.py
│ │ ├── dpapi_utils.py
│ │ ├── error_handlers.py
│ │ ├── identifier_normalization.py
│ │ ├── identifier_resolution.py # Patent-vs-application lane resolution
│ │ ├── linux_secret_store.py
│ │ ├── input_processing.py
│ │ ├── logging.py # Enhanced logging utilities
│ │ ├── package_manager.py
│ │ └── security_logger.py
│ └── json/
│ └── search_query.json # Sample JSON structures
├── deploy/
│ ├── linux_setup.sh # Linux deployment script
│ ├── windows_setup.ps1 # PowerShell deployment script
│ ├── manage_api_keys.ps1 # API key management utilities
│ ├── Validation-Helpers.psm1 # PowerShell validation module
│ └── validation_helpers.sh # Bash validation helpers
├── tests/ # Current test files (see tests/README.md for the full list)
│ ├── README.md # Testing documentation
│ ├── TEST_SUITE.md # Manual end-to-end suite against the live USPTO API
│ ├── conftest.py
│ ├── test_fields_fix.py # Core functionality test
│ ├── test_proxy_simple.py # Proxy server test
│ ├── test_quality_detection.py # Extraction quality detection test
│ ├── test_unified_key_management.py # Secure key storage test (excluded by default)
│ ├── test_identifier_resolution_order.py # Resolve-then-validate order guard
│ ├── test_response_bounds.py # Shared response-size guard
│ ├── test_download.py
│ ├── test_enhanced_filename.py
│ ├── test_fpd_integration.py
│ ├── test_granted_patent_documents_download.py
│ ├── test_injection_scan.py # Runtime injection scanner + tool wiring tests
│ ├── test_mistral_key_logic.py
│ ├── test_optional_mistral.py
│ ├── test_placeholder_detection.py
│ ├── test_ptab_integration.py
│ ├── test_resilience_features.py
│ ├── test_tool_reflections.py
│ └── test_utils.py
├── reference/
│ ├── README.md
│ ├── Document_Descriptions_List.csv
│ └── PatentFileWrapper_swagger.yaml
├── scripts/
│ ├── manage_mcp_users.py # Bootstrap and manage the OAuth mcp_users table
│ └── rotate_internal_auth_secret.py # Rolling rotation for INTERNAL_AUTH_SECRET
├── docs/
│ └── CONTENT_PROVENANCE.md # Retrieved-text provenance and injection-annotation posture
├── pyproject.toml # Package configuration
├── uv.lock # uv lockfile
├── README.md # This file
├── INSTALL.md # Comprehensive installation guide
├── USAGE_EXAMPLES.md # Function examples and workflows
├── CUSTOMIZATION.md # Field configuration and optimization guide
├── PROMPTS.md # Prompt templates documentation
├── API_KEY_GUIDE.md # USPTO and optional Mistral key setup
├── SSO_SETUP.md # OAuth 2.1 sign-in (Google / Entra ID)
├── SECURITY_GUIDELINES.md # Security best practices
├── SECURITY_SCANNING.md # Automated secret detection guide
└── .env.example # Every environment variable, commented
Setting USPTO API Key:
set USPTO_API_KEY=your_key$env:USPTO_API_KEY="your_key"export USPTO_API_KEY=your_keySetting Mistral API Key (for OCR):
set MISTRAL_API_KEY=your_key$env:MISTRAL_API_KEY="your_key"export MISTRAL_API_KEY=your_keyuv sync and pip install -e .uv run prefix for uv-managed projectsfield_mapping in helpers.py or use full API field nameUSPTO_API_KEY environment variable or Claude Desktop configwindows_setup.ps1.venv files when running, preventing proper virtual environment creation.venv folder: Remove-Item ./.venv -Force -Recurse -ErrorAction SilentlyContinue.\deploy\windows_setup.ps1 againIf you need to completely reset the MCP installation to run the Windows Quick installer again:
# Navigate to the project directory
cd C:\Users\YOUR_USERNAME\uspto_pfw_mcp
# Remove Python cache directories
Get-ChildItem -Path ./src -Directory -Recurse -Force | Where-Object { $_.Name -eq '__pycache__' } | Remove-Item -Recurse -Force
# Remove virtual environment
if (Test-Path ".venv") {
Remove-Item ./.venv -Force -Recurse -ErrorAction SilentlyContinue
}
# Remove database files
Remove-Item ./proxy_link_cache.db -Force -ErrorAction SilentlyContinue
Remove-Item ./fpd_documents.db -Force -ErrorAction SilentlyContinue
Remove-Item ./ptab_documents.db -Force -ErrorAction SilentlyContinue
# Now you can run the setup script again
.\deploy\windows_setup.ps1
Linux/macOS Reset:
# Navigate to the project directory
cd ~/uspto_pfw_mcp
# Remove Python cache directories
find ./src -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
# Remove virtual environment and database files
rm -rf .venv
rm -f proxy_link_cache.db fpd_documents.db ptab_documents.db
# Run setup script again
./deploy/linux_setup.sh
src/patent_filewrapper_mcp/api/helpers.pyCORS_EXTRA_ORIGIN / MCP_APP_EXTRA_DOMAINS (see INSTALL.md)Retrieved prosecution text is served verbatim — nothing is stripped or rewritten, because verbatim fidelity of legal text is the product. Instead, the server labels and annotates:
provenance_note — every text-returning tool
(PFW_get_document_content_with_ocr, PFW_get_oa_text,
PFW_get_patent_or_application_xml) attaches a machine-readable note stating
that retrieved file-wrapper text is quoted data, not instructions, and that
applicant- or examiner-drafted characterizations are attributed positions.injection_scan — a detection-only runtime scanner
(src/patent_filewrapper_mcp/shared/injection_scan.py) checks returned OCR
output, office-action text, and XML content for instruction-override,
prompt-extraction, and encoding-evasion language and for suspicious
densities of invisible Unicode. On a hit, the response gains an annotation
naming the flagged document and the kinds of pattern found — never the
matched text. The key is absent entirely when content is clean.This runtime layer is complementary to the commit-time codebase scanner in
.security/ (see SECURITY_SCANNING.md). Full write-up:
docs/CONTENT_PROVENANCE.md.
All API requests include unique request IDs (8-char UUIDs) for correlation:
[a1b2c3d4] Starting GET request to applications/search
[a1b2c3d4] Request successful on attempt 1
SECURITY_GUIDELINES.md - Comprehensive security best practicesSECURITY_SCANNING.md - Automated secret detection and prevention guidetests/README.md - Complete testing guide with API key setupMIT License
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND.
Independent Project Notice: This is an independent personal project and is not affiliated with, endorsed by, or sponsored by the United States Patent and Trademark Office (USPTO).
The author makes no representations or warranties, express or implied, including but not limited to:
LIMITATION OF LIABILITY: Under no circumstances shall the author be liable for any direct, indirect, incidental, special, or consequential damages arising from use of this software, even if advised of the possibility of such damages.
By using this software, you acknowledge that you have read this disclaimer and agree to use the software at your own risk, accepting full responsibility for all outcomes and compliance with relevant legal and ethical obligations.
Note for Legal Professionals: While this tool provides access to patent research tools commonly used in legal practice, it is a data retrieval and AI-assisted processing system only. All results require independent verification, critical professional analysis, and cannot substitute for qualified legal counsel or the exercise of your personal professional judgment and duties outlined in the USPTO Guidance on AI Use.
If you find this USPTO Patent File Wrapper MCP Server useful, please consider supporting the development! This project was developed during my personal time over many hours to provide a comprehensive, production-ready tool for the patent community.
Your support helps maintain and improve this open-source tool for everyone in the patent community. Thank you!
Questions? See INSTALL.md for complete cross-platform installation guide or review the test scripts for working examples.
Set PFW_AUTH_MODE=oauth to protect the HTTP endpoint with Google +
Microsoft sign-in (OAuth 2.1 with dynamic client registration — works as a
Claude.ai / Claude Desktop custom connector). Access is controlled by a local
SQLite user list; role admin unlocks the pfw_manage_users user-management
tool and its MCP App panel. The tool itself is registered only when
PFW_ENABLE_USER_MANAGEMENT=true (default off — in STDIO and non-OAuth HTTP
use scripts/manage_mcp_users.py instead). The default (none) and STDIO
are unchanged. Full walkthrough: SSO_SETUP.md.
If you run all 4 USPTO MCPs (Citations, PFW, PTAB, FPD) as HTTP containers
on the same box, serving multiple users, under one USPTO API key,
each server's own in-process limiter can't see what the other 3 processes
are doing — and USPTO's documented limits are per-key (burst=1, 4-15
req/sec depending on call type, plus weekly quotas), not per-process. Point
all 4 containers at one bind-mounted directory and they share a single
cross-process FIFO queue, a bounded pool of in-flight-request slots, a
capacity-1 token bucket and a 429 cooldown file (cooldown.json: one 429
on the key makes every process wait max(5 s, Retry-After) before its next
send), arbitrated via POSIX file locks (crash-safe: a dead process's lock is
released by the kernel). Single-MCP or STDIO deployments need nothing; the
limiter is off unless the directory variable is set.
# docker-compose.yml (excerpt, all 4 USPTO MCP services)
volumes:
uspto-rate-limit: {}
services:
pfw-mcp:
volumes:
- uspto-rate-limit:/var/run/uspto-shared-rate-limit
environment:
USPTO_SHARED_RATE_LIMIT_DIR: /var/run/uspto-shared-rate-limit
USPTO_SHARED_RATE_LIMIT_RPS: "4" # default; total across ALL 4 MCPs
USPTO_SHARED_MAX_CONCURRENT: "1" # default; shared in-flight slots (USPTO burst=1)
USPTO_SHARED_MAX_WAIT_SECONDS: "45" # default; queue wait ceiling, then the
# rate-limit envelope (no retry)
One queue, one token bucket and one concurrency slot are shared across every
process mounting the directory, served in arrival order. A PDF download
through the proxy is buffered from USPTO under the slot and the slot is
released before the first byte goes to the end user, so slot time depends on
USPTO's transfer speed, not the user's connection. On a 429 every ODP call
site records a shared cooldown, then retries ONCE after max(5 s, Retry-After) when that wait is at most 10 s and fits the call's budget;
otherwise it answers with the rate-limit envelope (retry_after_seconds = max(5, Retry-After)). A call that waits past the ceiling answers at once
with the same envelope (rate_limit_source: "shared_uspto_limiter").
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for USPTO Patent File Wrapper MCP Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/uspto_pfw_mcp)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

An MCP server that merges Google Search Console history with a live first-party crawl of your site to produce a prioritised, evidence-backed technical SEO audit inside Claude, complete with paste-ready fixes.

Runs a free Answer Engine Optimization and AI visibility report for a domain and returns a shareable report plus a structured summary.

An MCP server that offers intelligent web search using OpenAI reasoning models, with support for fast iterations and deep research.