Skip to content

Commit a47e62f

Browse files
committed
docs: update documentation and usage policy
1 parent e20fd71 commit a47e62f

9 files changed

Lines changed: 311 additions & 25 deletions

File tree

README.md

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,78 @@
11
# NBER-CLI
2+
A command line interface for downloading the National Bureau of Economic Research (NBER) paper without brower.
23

3-
NBER-CLI is a command line tool for downloading NBER paper PDFs.
4+
[![Pytest](https://github.com/SepineTam/NBER-CLI/actions/workflows/pytest.yml/badge.svg)](https://github.com/SepineTam/NBER-CLI/actions/workflows/pytest.yml)
5+
[![Lint](https://github.com/SepineTam/NBER-CLI/actions/workflows/lint.yml/badge.svg)](https://github.com/SepineTam/NBER-CLI/actions/workflows/lint.yml)
6+
[![Docs](https://github.com/SepineTam/NBER-CLI/actions/workflows/docs.yml/badge.svg)](https://github.com/SepineTam/NBER-CLI/actions/workflows/docs.yml)
7+
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
48

5-
## Installation
9+
[简体中文](README.zh-CN.md) | [Documentation](docs/index.md)
10+
11+
> **NBER** is a registered trademark of the [National Bureau of Economic Research](https://www.nber.org). This project is an independent open-source tool and is **not affiliated with, endorsed by, or sponsored by** the National Bureau of Economic Research. By using this project, you agree to the [Usage Policy](docs/en/policy.md).
12+
13+
## Features
14+
15+
- Search NBER working papers by title, paper number, author, abstract, or keyword.
16+
- Fetch structured metadata and abstracts for a paper ID such as `w25000`.
17+
- Download single papers or batches as PDF files.
18+
- Expose the same core workflows as MCP tools for AI agents.
19+
- Return human-readable output by default, with JSON output for automation.
20+
21+
## Quick Start
22+
23+
Run commands directly with `uvx`:
624

725
```bash
8-
pip install nber-cli
26+
uvx nber-cli search "Labor Economic"
27+
uvx nber-cli info w25000
28+
uvx nber-cli download w34567
929
```
1030

11-
## CLI v0.2 Usage
31+
Or install the command first:
1232

1333
```bash
14-
nber-cli download w1234
15-
nber-cli download w1234 --file /path/to/save/w1234.pdf
16-
nber-cli download w1234 -f /path/to/save/w1234.pdf
17-
nber-cli download w1234 --save-base /path/to/save
18-
nber-cli download w1234 -s /path/to/save
19-
nber-cli download --batch w1234 w23156 w1516 --save-base /path/to/save
20-
nber-cli download -b w1235 w4568 w0485
21-
nber-cli info w34255
22-
nber-cli info w34255 -f json
23-
nber-cli search "labor economics"
24-
nber-cli search "ChatGPT" --start-date 2024-01-01 --per-page 20
25-
nber-cli search "ChatGPT" -f json
34+
uv tool install nber-cli
35+
nber-cli search "Labor Economic"
36+
nber-cli info w25000
37+
nber-cli download w34567
2638
```
2739

28-
Rules:
40+
## MCP Server for Agents
41+
42+
NBER-CLI can run as a stdio MCP server:
43+
44+
```bash
45+
uvx nber-cli mcp-server
46+
```
2947

30-
- If neither `--file` nor `--save-base` is set, files are saved to `Path.cwd()`.
31-
- If both `--file` and `--save-base` are set, `--file` wins.
32-
- Batch download supports `--save-base` only.
33-
- Batch download does not support `--file`.
34-
- `info` and `search` default to list output. Use `--format json` or `-f json` for structured output.
48+
Example MCP client configuration:
3549

50+
```json
51+
{
52+
"mcpServers": {
53+
"nber-cli": {
54+
"command": "uvx",
55+
"args": ["nber-cli", "mcp-server"]
56+
}
57+
}
58+
}
59+
```
60+
61+
The MCP server exposes tools for paper lookup, search, and PDF download.
62+
63+
## Documentation
64+
65+
More usage details, command references, MCP setup, Python API examples, development notes, and release history are available in the [documentation](docs/index.md).
66+
67+
## Development
68+
69+
```bash
70+
uv sync --dev --group docs
71+
uv run pytest
72+
uv run ruff check .
73+
uv run --group docs mkdocs serve
74+
```
3675

3776
## License
3877

39-
[Apache-2.0](LICENSE)
78+
NBER-CLI is released under the [Apache-2.0 License](LICENSE).

README.zh-CN.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# NBER-CLI
2+
一个用于下载 National Bureau of Economic Research (NBER) 工作论文的命令行界面。
3+
4+
[![Pytest](https://github.com/SepineTam/NBER-CLI/actions/workflows/pytest.yml/badge.svg)](https://github.com/SepineTam/NBER-CLI/actions/workflows/pytest.yml)
5+
[![Lint](https://github.com/SepineTam/NBER-CLI/actions/workflows/lint.yml/badge.svg)](https://github.com/SepineTam/NBER-CLI/actions/workflows/lint.yml)
6+
[![Docs](https://github.com/SepineTam/NBER-CLI/actions/workflows/docs.yml/badge.svg)](https://github.com/SepineTam/NBER-CLI/actions/workflows/docs.yml)
7+
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
8+
9+
[English](README.md) | [中文文档](docs/zh-CN/index.md)
10+
11+
> **NBER**[美国国家经济研究局](https://www.nber.org)(National Bureau of Economic Research)的注册商标。本项目是独立的开源工具,与美国国家经济研究局**不存在任何附属、认可或赞助关系**。使用本项目即视为同意[使用政策](docs/zh/policy.md)
12+
13+
## 功能特性
14+
15+
- 按标题、论文编号、作者、摘要或关键词搜索 NBER 工作论文。
16+
- 通过 `w25000` 这样的论文编号获取结构化元数据和摘要。
17+
- 下载单篇或批量论文 PDF。
18+
- 通过 MCP 工具把核心能力暴露给 AI Agent。
19+
- 默认输出适合阅读的文本,也支持 JSON 输出用于自动化流程。
20+
21+
## 快速开始
22+
23+
直接通过 `uvx` 运行:
24+
25+
```bash
26+
uvx nber-cli search "Labor Economic"
27+
uvx nber-cli info w25000
28+
uvx nber-cli download w34567
29+
```
30+
31+
也可以先安装命令:
32+
33+
```bash
34+
uv tool install nber-cli
35+
nber-cli search "Labor Economic"
36+
nber-cli info w25000
37+
nber-cli download w34567
38+
```
39+
40+
## 给 Agent 使用的 MCP Server
41+
42+
NBER-CLI 可以作为 stdio MCP server 运行:
43+
44+
```bash
45+
uvx nber-cli mcp-server
46+
```
47+
48+
MCP 客户端配置示例:
49+
50+
```json
51+
{
52+
"mcpServers": {
53+
"nber-cli": {
54+
"command": "uvx",
55+
"args": ["nber-cli", "mcp-server"]
56+
}
57+
}
58+
}
59+
```
60+
61+
MCP server 提供论文查询、搜索和 PDF 下载工具。
62+
63+
## 文档
64+
65+
更完整的用法、命令参考、MCP 配置、Python API 示例、开发说明和发布记录请见 [中文文档](docs/zh-CN/index.md)
66+
67+
## 开发
68+
69+
```bash
70+
uv sync --dev --group docs
71+
uv run pytest
72+
uv run ruff check .
73+
uv run --group docs mkdocs serve
74+
```
75+
76+
## 许可证
77+
78+
NBER-CLI 使用 [Apache-2.0 License](LICENSE) 发布。

docs/en/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ uv run --group docs mkdocs build --strict
3434
When adding a new documentation page:
3535

3636
1. Add the English page under `docs/`.
37-
2. Add the Simplified Chinese page under `docs/zh-CN/`.
37+
2. Add the Simplified Chinese page under `docs/zh/`.
3838
3. Register both pages in `mkdocs.yml`.
3939
4. Run `uv run --group docs mkdocs build --strict`.
4040

docs/en/policy.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Usage Policy
2+
3+
> If there is any conflict or inconsistency between this English version and the Chinese version, the Chinese version shall prevail.
4+
5+
## NBER and NBER-CLI
6+
7+
The National Bureau of Economic Research (NBER) is an independent, non-profit, nonpartisan economic research organization that publishes and distributes working papers, research metadata, newsletters, and related materials through [nber.org](https://www.nber.org).
8+
9+
**NBER** is a registered trademark of the National Bureau of Economic Research. NBER-CLI is an independent open-source project and is not affiliated with, endorsed by, sponsored by, or operated by NBER.
10+
11+
NBER-CLI is a command-line and MCP utility for searching NBER working papers, reading publicly exposed paper metadata, and requesting PDF downloads from NBER-hosted URLs. It does not host NBER content, provide a substitute distribution service, or create any separate entitlement to access NBER materials. Every use of NBER-CLI remains subject to NBER's [Website Privacy Policy](https://www.nber.org/nber-website-privacy-policy), [working paper access and authorization rules](https://www.nber.org/nber-help-working-papers-general-information), [copyright and permission rules](https://www.nber.org/nber-help-working-papers-general-information), [subscription terms of use](https://www.nber.org/subscribe/information-libraries), and any other policy or access condition that NBER publishes or updates.
12+
13+
## Project Boundaries
14+
15+
- **No project-side storage**: NBER-CLI does not operate servers, caches, mirrors, databases, CDNs, or other infrastructure for storing NBER papers or metadata. Requests go directly from the user's machine or agent runtime to NBER's website. Runtime data is transient unless the user explicitly asks the tool to write output locally.
16+
- **User-controlled local files**: When a user runs a download command, any PDF is saved only to the local path selected by that user. The project does not receive, retain, index, or redistribute that file.
17+
- **No access circumvention**: NBER-CLI does not bypass subscriptions, paywalls, account requirements, IP-based authorization, first-week or recent-paper restrictions, access limits, or other controls imposed by NBER. If NBER returns a denial, error, redirect, or unavailable response, the tool treats that response as authoritative.
18+
- **No traffic masking**: NBER-CLI uses standard Python HTTP libraries and ordinary request headers. It does not provide proxy pools, IP rotation, credential sharing, CAPTCHA bypass, request-signature manipulation, or other evasion mechanisms.
19+
- **No redistribution rights**: Installing or using NBER-CLI does not grant any license to repost, mirror, sell, sublicense, train on, or otherwise reuse NBER content beyond what NBER, the relevant authors, and applicable law allow.
20+
21+
## Access, Copyright, and User Responsibility
22+
23+
NBER decides what is available through its website and under what conditions. Access may depend on publication date, subscription status, institutional eligibility, geographic eligibility, account authorization, or other rules set by NBER. Users are responsible for confirming that their use is permitted before downloading, copying, quoting, sharing, or otherwise using any NBER material.
24+
25+
NBER states that copyright in NBER Working Papers is held by the respective authors rather than by NBER. NBER-CLI does not own paper content and cannot grant permissions for uses beyond the access made available by NBER or the rights provided by law. Requests for permission beyond fair use or other applicable exceptions should be directed to the appropriate rights holder.
26+
27+
NBER-CLI is intended for lawful personal research, education, and reproducible research workflows. It is not intended for systematic bulk harvesting, public mirroring, reposting, resale, unauthorized commercial use, or any workflow designed to avoid NBER's access decisions.
28+
29+
## Operational Transparency
30+
31+
Search and metadata features use NBER web pages and website endpoints that are part of the normal operation of nber.org. PDF downloads request files from URLs served by NBER. The project does not claim that these interfaces are official APIs, stable APIs, or approved integration points.
32+
33+
Metadata, abstracts, links, availability, and files are provided by NBER and may be incomplete, delayed, revised, removed, rate limited, or otherwise changed without notice. NBER-CLI may stop working if NBER changes its website structure, access policy, endpoints, authorization checks, or file locations.
34+
35+
## Allocation of Risk
36+
37+
NBER-CLI is provided as an independent open-source tool on an "as is" and "as available" basis. The maintainers do not control NBER's website, content, copyright permissions, access decisions, uptime, or policies, and do not promise continued access to any NBER material.
38+
39+
By using NBER-CLI, users accept responsibility for their own requests, downloads, storage choices, and downstream use of any materials obtained from NBER. The maintainers are not responsible for access denials, account or network restrictions, copyright or licensing disputes, data loss, service interruptions, policy violations, or other consequences arising from a user's use of NBER-CLI.

docs/en/python-api.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,28 @@ async def main() -> None:
6565
await download_paper_to_file("w25000", Path("papers/w25000.pdf"))
6666

6767

68+
asyncio.run(main())
69+
```
70+
71+
## Download Multiple Papers
72+
73+
```python
74+
import asyncio
75+
from pathlib import Path
76+
77+
from nber_cli import download_multiple_papers
78+
79+
80+
async def main() -> None:
81+
result = await download_multiple_papers(
82+
["w34567", "w25000", "w32000"],
83+
Path("papers"),
84+
)
85+
print(f"Downloaded {len(result.paths)} papers")
86+
for failure in result.failures:
87+
print(f"Failed: {failure.paper_id} - {failure.error}")
88+
89+
6890
asyncio.run(main())
6991
```
7092

@@ -96,6 +118,20 @@ asyncio.run(main())
96118
| `start_date` | `str` or `None` | Applied start date. |
97119
| `end_date` | `str` or `None` | Applied end date. |
98120

121+
### DownloadFailure
122+
123+
| Field | Type | Description |
124+
| --- | --- | --- |
125+
| `paper_id` | `str` | The paper ID that failed to download. |
126+
| `error` | `BaseException` | The exception raised during the download attempt. |
127+
128+
### DownloadBatchResult
129+
130+
| Field | Type | Description |
131+
| --- | --- | --- |
132+
| `paths` | `list[Path]` | Paths of successfully downloaded PDFs. |
133+
| `failures` | `list[DownloadFailure]` | Failed downloads with their errors. |
134+
99135
## Formatter Helpers
100136

101137
Use formatter helpers when you want stable dictionaries for JSON output or MCP-style responses:
@@ -107,3 +143,12 @@ from nber_cli import info, related, search_results
107143
- `info(paper)` returns core metadata.
108144
- `related(paper)` returns related optional fields.
109145
- `search_results(results)` returns a structured search payload.
146+
147+
For human-readable text output, use the text formatters:
148+
149+
```python
150+
from nber_cli import info_text, search_results_text
151+
```
152+
153+
- `info_text(paper, include_all=False)` returns a formatted text string with paper details. Set `include_all=True` to include topic, programs, and published version.
154+
- `search_results_text(results)` returns a formatted text string with search results.

docs/zh/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ uv run --group docs mkdocs build --strict
3434
新增文档页时:
3535

3636
1.`docs/` 下添加英文页面。
37-
2.`docs/zh-CN/` 下添加简体中文页面。
37+
2.`docs/zh/` 下添加简体中文页面。
3838
3.`mkdocs.yml` 中注册两个页面。
3939
4. 运行 `uv run --group docs mkdocs build --strict`
4040

docs/zh/policy.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# 使用政策
2+
3+
## NBER 与 NBER-CLI
4+
5+
National Bureau of Economic Research(NBER,美国国家经济研究局)是一家独立、非营利、无党派的经济研究机构,通过 [nber.org](https://www.nber.org) 发布和传播工作论文、研究元数据、通讯及相关研究材料。
6+
7+
**NBER** 是 National Bureau of Economic Research 的注册商标。NBER-CLI 是独立的开源项目,不隶属于 NBER,亦未获得 NBER 的认可、背书、赞助或运营授权。
8+
9+
NBER-CLI 是一个命令行与 MCP 工具,用于帮助用户搜索 NBER 工作论文、读取公开展示的论文元数据,并从 NBER 托管的 URL 请求 PDF 下载。它不托管 NBER 内容,不提供替代分发服务,也不为用户创造任何独立于 NBER 之外的访问资格。使用 NBER-CLI 始终受 NBER 的[网站隐私政策](https://www.nber.org/nber-website-privacy-policy)[工作论文访问与授权规则](https://www.nber.org/nber-help-working-papers-general-information)[版权与许可规则](https://www.nber.org/nber-help-working-papers-general-information)[订阅使用条款](https://www.nber.org/subscribe/information-libraries),以及 NBER 已发布或未来更新的其他政策和访问条件约束。
10+
11+
## 项目边界
12+
13+
- **不进行项目侧存储**:NBER-CLI 不运营用于存储 NBER 论文或元数据的服务器、缓存、镜像、数据库、CDN 或其他基础设施。请求直接从用户的设备或 Agent 运行环境发往 NBER 网站。除非用户明确要求把结果写入本地文件,运行时数据仅作临时处理。
14+
- **本地文件由用户控制**:当用户执行下载命令时,PDF 只会保存到用户选择的本地路径。本项目不会接收、保留、索引或再分发该文件。
15+
- **不绕过访问限制**:NBER-CLI 不绕过订阅、付费墙、账号要求、基于 IP 的授权、新近论文或首周访问限制、访问额度,或 NBER 设置的其他控制措施。如果 NBER 返回拒绝、错误、跳转或不可用响应,本工具会将该响应视为有效结果。
16+
- **不隐藏或伪装流量**:NBER-CLI 使用标准 Python HTTP 库和常规请求头,不提供代理池、IP 轮换、凭据共享、验证码绕过、请求签名篡改或其他规避机制。
17+
- **不授予再分发权利**:安装或使用 NBER-CLI 不代表用户获得转载、镜像、销售、再授权、训练模型,或以其他方式复用 NBER 内容的许可;相关使用仍以 NBER、相应作者及适用法律允许的范围为准。
18+
19+
## 访问、版权与用户责任
20+
21+
NBER 决定其网站上哪些内容可访问,以及在什么条件下可访问。访问资格可能取决于论文发布时间、订阅状态、机构资格、地区资格、账号授权,或 NBER 设置的其他规则。用户在下载、复制、引用、分享或以其他方式使用任何 NBER 材料前,应自行确认相关使用是否被允许。
22+
23+
NBER 说明其 Working Papers 的版权由相应作者持有,而非由 NBER 持有。NBER-CLI 不拥有任何论文内容,也无权授予超出 NBER 已开放访问范围或法律允许范围之外的使用许可。涉及合理使用或其他法定例外之外的许可请求,应由用户向相应权利人确认。
24+
25+
NBER-CLI 的目标用途是合法的个人研究、教育和可复现研究流程。它不适用于系统性批量抓取、公开镜像、转载、转售、未经授权的商业使用,或任何旨在规避 NBER 访问决定的流程。
26+
27+
## 运行透明性
28+
29+
搜索和元数据功能使用 NBER 网页,以及 nber.org 正常运行过程中使用的网站端点。PDF 下载会请求由 NBER 提供的文件 URL。本项目不声称这些接口是官方 API、稳定 API 或经 NBER 批准的集成方式。
30+
31+
元数据、摘要、链接、可访问性和文件均由 NBER 提供,可能存在不完整、延迟、修订、移除、限流或其他变更。若 NBER 更改网站结构、访问政策、端点、授权校验或文件位置,NBER-CLI 可能无法继续工作。
32+
33+
## 风险归属
34+
35+
NBER-CLI 作为独立开源工具,按“现状”和“可用时”提供。维护者不控制 NBER 的网站、内容、版权许可、访问决定、服务可用性或政策,也不承诺用户可以持续访问任何 NBER 材料。
36+
37+
使用 NBER-CLI 即表示用户自行承担其请求、下载、本地存储选择,以及后续使用 NBER 材料所产生的责任。维护者不对访问被拒、账号或网络受限、版权或许可争议、数据丢失、服务中断、政策违反,或因用户使用 NBER-CLI 而产生的其他后果承担责任。

0 commit comments

Comments
 (0)