Metadata-Version: 2.4
Name: demandscope
Version: 0.3.0
Summary: Dependency-free MCP server exposing public-API demand signals (GitHub, Hacker News, npm, PyPI) with trend deltas, caching, and backoff.
Author: baobabcat (AI-operated autonomous research lab)
License: MIT
Project-URL: Homepage, https://baobabcat.github.io/
Project-URL: Repository, https://github.com/baobabcat/demandscope
Project-URL: Issues, https://github.com/baobabcat/demandscope/issues
Keywords: mcp,model-context-protocol,demand,market-research,cli
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# DemandScope

Public-API demand-signal scanner for validating digital-product and dev-tool
ideas, plus a dependency-free MCP (Model Context Protocol) stdio server that
exposes the signals as tools any MCP-compatible agent can call.

> **Transparency notice:** this project is built, tested, and maintained by an
> autonomous AI agent (Hermes, by Nous Research) operating in the Autonomous
> Income Research Lab. A human owner reviews and authorizes external actions.

## Why

Built by the Autonomous Income Research Lab (2026-08-17) as its first product
prototype: demand validation for niche dev tools is itself a recurring need for
indie builders, and MCP integrations are a fast-growing ecosystem
(evidence: `research/2026-08-17-opportunity-scan.md`).

## Signals (all free, no-auth, ToS-friendly APIs)

| Tool                 | Source                       | Proxy for                            |
|----------------------|------------------------------|--------------------------------------|
| `github_repo_signal` | api.github.com/search        | developer interest / competition     |
| `github_trend`       | api.github.com (created:)    | supply/interest acceleration (delta) |
| `hn_signal`          | hn.algolia.com (Hacker News) | tech-audience attention              |
| `hn_trend`           | hn.algolia.com               | attention acceleration (delta)       |
| `npm_downloads`      | api.npmjs.org                | comparable-product demand            |
| `pypi_downloads`     | pypistats.org                | comparable-product demand            |

Absolute download counts include CI/mirror traffic — use directionally, not as
exact market sizes. Trend tools return `growth_ratio` (current window ÷ prior
window); >1 means accelerating.

## Reliability (v0.2)

- **Cache:** file-based TTL cache (`DEMANDSCOPE_CACHE_DIR`, default
  `.cache/demandscope`). TTLs: GitHub/HN 1h, npm/PyPI 24h. Repeat calls are
  free and instant.
- **Backoff:** exponential retry (max 4) on HTTP 429/5xx, honoring
  `Retry-After`. pypistats is treated as best-effort.

## Usage

CLI-style (batch scan):
```bash
python3 ../demand-scanner/demand_scanner.py candidates.json out/
```

As an MCP server (newline-delimited JSON-RPC 2.0 over stdio):
```bash
python3 mcp_server.py
```
MCP client config example:
```json
{"mcpServers": {"demandscope": {"command": "python3", "args": ["/path/to/mcp_server.py"]}}}
```

## MCP Registry / MCPB bundle

DemandScope is published to the official MCP Registry as
`io.github.baobabcat/demandscope`. Each release attaches a deterministic,
one-click-installable MCP Bundle (`demandscope.mcpb`, spec 0.3) built by
`scripts/build_mcpb.py`; publishing runs from CI via GitHub OIDC
(`.github/workflows/publish-mcp.yml`, no stored secrets). The registry
manifest (`server.json`) is validated with
[`mcp-registry-lint`](https://github.com/baobabcat/mcp-registry-lint) and
`mcp-publisher validate` before every publish.

## Tests

```bash
python3 test_mcp_server.py
```
10 end-to-end protocol tests (handshake, notifications, ping, tools/list,
tools/call incl. trend + cache-hit assertion, error paths). Network needed for
the `npm_downloads` and `hn_trend` call tests.

## Status / roadmap

- **v0.3 (2026-08-20):** MCPB bundle + official MCP Registry publishing via
  GitHub OIDC (`server.json`, deterministic `scripts/build_mcpb.py`,
  tag-triggered publish workflow with rollback). 10/10 tests pass.
- v0.2 (2026-08-17): trend-delta tools (`github_trend`, `hn_trend`), TTL
  cache + rate-limit backoff, `pyproject.toml` packaging, MIT license.
  10/10 tests pass.
- v0.1 (2026-08-17): protocol subset `initialize`, `ping`, `tools/list`,
  `tools/call`; 4 signal tools.
- Next: `resources` support, hosted HTTP transport, second asset
  (`mcp-registry-lint`) in the lab pipeline.
