Skip to content

Commit 11d5974

Browse files
committed
feat: initialize project with basic configuration and structure
0 parents  commit 11d5974

File tree

15 files changed

+1204
-0
lines changed

15 files changed

+1204
-0
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Quip API token (required)
2+
QUIP_TOKEN=your_quip_api_token_here
3+
4+
# Quip API base URL (optional, defaults to https://platform.quip.com)
5+
QUIP_BASE_URL=https://platform.quip.com

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
.coverage
23+
24+
# Environment
25+
.env
26+
.venv
27+
env/
28+
venv/
29+
ENV/
30+
env.bak/
31+
venv.bak/
32+
33+
# IDE
34+
.idea/
35+
.vscode/
36+
*.swp
37+
*.swo
38+
39+
# Logs
40+
*.log
41+
42+
# Temporary files
43+
*.xlsx
44+
*.csv
45+
temp/
46+
tmp/
47+
.aider*

.python-version

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

.uv/config.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# uv configuration file
2+
3+
# Default Python version to use
4+
python-version = "3.12"
5+
6+
# Use a specific index URL for package downloads
7+
index-url = "https://pypi.org/simple"
8+
9+
# Enable verbose output for debugging
10+
verbose = false
11+
12+
# Enable colored output
13+
color = true
14+
15+
# Default virtual environment directory
16+
venv-path = ".venv"
17+
18+
# Automatically activate the virtual environment
19+
auto-activate = true

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
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: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# Quip MCP Server
2+
3+
A Model Context Protocol (MCP) server for interacting with Quip spreadsheets. This server provides tools to read spreadsheet data from Quip documents and return the content in CSV format.
4+
5+
## Features
6+
7+
- Retrieve spreadsheet content from Quip documents
8+
- Support for selecting specific sheets by name
9+
- Returns data in CSV format
10+
- Handles authentication via Quip API token
11+
- Provides appropriate error messages for non-spreadsheet documents
12+
13+
## Installation
14+
15+
### Using uvx (recommended)
16+
17+
When using [`uv`](https://docs.astral.sh/uv/), no specific installation is needed. We will use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run the server:
18+
19+
```bash
20+
# Install uv if you don't have it
21+
curl -LsSf https://astral.sh/uv/install.sh | sh
22+
23+
# Run the server directly with uvx
24+
uvx quip-mcp-server
25+
```
26+
27+
### Using pip
28+
29+
Alternatively, you can install the package via pip:
30+
31+
```bash
32+
pip install quip-mcp-server
33+
```
34+
35+
After installation, you can run it as a script:
36+
37+
```bash
38+
python -m src.server
39+
```
40+
41+
### Set up environment variables
42+
43+
Set up the required environment variables:
44+
45+
```bash
46+
export QUIP_TOKEN=your_quip_api_token
47+
export QUIP_BASE_URL=https://platform.quip.com # Optional, defaults to this value
48+
```
49+
50+
Alternatively, create a `.env` file in the root directory:
51+
```
52+
QUIP_TOKEN=your_quip_api_token
53+
QUIP_BASE_URL=https://platform.quip.com
54+
```
55+
56+
## Usage
57+
58+
### Configure for Claude.app
59+
60+
Add to your Claude settings:
61+
62+
```json
63+
"mcpServers": {
64+
"quip": {
65+
"command": "uvx",
66+
"args": ["quip-mcp-server"],
67+
"env": {
68+
"QUIP_TOKEN": "your_quip_api_token"
69+
}
70+
}
71+
}
72+
```
73+
74+
### Running the Server Manually
75+
76+
Run the server directly:
77+
78+
```bash
79+
# Using uvx (recommended)
80+
uvx quip-mcp-server
81+
82+
# Using python (if installed via pip)
83+
python -m src.server
84+
```
85+
86+
### Available Tools
87+
88+
#### quip_read_spreadsheet
89+
90+
Retrieves the content of a Quip spreadsheet as CSV.
91+
92+
**Parameters:**
93+
- `threadId` (required): The Quip document thread ID
94+
- `sheetName` (optional): Name of the sheet to extract. If not provided, the first sheet will be used.
95+
96+
**Example:**
97+
```json
98+
{
99+
"threadId": "AbCdEfGhIjKl",
100+
"sheetName": "Sheet1"
101+
}
102+
```
103+
104+
**Response:**
105+
The tool returns the spreadsheet content in CSV format.
106+
107+
**Error Handling:**
108+
- If the thread is not a spreadsheet, an error will be returned.
109+
- If the specified sheet is not found, an error will be returned.
110+
111+
## How It Works
112+
113+
The server uses two methods to extract spreadsheet data:
114+
115+
1. **Primary Method**: Exports the spreadsheet to XLSX format using the Quip API, then converts it to CSV.
116+
2. **Fallback Method**: If the primary method fails, it parses the HTML content of the document to extract the table data.
117+
118+
## Development
119+
120+
### Project Structure
121+
122+
```
123+
quip-mcp-server/
124+
├── src/
125+
│ ├── __init__.py
126+
│ ├── server.py # Main MCP server implementation
127+
│ ├── quip_client.py # Quip API client
128+
│ └── tools.py # Tool definitions and handlers
129+
├── tests/
130+
│ ├── __init__.py
131+
│ └── test_server.py # Unit tests for the server
132+
├── .uv/
133+
│ └── config.toml # uv configuration settings
134+
├── pyproject.toml # Project metadata and dependencies (includes pytest config)
135+
├── uvproject.yaml # uv-specific project configuration
136+
├── uv.lock # Locked dependencies
137+
├── .python-version # Python version specification
138+
├── .env.example # Example environment variables
139+
├── LICENSE # MIT License
140+
└── README.md # Documentation
141+
```
142+
143+
### Development with uv
144+
145+
This project uses [uv](https://github.com/astral-sh/uv) for dependency management. uv is a fast Python package installer and resolver that can replace pip and virtualenv.
146+
147+
#### Configuration Files
148+
149+
- `pyproject.toml`: Standard Python packaging configuration
150+
- `uvproject.yaml`: uv-specific project configuration
151+
- `.uv/config.toml`: uv configuration settings
152+
- `.python-version`: Specifies Python 3.12 as the project's Python version (used by pyenv and other version managers)
153+
154+
#### Setting Up a Development Environment
155+
156+
To set up a development environment:
157+
158+
```bash
159+
# Install uv if you don't have it
160+
curl -LsSf https://astral.sh/uv/install.sh | sh
161+
162+
# Create a virtual environment and install dependencies
163+
uv venv
164+
uv pip install -e .
165+
166+
# Install development dependencies
167+
uv pip install pytest black isort mypy
168+
```
169+
170+
Alternatively, you can use the uvproject.yaml file:
171+
172+
```bash
173+
# Install dependencies from uvproject.yaml
174+
uv pip sync
175+
```
176+
177+
#### Running the Server with uv
178+
179+
```bash
180+
# Using uvx (recommended for development)
181+
uvx quip-mcp-server
182+
183+
# Or, if you're using a virtual environment:
184+
# Activate the virtual environment (if not auto-activated)
185+
source .venv/bin/activate
186+
187+
# Run the server
188+
python -m src.server
189+
```
190+
191+
#### Running Tests
192+
193+
The project uses pytest for testing. To run the tests:
194+
195+
```bash
196+
# Install development dependencies
197+
uv pip install -e ".[dev]"
198+
199+
# Run tests
200+
pytest
201+
202+
# Run tests with coverage
203+
pytest --cov=src
204+
```
205+
206+
#### Debugging
207+
208+
You can use the MCP inspector to debug the server:
209+
210+
```bash
211+
# For uvx installations
212+
npx @modelcontextprotocol/inspector uvx quip-mcp-server
213+
214+
# Or if you're developing locally
215+
cd /path/to/quip-mcp-server
216+
npx @modelcontextprotocol/inspector uv run src.server
217+
```
218+
219+
### Adding New Tools
220+
221+
To add new tools:
222+
223+
1. Define the tool in `src/tools.py` by adding it to the `get_quip_tools()` function.
224+
2. Implement the handler function for the tool.
225+
3. Register the handler in `src/server.py` by adding it to the `call_tool()` function.
226+
227+
## License
228+
229+
[MIT License](LICENSE)

pyproject.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "quip-mcp-server"
7+
version = "0.1.0"
8+
description = "MCP server for interacting with Quip spreadsheets"
9+
readme = "README.md"
10+
requires-python = ">=3.12"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "Kane Zhu", email = "me@kane.mx"},
14+
]
15+
dependencies = [
16+
"mcp-python>=0.1.0",
17+
"requests>=2.28.0",
18+
"beautifulsoup4>=4.11.0",
19+
"openpyxl>=3.0.10",
20+
"python-dotenv>=0.20.0",
21+
]
22+
23+
[project.optional-dependencies]
24+
dev = [
25+
"pytest>=7.0.0",
26+
"pytest-asyncio>=0.21.0",
27+
"pytest-cov>=4.1.0",
28+
"black>=23.0.0",
29+
"isort>=5.12.0",
30+
"mypy>=1.0.0",
31+
]
32+
33+
[project.scripts]
34+
quip-mcp-server = "src.server:main"
35+
36+
[project.entry-points.uvx]
37+
quip-mcp-server = "src.server:main"
38+
39+
[project.urls]
40+
"Homepage" = "https://github.com/yourusername/quip-mcp-server"
41+
"Bug Tracker" = "https://github.com/yourusername/quip-mcp-server/issues"
42+
43+
[tool.hatch.build.targets.wheel]
44+
packages = ["src"]
45+
46+
[tool.pytest.ini_options]
47+
testpaths = ["tests"]
48+
python_files = "test_*.py"
49+
python_classes = "Test*"
50+
python_functions = "test_*"
51+
addopts = "-v"
52+
53+
[tool.coverage.run]
54+
source = ["src"]
55+
omit = ["tests/*"]
56+
57+
[tool.coverage.report]
58+
exclude_lines = [
59+
"pragma: no cover",
60+
"def __repr__",
61+
"raise NotImplementedError",
62+
"if __name__ == .__main__.:",
63+
"pass",
64+
"raise ImportError",
65+
]

src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This file is intentionally left empty to make the directory a Python package

0 commit comments

Comments
 (0)