Metadata-Version: 2.4
Name: uyanip-mcp
Version: 1.0.0
Summary: MCP server for structured intellectual property data retrieval
Project-URL: Homepage, https://github.com/anomalyco/opencode
Project-URL: Source, https://github.com/anomalyco/opencode/tree/main/.config/opencode/mcp-servers/uyanip
License: MIT
License-File: LICENSE
Keywords: intellectual-property,ip,mcp,model-context-protocol
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: curl-cffi>=0.13.0
Requires-Dist: mcp>=1.0.0
Requires-Dist: pycryptodome>=3.20.0
Description-Content-Type: text/markdown

# uyanip-mcp

MCP (Model Context Protocol) server that provides structured intellectual property data retrieval via HTTP API. Supports CN, US, EP, JP, KR, WO/PCT, and other major authorities.

Built for AI agents to seamlessly retrieve IP information during software engineering, competitive research, and analysis tasks.

## Features

- **Global coverage** — CN / US / EP / JP / KR / WO / DE / CA / AU / GB / FR and more
- **Dual number formats** — application numbers and publication numbers
- **Full content** — bibliographic info, claims, description, drawings, PDF file download
- **Auto-login** — RSA-encrypted authentication via environment variables
- **Session persistence** — cookies and tokens survive restarts via disk cache
- **Token refresh** — auto-refreshes expired access tokens transparently
- **Batch query** — fetch multiple records with built-in rate-limit awareness

## Prerequisites

- Python 3.11+

## Installation

```bash
pip install uyanip-mcp
```

## Configuration

Set the following environment variables:

| Variable | Description |
|---|---|
| `UYANIP_USERNAME` | Your account username (phone or email) |
| `UYANIP_PASSWORD` | Your account password |

## Usage

### With opencode

Register in `opencode.jsonc`:

```jsonc
{
  "mcp": {
    "uyanip-mcp": {
      "type": "local",
      "command": ["uvx", "uyanip-mcp"],
      "environment": {
        "UYANIP_USERNAME": "your-username",
        "UYANIP_PASSWORD": "your-password"
      }
    }
  }
}
```

### Command-line

```bash
uvx uyanip-mcp
```

### Python API

```python
from uyanip_mcp.api_client import login_from_config, fetch_bibliographic

login_from_config()

info = fetch_bibliographic("CN115353203A")
```

## Available Tools

| Tool | Description | Input |
|---|---|---|
| `login` | Authenticate with credentials | `username`, `password` |
| `fetch_bibliographic` | Get bibliographic information | `patent_no` |
| `fetch_claims` | Get claims text | `patent_no` |
| `fetch_description` | Get description text | `patent_no` |
| `fetch_drawings` | Get drawing image URLs | `patent_no` |
| `fetch_patent_content` | Get all content in one call | `patent_no` |
| `batch_fetch_patents` | Fetch multiple records (rate-limited) | `patent_nos` (array) |
| `fetch_patent_pdf` | Download PDF (base64-encoded) | `patent_no` |

## License

MIT
