Skip to content

Commit b714055

Browse files
committed
add featuers
1 parent ba217c9 commit b714055

File tree

19 files changed

+2071
-0
lines changed

19 files changed

+2071
-0
lines changed

.github/workflows/python-publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.10"
21+
22+
- name: Install build dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install build hatchling
26+
27+
- name: Build package
28+
run: python -m build
29+
30+
- name: Store distribution packages
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: python-package-distributions
34+
path: dist/
35+
36+
publish:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/upstage-mcp-server
42+
permissions:
43+
id-token: write
44+
45+
steps:
46+
- name: Download built package
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: python-package-distributions
50+
path: dist/
51+
52+
- name: Publish to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
password: ${{ secrets.PYPI_API_TOKEN }}
56+
user: __token__

.github/workflows/test-publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to TestPyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
build-and-publish:
14+
runs-on: ubuntu-latest
15+
environment:
16+
name: test-pypi
17+
url: https://test.pypi.org/p/upstage-mcp-server
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install build dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install build hatchling
31+
32+
- name: Build package
33+
run: python -m build
34+
35+
- name: Publish to TestPyPI
36+
uses: pypa/gh-action-pypi-publish@release/v1
37+
with:
38+
repository-url: https://test.pypi.org/legacy/
39+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
40+
user: __token__

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Distribution / packaging
2+
dist/
3+
build/
4+
*.egg-info/
5+
6+
# Python
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
.pytest_cache/
11+
.coverage
12+
htmlcov/
13+
14+
# Virtual environments
15+
venv/
16+
.venv/
17+
env/
18+
ENV/
19+
20+
# IDE files
21+
.vscode/
22+
.idea/
23+
*.swp
24+
*.swo

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Upstage
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
2+
# Upstage MCP Server
3+
4+
> A Model Context Protocol (MCP) server for Upstage AI's document digitization and information extraction capabilities
5+
6+
## Overview
7+
8+
The Upstage MCP Server provides a robust bridge between AI assistants and Upstage AI’s powerful document processing APIs. This server enables AI models—such as Claude—to effortlessly extract and structure content from various document types including PDFs, images, and Office files. The package supports multiple formats and comes with seamless integration options for Claude Desktop.
9+
10+
## Key Features
11+
12+
- **Document Digitization:** Extract structured content from documents while preserving layout.
13+
- **Information Extraction:** Retrieve specific data points using intelligent, customizable schemas.
14+
- **Multi-format Support:** Handles JPEG, PNG, BMP, PDF, TIFF, HEIC, DOCX, PPTX, and XLSX.
15+
- **Claude Desktop Integration:** Effortlessly connect with Claude and other MCP clients.
16+
17+
## Prerequisites
18+
19+
Before using this server, ensure you have the following:
20+
21+
1. **Upstage API Key:** Obtain your API key from [Upstage API](https://console.upstage.ai/api-keys?api=document-parsing).
22+
2. **Python 3.10+:** The server requires Python version 3.10 or higher.
23+
3. The MCP server relies upon **Astral UV** to run, please [install](https://docs.astral.sh/uv/getting-started/installation/)
24+
25+
## Installation & Configuration
26+
27+
This guide provides step-by-step instructions to set up and configure the upstage-mcp-server
28+
29+
### Using `uv` (Recommended)
30+
31+
No additional installation is required when using `uvx` as it handles execution. However, if you prefer to install the package directly:
32+
```bash
33+
uv pip install upstage-mcp-server
34+
```
35+
36+
## Configure Claude Desktop
37+
For integration with Claude Desktop, add the following content to your `claude_desktop_config.json`:
38+
39+
### Configuration Location
40+
41+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
42+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
43+
44+
### Using uvx Command (Recommended)
45+
46+
47+
```json
48+
{
49+
"mcpServers": {
50+
"upstage-mcp-server": {
51+
"command": "uvx",
52+
"args": ["upstage-mcp-server"],
53+
"env": {
54+
"UPSTAGE_API_KEY": "<your-api-key>"
55+
}
56+
}
57+
}
58+
}
59+
```
60+
61+
If `uvx` is not available globally, you may encounter a `Server disconnected` error. To resolve this, run `which uvx` to find its full path, and replace `"command": "uvx"` above with the returned path.
62+
63+
### After adding the configuration, restart Claude Desktop to apply the changes.
64+
65+
## Output Directories
66+
67+
Processing results are stored in your home directory under:
68+
69+
- **Document Parsing Results:**
70+
`~/.upstage-mcp-server/outputs/document_parsing/`
71+
- **Information Extraction Results:**
72+
`~/.upstage-mcp-server/outputs/information_extraction/`
73+
- **Generated Schemas:**
74+
`~/.upstage-mcp-server/outputs/information_extraction/schemas/`
75+
76+
## Local/Development Setup
77+
78+
Follow these steps to set up and run the project locally:
79+
80+
### Step 1: Clone the Repository
81+
82+
```bash
83+
git clone https://github.com/UpstageAI/upstage-mcp-server.git
84+
cd upstage-mcp-server
85+
```
86+
87+
### Step 2: Set Up the Python Environment
88+
89+
```bash
90+
# Install uv if not already installed
91+
pip install uv
92+
93+
# Create and activate a virtual environment
94+
uv venv
95+
96+
# Activate the virtual environment
97+
# On Windows:
98+
# .venv\Scripts\activate
99+
# On macOS/Linux:
100+
source .venv/bin/activate
101+
102+
# Install dependencies in editable mode
103+
uv pip install -e .
104+
```
105+
106+
### Step 3: Configure Claude Desktop for Local Testing
107+
108+
1. **Download Claude Desktop:**
109+
[Download Claude Desktop](https://claude.ai/download)
110+
111+
2. **Open and Edit Configuration:**
112+
- Navigate to **Claude → Settings → Developer → Edit Config**.
113+
- Edit the `claude_desktop_config.json` file with the following configurations:
114+
115+
**For Windows:**
116+
```json
117+
{
118+
"mcpServers": {
119+
"upstage-mcp-server": {
120+
"command": "uv",
121+
"args": [
122+
"run",
123+
"--directory",
124+
"C:\\path\\to\\cloned\\upstage-mcp-server",
125+
"python",
126+
"-m",
127+
"upstage_mcp.server"
128+
],
129+
"env": {
130+
"UPSTAGE_API_KEY": "your_api_key_here"
131+
}
132+
}
133+
}
134+
}
135+
```
136+
Replace `C:\\path\\to\\cloned\\upstage-mcp-server` with your actual repository path.
137+
138+
**For macOS/Linux:**
139+
```json
140+
{
141+
"mcpServers": {
142+
"upstage-mcp-server": {
143+
"command": "/Users/username/.local/bin/uv",
144+
"args": [
145+
"run",
146+
"--directory",
147+
"/path/to/cloned/upstage-mcp-server",
148+
"python",
149+
"-m",
150+
"upstage_mcp.server"
151+
],
152+
"env": {
153+
"UPSTAGE_API_KEY": "your_api_key_here"
154+
}
155+
}
156+
}
157+
}
158+
```
159+
Replace:
160+
- `/Users/username/.local/bin/uv` with the output of `which uv`.
161+
- `/path/to/cloned/upstage-mcp-server` with the absolute path to your local clone.
162+
163+
> **Tip for macOS/Linux users:** If connection issues occur, using the full path to your uv executable can improve reliability.
164+
165+
After configuring, restart Claude Desktop.
166+
167+
## Available Tools
168+
169+
The server exposes two primary tools for AI models:
170+
171+
1. **Document Parsing (`parse_document`):**
172+
- **Description:** Processes documents and extracts content while preserving structure.
173+
- **Parameter:**
174+
`file_path` – the path to the document to be processed.
175+
- **Example Query:**
176+
*"Can you parse the document at `C:\Users\username\Documents\contract.pdf` and provide a summary?"*
177+
178+
2. **Information Extraction (`extract_information`):**
179+
- **Description:** Extracts structured information from documents based on predefined or auto-generated schemas.
180+
- **Parameters:**
181+
`file_path` – the document file path;
182+
`schema_path` (optional) – a JSON file with an extraction schema;
183+
`auto_generate_schema` (default true) – whether to auto-generate a schema.
184+
- **Example Query:**
185+
*"Extract the invoice number, date, and total from `C:\Users\username\Documents\invoice.pdf`."*
186+
187+
Below is the revised troubleshooting section formatted as requested. You can copy and paste the following Markdown directly into your README:
188+
189+
190+
## Troubleshooting
191+
192+
### Common Issues
193+
194+
- **API Key Missing:**
195+
Ensure that your UPSTAGE_API_KEY is correctly set in your `claude_desktop_config.json` file. Obtain a valid API key from [Upstage Console](https://console.upstage.ai/api-keys).
196+
197+
- **File Not Found:**
198+
Double-check the file path for correctness and accessibility. Ensure that file paths are absolute (e.g., `C:\Users\name\Documents\file.pdf`) and that any special characters in the path are properly escaped.
199+
200+
- **Server Not Starting:**
201+
Verify that your virtual environment is activated and all dependencies are installed. Additionally, review the Claude Desktop log files for errors:
202+
- **Windows:** `%APPDATA%\Claude\logs\mcp-server-upstage-mcp-server.log`
203+
- **macOS:** `~/Library/Logs/Claude/mcp-server-upstage-mcp-server.log`
204+
205+
- **Server Connection Issues:**
206+
Restart Claude Desktop. Ensure that `uvx` is installed and available in your system PATH, or use its absolute path in your configuration if needed.
207+
208+
- **Processing Failures:**
209+
Check that the document is in a supported format (PDF, JPEG, PNG, TIFF, etc.), its file size is under 50MB, and it contains fewer than 100 pages. Test with a simpler document to confirm functionality.
210+
211+
- **Invalid Document Format:**
212+
Verify that the document is in a supported, uncorrupted format.
213+
214+
- **Failed to Connect to Upstage API:**
215+
Confirm your network connection, firewall settings, and configuration details in `claude_desktop_config.json`. Review the logs for more detailed error messages.
216+
217+
### Log Files
218+
219+
For troubleshooting, view the server logs at:
220+
221+
- **Windows:**
222+
`%APPDATA%\Claude\logs\mcp-server-upstage-mcp-server.log`
223+
- **macOS:**
224+
`~/Library/Logs/Claude/mcp-server-upstage-mcp-server.log`
225+
226+
## Contributing
227+
228+
Contributions are welcome! If you wish to enhance the project or add new features, please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.
229+
230+
## License
231+
232+
This project is licensed under the MIT License.
233+

0 commit comments

Comments
 (0)