bca-mcp 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bca_mcp-0.2.3/.gitignore +54 -0
- bca_mcp-0.2.3/CHANGELOG.md +41 -0
- bca_mcp-0.2.3/HANDOFF.md +76 -0
- bca_mcp-0.2.3/LICENSE +21 -0
- bca_mcp-0.2.3/PKG-INFO +236 -0
- bca_mcp-0.2.3/PORT_MANIFEST.md +146 -0
- bca_mcp-0.2.3/README.md +201 -0
- bca_mcp-0.2.3/docs/langchain_submission.md +228 -0
- bca_mcp-0.2.3/examples/claude_desktop.json +11 -0
- bca_mcp-0.2.3/examples/eliza_plugin.md +92 -0
- bca_mcp-0.2.3/examples/generic_agent.py +77 -0
- bca_mcp-0.2.3/examples/langchain_agent.py +68 -0
- bca_mcp-0.2.3/pyproject.toml +57 -0
- bca_mcp-0.2.3/requirements.lock.txt +82 -0
- bca_mcp-0.2.3/src/bca_mcp/__init__.py +30 -0
- bca_mcp-0.2.3/src/bca_mcp/__main__.py +23 -0
- bca_mcp-0.2.3/src/bca_mcp/cli/__init__.py +11 -0
- bca_mcp-0.2.3/src/bca_mcp/cli/config.py +61 -0
- bca_mcp-0.2.3/src/bca_mcp/cli/main.py +411 -0
- bca_mcp-0.2.3/src/bca_mcp/cli/render.py +117 -0
- bca_mcp-0.2.3/src/bca_mcp/cli/runner.py +52 -0
- bca_mcp-0.2.3/src/bca_mcp/client.py +234 -0
- bca_mcp-0.2.3/src/bca_mcp/errors.py +75 -0
- bca_mcp-0.2.3/src/bca_mcp/server.py +424 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/__init__.py +44 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/agent_jobs.py +357 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/content.py +168 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/extended.py +1237 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/fundamentals.py +218 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/get_entity.py +62 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/get_explainer.py +59 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/indicators.py +234 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/market.py +171 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/onchain.py +169 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/search_news.py +86 -0
- bca_mcp-0.2.3/src/bca_mcp/tools/sentiment.py +192 -0
- bca_mcp-0.2.3/src/bca_mcp/types.py +138 -0
- bca_mcp-0.2.3/tests/test_agent_jobs.py +253 -0
- bca_mcp-0.2.3/tests/test_cli.py +101 -0
- bca_mcp-0.2.3/tests/test_client_security.py +135 -0
- bca_mcp-0.2.3/tests/test_fundamentals.py +92 -0
- bca_mcp-0.2.3/tests/test_indicators.py +230 -0
- bca_mcp-0.2.3/tests/test_market.py +88 -0
- bca_mcp-0.2.3/tests/test_onchain.py +128 -0
- bca_mcp-0.2.3/tests/test_sentiment.py +165 -0
- bca_mcp-0.2.3/tests/test_smoke.py +404 -0
bca_mcp-0.2.3/.gitignore
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
share/python-wheels/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
.installed.cfg
|
|
22
|
+
*.egg
|
|
23
|
+
MANIFEST
|
|
24
|
+
|
|
25
|
+
# Virtual envs
|
|
26
|
+
.venv/
|
|
27
|
+
venv/
|
|
28
|
+
ENV/
|
|
29
|
+
env/
|
|
30
|
+
|
|
31
|
+
# Test / coverage
|
|
32
|
+
.pytest_cache/
|
|
33
|
+
.coverage
|
|
34
|
+
.coverage.*
|
|
35
|
+
htmlcov/
|
|
36
|
+
.tox/
|
|
37
|
+
.nox/
|
|
38
|
+
coverage.xml
|
|
39
|
+
*.cover
|
|
40
|
+
|
|
41
|
+
# IDE
|
|
42
|
+
.vscode/
|
|
43
|
+
.idea/
|
|
44
|
+
*.swp
|
|
45
|
+
*.swo
|
|
46
|
+
.DS_Store
|
|
47
|
+
|
|
48
|
+
# Env
|
|
49
|
+
.env
|
|
50
|
+
.env.local
|
|
51
|
+
.env.*.local
|
|
52
|
+
|
|
53
|
+
# Build artifacts
|
|
54
|
+
*.whl
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `bca-mcp` are documented here.
|
|
4
|
+
|
|
5
|
+
This project follows [Semantic Versioning](https://semver.org/) and [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
|
|
7
|
+
## [0.2.0] — 2026-04-21
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **`bca` CLI** bundled with the package — a Typer + Rich terminal UI over the same REST API the MCP server wraps. Registered as a console script (`pip install bca-mcp` gives you both `bca-mcp` and `bca`).
|
|
11
|
+
- `bca login` — stores API key in `~/.bca/config.toml` (chmod 600).
|
|
12
|
+
- `bca config show` — inspect config file location + masked key.
|
|
13
|
+
- `bca news search <query>` — rich table of articles with `cite_url`.
|
|
14
|
+
- `bca entity <slug>` — entity dossier panel.
|
|
15
|
+
- `bca price <tickers>` — spot + 24h change table.
|
|
16
|
+
- `bca market overview` — top-N by market cap.
|
|
17
|
+
- `bca indicator <name> <entity> --window {7d,30d,90d}` — proprietary indicator reads.
|
|
18
|
+
- `bca explainer <slug>` — academy lesson rendered as markdown.
|
|
19
|
+
- `bca agent <skill>` — kicks off async agent-backed jobs and polls to completion.
|
|
20
|
+
- `bca version` — shows CLI + live API version.
|
|
21
|
+
- Every command accepts `--json` for pipe-friendly output.
|
|
22
|
+
- `BCA_API_BASE` is now the primary base-URL env var; `BCA_API_BASE_URL` is accepted as a legacy alias (matches the TypeScript sibling + `server.json` contract).
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- User-Agent bumped to `bca-mcp/0.2.0`.
|
|
26
|
+
|
|
27
|
+
## [0.1.0] — 2026-04-21
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Initial Python release with stdio transport — v0.1 scaffold, **8 read-only tools** (minimum viable parity with `@blockchainacademics/mcp` TS v0.1).
|
|
31
|
+
- **Content & corpus (6):** `search_news`, `get_article`, `get_entity`, `list_entity_mentions`, `list_topics`, `get_explainer`.
|
|
32
|
+
- **Market (2):** `get_price`, `get_market_overview`.
|
|
33
|
+
- Typed async HTTPS client (`httpx.AsyncClient`) with `BCA_API_KEY` header injection, 20s default timeout, and both `request()` (GET) and `post()` methods.
|
|
34
|
+
- Fail-fast at server construction if `BCA_API_KEY` is not set — misconfigured MCP hosts surface the error at startup, not on first tool call.
|
|
35
|
+
- Envelope passthrough for `status=integration_pending` / `status=upstream_error` bodies (pass as successful tool responses; MCP client decides how to surface).
|
|
36
|
+
- Structured error taxonomy (`BCA_AUTH`, `BCA_RATE_LIMIT`, `BCA_UPSTREAM`, `BCA_NETWORK`, `BCA_BAD_REQUEST`) mirroring the TypeScript sibling.
|
|
37
|
+
- Attribution surfacing (`cite_url`, `as_of`, `source_hash`) on every tool response; `null` preserved when upstream omits.
|
|
38
|
+
- Smoke test suite using `pytest` + `pytest-httpx` — schema + transport validation with no live API calls.
|
|
39
|
+
- LangChain integration via `langchain-mcp-adapters` in `examples/langchain_agent.py`.
|
|
40
|
+
- Eliza integration notes in `examples/eliza_plugin.md`.
|
|
41
|
+
- Sibling of the TypeScript `@blockchainacademics/mcp` package. v0.2 will expand the tool surface toward the 99-tool TS parity target.
|
bca_mcp-0.2.3/HANDOFF.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# bca-mcp-python — Handoff
|
|
2
|
+
|
|
3
|
+
**Status (2026-04-21):** 0.1.0 built, tested, committed locally. Ready to push to GitHub + publish to PyPI.
|
|
4
|
+
|
|
5
|
+
## What exists
|
|
6
|
+
|
|
7
|
+
- `src/bca_mcp/` — 8-tool MVP for LangChain / generic-Python-agent parity with `@blockchainacademics/mcp@0.2.2`
|
|
8
|
+
- Tools: `search_news`, `get_article`, `get_entity`, `list_entity_mentions`, `list_topics`, `get_explainer`, `get_price`, `get_market_overview`
|
|
9
|
+
- Envelope-aware client at `client.py` (parses `{data, cite_url, as_of, source_hash}` and returns the unwrapped payload with attribution fields passed through)
|
|
10
|
+
- stdio transport only (HTTP/SSE is v0.2+)
|
|
11
|
+
- `tests/` — 23 tests, all green (`pytest`)
|
|
12
|
+
- `dist/bca_mcp-0.1.0{.tar.gz,-py3-none-any.whl}` — built, `twine check` PASSED
|
|
13
|
+
- Git: initialized on `main`, first commit landed (no remote yet)
|
|
14
|
+
|
|
15
|
+
## Publish steps (Wael)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd ~/bca-mcp-python
|
|
19
|
+
|
|
20
|
+
# 1. Create GitHub repo + push
|
|
21
|
+
gh repo create blockchainacademics/bca-mcp-python --public --source=. --remote=origin --push
|
|
22
|
+
|
|
23
|
+
# 2. Create PyPI API token at https://pypi.org/manage/account/token/
|
|
24
|
+
# Scope: project-specific once uploaded; first upload needs account-wide token
|
|
25
|
+
# Save as: ~/.pypirc OR export TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-...
|
|
26
|
+
|
|
27
|
+
# 3. Upload
|
|
28
|
+
source .venv/bin/activate
|
|
29
|
+
twine upload dist/*
|
|
30
|
+
|
|
31
|
+
# 4. Tag release
|
|
32
|
+
git tag v0.1.0
|
|
33
|
+
git push origin v0.1.0
|
|
34
|
+
gh release create v0.1.0 --title "0.1.0 — 8-tool MVP" --notes-file CHANGELOG.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Smoke test post-publish
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pipx run bca-mcp --help # should print stdio banner
|
|
41
|
+
# OR in a LangChain agent:
|
|
42
|
+
pip install bca-mcp
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Config snippet for Claude Desktop (for parity testing vs TS package):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"bca": {
|
|
51
|
+
"command": "pipx",
|
|
52
|
+
"args": ["run", "bca-mcp"],
|
|
53
|
+
"env": {"BCA_API_KEY": "bca_live_..."}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Parity status vs TypeScript package
|
|
60
|
+
|
|
61
|
+
8/99 tools shipped. The Python package is the **LangChain / Eliza-Python entry point**, not a mirror of the full TS surface. v0.2 will expand once the TS v0.2.0 is listed in the Anthropic directory and we know which tools agents actually call.
|
|
62
|
+
|
|
63
|
+
## Known gaps (v0.2 targets)
|
|
64
|
+
|
|
65
|
+
- HTTP/SSE transport for hosted MCP (Virtuals, Bedrock)
|
|
66
|
+
- Remaining 91 tools (market data deep cuts, on-chain, indicators, agent-backed jobs)
|
|
67
|
+
- Example notebook (`examples/langchain_agent.ipynb`) — scaffold exists, needs a live run + output commit
|
|
68
|
+
|
|
69
|
+
## Local dev
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cd ~/bca-mcp-python
|
|
73
|
+
source .venv/bin/activate # Python 3.14.4
|
|
74
|
+
pytest # 23 tests, <1s
|
|
75
|
+
python -m bca_mcp # runs stdio server against localhost:8000 unless BCA_API_BASE set
|
|
76
|
+
```
|
bca_mcp-0.2.3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Blockchain Academics
|
|
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.
|
bca_mcp-0.2.3/PKG-INFO
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bca-mcp
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Blockchain Academics MCP server + `bca` CLI — crypto news, entity dossiers, market data, proprietary indicators, and academy explainers for AI agents
|
|
5
|
+
Project-URL: Homepage, https://blockchainacademics.com
|
|
6
|
+
Project-URL: Repository, https://github.com/blockchainacademics/bca-mcp-python
|
|
7
|
+
Project-URL: Issues, https://github.com/blockchainacademics/bca-mcp-python/issues
|
|
8
|
+
Author-email: Blockchain Academics <dev@blockchainacademics.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,ai,blockchain,crypto,llm,mcp,news
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: httpx>=0.27.0
|
|
22
|
+
Requires-Dist: mcp>=1.0.0
|
|
23
|
+
Requires-Dist: pydantic>=2.7.0
|
|
24
|
+
Requires-Dist: rich>=13.7
|
|
25
|
+
Requires-Dist: tomli-w>=1.0
|
|
26
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
27
|
+
Requires-Dist: typer>=0.12
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-httpx>=0.30; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# bca-mcp
|
|
37
|
+
|
|
38
|
+
The canonical crypto MCP server for AI agents — **Python edition**. 3,500+ editorial articles, 200+ entity dossiers, 43 academy lessons, and live market data — accessible as MCP tools your agent can call natively.
|
|
39
|
+
|
|
40
|
+
Sibling of [`@blockchainacademics/mcp`](https://www.npmjs.com/package/@blockchainacademics/mcp) (TypeScript). Same REST API. Same attribution contract. Use whichever fits your stack.
|
|
41
|
+
|
|
42
|
+
**v0.2.0 ships 8 read-only MCP tools + the `bca` CLI** — the most-used corpus + market endpoints, plus a terminal-first way to explore them. Later versions expand toward parity with the TS sibling (99 tools). Starting narrow on the MCP surface is deliberate: tight tools, sharp descriptions, low-risk publish.
|
|
43
|
+
|
|
44
|
+
## Why
|
|
45
|
+
|
|
46
|
+
LLMs hallucinate about crypto. BCA ships ground-truth editorial content with full attribution. Plug this MCP server into Claude Desktop, LangChain, LlamaIndex, Eliza, or any MCP-compatible agent and your model queries the BCA corpus like any other tool — with `cite_url`, `as_of`, and `source_hash` on every response.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install bca-mcp
|
|
52
|
+
# or, isolated:
|
|
53
|
+
pipx install bca-mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Configure
|
|
57
|
+
|
|
58
|
+
Get an API key at **https://brain.blockchainacademics.com/pricing** (free tier: 1,000 calls/month; paid tiers unlock expanded rate limits and — in later versions — agent-backed research generation).
|
|
59
|
+
|
|
60
|
+
Set the env var before launching the server:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
export BCA_API_KEY="bca_live_xxxxxxxxxxxxxxxx"
|
|
64
|
+
# optional: override the default https://api.blockchainacademics.com
|
|
65
|
+
export BCA_API_BASE="https://api.blockchainacademics.com"
|
|
66
|
+
# BCA_API_BASE_URL is also accepted as a legacy alias
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
> The server **fails fast at startup** if `BCA_API_KEY` is missing. Misconfigured hosts surface the problem immediately instead of on the first tool call.
|
|
70
|
+
|
|
71
|
+
## Use from Claude Desktop
|
|
72
|
+
|
|
73
|
+
Add to `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"blockchainacademics": {
|
|
79
|
+
"command": "python",
|
|
80
|
+
"args": ["-m", "bca_mcp"],
|
|
81
|
+
"env": { "BCA_API_KEY": "bca_live_xxxxxxxxxxxxxxxx" }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Restart Claude Desktop — the 8 tools appear in the tool picker. If you installed via `pipx`, you can swap `"command": "bca-mcp"` with empty `args` (a console-script entry point is registered by the package).
|
|
88
|
+
|
|
89
|
+
## Use from LangChain
|
|
90
|
+
|
|
91
|
+
Ten lines via [`langchain-mcp-adapters`](https://github.com/langchain-ai/langchain-mcp-adapters):
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import asyncio, os, sys
|
|
95
|
+
from mcp import ClientSession, StdioServerParameters
|
|
96
|
+
from mcp.client.stdio import stdio_client
|
|
97
|
+
from langchain_mcp_adapters.tools import load_mcp_tools
|
|
98
|
+
|
|
99
|
+
async def main():
|
|
100
|
+
params = StdioServerParameters(
|
|
101
|
+
command=sys.executable, args=["-m", "bca_mcp"],
|
|
102
|
+
env={**os.environ, "BCA_API_KEY": os.environ["BCA_API_KEY"]},
|
|
103
|
+
)
|
|
104
|
+
async with stdio_client(params) as (r, w), ClientSession(r, w) as s:
|
|
105
|
+
await s.initialize()
|
|
106
|
+
tools = await load_mcp_tools(s) # -> list[StructuredTool]
|
|
107
|
+
print(await tools[0].ainvoke({"query": "stablecoin regulation"}))
|
|
108
|
+
|
|
109
|
+
asyncio.run(main())
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Full worked example in [`examples/langchain_agent.py`](./examples/langchain_agent.py). Raw MCP client loop (no LangChain) in [`examples/generic_agent.py`](./examples/generic_agent.py).
|
|
113
|
+
|
|
114
|
+
## Use from Eliza
|
|
115
|
+
|
|
116
|
+
See [`examples/eliza_plugin.md`](./examples/eliza_plugin.md) for integration notes — `bca-mcp` plugs into Eliza's MCP plugin surface as a stdio-transport server.
|
|
117
|
+
|
|
118
|
+
## The `bca` CLI
|
|
119
|
+
|
|
120
|
+
`pip install bca-mcp` also registers a terminal-first CLI. It talks to the same REST API as the MCP server — handy for debugging, quick lookups, and shell pipelines.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bca login # store API key in ~/.bca/config.toml (chmod 600)
|
|
124
|
+
bca news search "bitcoin etf" -n 5 # recent articles, rich table + cite_url
|
|
125
|
+
bca entity ethereum # dossier panel
|
|
126
|
+
bca price BTC,ETH,SOL # spot + 24h change table
|
|
127
|
+
bca market overview -n 10 # top-N by market cap
|
|
128
|
+
bca indicator coverage-index bitcoin -w 30d
|
|
129
|
+
bca explainer what-is-a-blockchain # rendered markdown
|
|
130
|
+
bca agent summarize-whitepaper --url https://ethereum.org/…
|
|
131
|
+
bca version # CLI + live API version
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Every command accepts `--json` for unformatted output suitable for `jq` pipelines. Env vars (`BCA_API_KEY`, `BCA_API_BASE`) take precedence over `~/.bca/config.toml`.
|
|
135
|
+
|
|
136
|
+
## Tool catalog (v0.1.0 — 8 tools)
|
|
137
|
+
|
|
138
|
+
| Tool | Category | Endpoint | Tier |
|
|
139
|
+
|---|---|---|---|
|
|
140
|
+
| `search_news` | content | `GET /v1/articles/search` | Starter |
|
|
141
|
+
| `get_article` | content | `GET /v1/articles/{slug}` | Starter |
|
|
142
|
+
| `get_entity` | content | `GET /v1/entities/{slug}` | Starter |
|
|
143
|
+
| `list_entity_mentions` | content | `GET /v1/entities/{slug}/mentions` | Starter |
|
|
144
|
+
| `list_topics` | content | `GET /v1/topics` | Starter |
|
|
145
|
+
| `get_explainer` | content | `GET /v1/academy/{slug}` | Starter |
|
|
146
|
+
| `get_price` | market | `GET /v1/market/price` | Starter |
|
|
147
|
+
| `get_market_overview` | market | `GET /v1/market/overview` | Starter |
|
|
148
|
+
|
|
149
|
+
All v0.1 tools are **free tier** — no paid plan required to call them.
|
|
150
|
+
|
|
151
|
+
### Tool details
|
|
152
|
+
|
|
153
|
+
#### `search_news`
|
|
154
|
+
Required: `query` (1–512 chars). Optional: `entity`, `since` (ISO 8601), `topic`, `limit` (1–50, default 10).
|
|
155
|
+
|
|
156
|
+
#### `get_article`
|
|
157
|
+
Required: `slug` (1–240 chars).
|
|
158
|
+
|
|
159
|
+
#### `get_entity`
|
|
160
|
+
Required: **exactly one** of `slug` (e.g. `"vitalik-buterin"`) or `ticker` (e.g. `"ETH"`, case-insensitive). Aliases resolve automatically (`CZ` → `changpeng-zhao`, `Maker` → `makerdao`, `BSC` → `bnb-chain`, …).
|
|
161
|
+
|
|
162
|
+
#### `list_entity_mentions`
|
|
163
|
+
Required: `slug` (entity). Optional: `since` (ISO 8601), `limit` (1–200, default 20).
|
|
164
|
+
|
|
165
|
+
#### `list_topics`
|
|
166
|
+
No arguments.
|
|
167
|
+
|
|
168
|
+
#### `get_explainer`
|
|
169
|
+
Required: **exactly one** of `slug` (e.g. `"what-is-a-blockchain"`) or `topic` (keyword).
|
|
170
|
+
|
|
171
|
+
#### `get_price`
|
|
172
|
+
Required: `ids` (comma-separated CoinGecko IDs, e.g. `"bitcoin,ethereum"` — NOT exchange tickers). Optional: `vs` (quote currency, default `usd`).
|
|
173
|
+
|
|
174
|
+
#### `get_market_overview`
|
|
175
|
+
Optional: `limit` (1–100, default 20).
|
|
176
|
+
|
|
177
|
+
## Attribution contract
|
|
178
|
+
|
|
179
|
+
Every response includes a structured `attribution` block:
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"data": { ... },
|
|
184
|
+
"attribution": {
|
|
185
|
+
"cite_url": "https://blockchainacademics.com/...",
|
|
186
|
+
"as_of": "2026-04-19T12:34:56Z",
|
|
187
|
+
"source_hash": "sha256:..."
|
|
188
|
+
},
|
|
189
|
+
"meta": null
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**When your agent surfaces BCA content to a user, you MUST link `cite_url`.** This is the core trade: BCA gives agents ground-truth citations; agents give BCA distribution. `as_of` and `source_hash` let downstream systems detect staleness and verify content integrity. Fields are preserved as `null` (not dropped) when upstream omits them, so agents can detect missing provenance explicitly.
|
|
194
|
+
|
|
195
|
+
## Degraded-state envelopes
|
|
196
|
+
|
|
197
|
+
The BCA API sometimes returns `status=integration_pending` or `status=upstream_error` envelopes (200 HTTP) when a specific data source is temporarily unavailable. **The MCP server passes these through as successful tool responses** — your agent sees the envelope and decides how to surface it. This matches the TS sibling's behavior.
|
|
198
|
+
|
|
199
|
+
## Errors
|
|
200
|
+
|
|
201
|
+
The server never crashes the stdio process. All failures surface as MCP responses with `isError: true` and a JSON body:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{ "error": { "code": "BCA_AUTH", "message": "..." } }
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
| Code | Meaning |
|
|
208
|
+
|---|---|
|
|
209
|
+
| `BCA_AUTH` | Missing/invalid `BCA_API_KEY` (HTTP 401/403) |
|
|
210
|
+
| `BCA_RATE_LIMIT` | Rate limit exceeded (HTTP 429 — honor `Retry-After`) |
|
|
211
|
+
| `BCA_UPSTREAM` | BCA API returned 5xx or malformed JSON |
|
|
212
|
+
| `BCA_NETWORK` | Network failure or 20s timeout exceeded |
|
|
213
|
+
| `BCA_BAD_REQUEST` | Invalid tool arguments or 4xx response |
|
|
214
|
+
|
|
215
|
+
## Development
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
python -m venv .venv
|
|
219
|
+
source .venv/bin/activate
|
|
220
|
+
pip install -e '.[dev]'
|
|
221
|
+
pytest -q
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Run the server directly for debugging:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
BCA_API_KEY=... python -m bca_mcp
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Contributing
|
|
231
|
+
|
|
232
|
+
Issues, PRs, and feature requests: https://github.com/blockchainacademics/bca-mcp-python
|
|
233
|
+
|
|
234
|
+
## License
|
|
235
|
+
|
|
236
|
+
MIT © 2026 Blockchain Academics
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# BCA MCP Python Port Manifest — Task #122
|
|
2
|
+
|
|
3
|
+
**Generated:** 2026-04-21
|
|
4
|
+
**Status:** Port planning document (READ-ONLY exploration — no code changes)
|
|
5
|
+
**Source of truth:** `~/bca-mcp-ts/src/index.ts` (99 tools registered via `entry()` calls)
|
|
6
|
+
|
|
7
|
+
## Tool count
|
|
8
|
+
|
|
9
|
+
- **TypeScript total:** 99 tools
|
|
10
|
+
- **Python v0.1.0 ported:** 8 tools
|
|
11
|
+
- **Remaining to port:** 91 tools
|
|
12
|
+
|
|
13
|
+
## Already ported (8)
|
|
14
|
+
|
|
15
|
+
| Tool | Python module | TS parity |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `search_news` | `tools/search_news.py` | ✓ |
|
|
18
|
+
| `get_article` | `tools/content.py` | ✓ |
|
|
19
|
+
| `get_entity` | `tools/get_entity.py` | ✓ |
|
|
20
|
+
| `list_entity_mentions` | `tools/content.py` | ✓ |
|
|
21
|
+
| `list_topics` | `tools/content.py` | ✓ |
|
|
22
|
+
| `get_explainer` | `tools/get_explainer.py` | ✓ |
|
|
23
|
+
| `get_price` | `tools/market.py` | ✓ |
|
|
24
|
+
| `get_market_overview` | `tools/market.py` | ✓ |
|
|
25
|
+
|
|
26
|
+
No schema drift vs. TS.
|
|
27
|
+
|
|
28
|
+
## Category breakdown (unported)
|
|
29
|
+
|
|
30
|
+
| Category | TS count | Ported | Delta |
|
|
31
|
+
|---|---|---|---|
|
|
32
|
+
| News & Entities | 3 | 3 | 0 |
|
|
33
|
+
| Content & Corpus | 4 | 4 | 0 |
|
|
34
|
+
| Market Data | 4 | 2 | **2** |
|
|
35
|
+
| On-Chain | 4 | 0 | **4** |
|
|
36
|
+
| Sentiment | 3 | 0 | **3** |
|
|
37
|
+
| Indicators | 6 | 0 | **6** |
|
|
38
|
+
| Agent Jobs | 6 | 0 | **6** |
|
|
39
|
+
| Directories | 13 | 0 | **13** |
|
|
40
|
+
| Fundamentals | 6 | 0 | **6** |
|
|
41
|
+
| Chain-Specific | 4 | 0 | **4** |
|
|
42
|
+
| Compute/AI | 2 | 0 | **2** |
|
|
43
|
+
| Memes | 4 | 0 | **4** |
|
|
44
|
+
| Microstructure | 5 | 0 | **5** |
|
|
45
|
+
| Narrative | 5 | 0 | **5** |
|
|
46
|
+
| Regulatory | 4 | 0 | **4** |
|
|
47
|
+
| Security | 4 | 0 | **4** |
|
|
48
|
+
| Services (POST) | 3 | 0 | **3** |
|
|
49
|
+
| History/Time-Series | 4 | 0 | **4** |
|
|
50
|
+
| Corpus Meta | 7 | 0 | **7** |
|
|
51
|
+
| Memos/Theses | 4 | 0 | **4** |
|
|
52
|
+
| Social Signals | 2 | 0 | **2** |
|
|
53
|
+
| Currencies | 2 | 0 | **2** |
|
|
54
|
+
| **Total** | **99** | **8** | **91** |
|
|
55
|
+
|
|
56
|
+
## Unported tools by category
|
|
57
|
+
|
|
58
|
+
**Market (2):** `get_ohlc`, `get_pair_data`
|
|
59
|
+
|
|
60
|
+
**On-Chain (4):** `get_wallet_profile`, `get_tx`, `get_token_holders`, `get_defi_protocol`
|
|
61
|
+
|
|
62
|
+
**Sentiment (3):** `get_sentiment`, `get_social_pulse` (⚠ integration_pending), `get_fear_greed`
|
|
63
|
+
|
|
64
|
+
**Indicators (6 — all share `entity_slug` + `window` pattern):** `get_coverage_index`, `get_narrative_strength`, `get_sentiment_velocity`, `get_editorial_premium`, `get_kol_influence`, `get_risk_score`
|
|
65
|
+
|
|
66
|
+
**Agent Jobs (6 — async POST + polling):** `generate_due_diligence`, `generate_tokenomics_model`, `summarize_whitepaper`, `translate_contract`, `monitor_keyword`, `get_agent_job`
|
|
67
|
+
|
|
68
|
+
**Directories (13):** `list_stablecoins`, `list_nft_communities`, `list_yields`, `list_aggregators`, `list_mcps`, `list_trading_bots`, `list_vcs`, `list_jobs`, `list_smart_contract_templates`, `get_smart_contract_template`, `list_marketing_templates`, `get_marketing_template`, `build_custom_indicator`
|
|
69
|
+
|
|
70
|
+
**Fundamentals (6):** `get_tokenomics`, `get_audit_reports`, `get_team_info`, `get_roadmap`, `compare_protocols`, `check_rugpull_risk`
|
|
71
|
+
|
|
72
|
+
**Chain-Specific (4):** `get_solana_ecosystem`, `get_l2_comparison`, `get_bitcoin_l2_status`, `get_ton_ecosystem`
|
|
73
|
+
|
|
74
|
+
**Compute/AI (2):** `get_compute_pricing`, `get_ai_crypto_metrics`
|
|
75
|
+
|
|
76
|
+
**Memes (4):** `track_pumpfun`, `track_bonkfun`, `check_memecoin_risk`, `get_degen_leaderboard`
|
|
77
|
+
|
|
78
|
+
**Microstructure (5):** `get_funding_rates`, `get_options_flow`, `get_liquidation_heatmap`, `get_exchange_flows`, `predict_listing`
|
|
79
|
+
|
|
80
|
+
**Narrative (5):** `track_narrative`, `get_ai_agent_tokens`, `get_depin_projects`, `get_rwa_tokens`, `get_prediction_markets`
|
|
81
|
+
|
|
82
|
+
**Regulatory (4):** `get_regulatory_status`, `track_sec_filings`, `get_mica_status`, `get_tax_rules`
|
|
83
|
+
|
|
84
|
+
**Security (4):** `check_exploit_history`, `check_phishing_domain`, `get_bug_bounty_programs`, `scan_contract`
|
|
85
|
+
|
|
86
|
+
**Services (3, POST):** `book_kol_campaign`, `request_custom_research`, `submit_listing`
|
|
87
|
+
|
|
88
|
+
**History (4):** `get_history_prices`, `get_history_sentiment`, `get_history_correlation`, `get_history_coverage`
|
|
89
|
+
|
|
90
|
+
**Corpus Meta (7):** `list_entities`, `get_topic`, `search_academy`, `get_trending`, `get_unified_feed`, `list_sources`, `get_recent_stories`
|
|
91
|
+
|
|
92
|
+
**Memos/Theses (4):** `list_memos`, `get_memo`, `list_theses`, `get_thesis`
|
|
93
|
+
|
|
94
|
+
**Social Signals (2):** `get_social_signals`, `get_social_signals_detail`
|
|
95
|
+
|
|
96
|
+
**Currencies (2):** `list_currencies`, `get_currency_feed`
|
|
97
|
+
|
|
98
|
+
## Shared patterns (Python reusable primitives)
|
|
99
|
+
|
|
100
|
+
- **Window enum:** `Literal['1d', '7d', '30d', '90d']` (or subset). Factor into `types.py`.
|
|
101
|
+
- **Entity slug:** `str` validated by regex `^[a-z0-9]+(?:-[a-z0-9]+)*$`. Shared validator.
|
|
102
|
+
- **Chain enum:** 7 tools share same chain list (eth, solana, arbitrum, base, optimism, polygon, bnb). Factor.
|
|
103
|
+
- **Ticker/symbol:** common across sentiment + microstructure + history.
|
|
104
|
+
- **Async job pattern:** agent-jobs return `{job_id, status_url}`; `get_agent_job` polls. Single base class.
|
|
105
|
+
- **Untrusted-content wrapping:** TS wraps third-party content in `<untrusted_content>` tags — mirror in Python.
|
|
106
|
+
|
|
107
|
+
## Batched execution plan
|
|
108
|
+
|
|
109
|
+
| Batch | Tools | LOC est. | Categories | Notes |
|
|
110
|
+
|---|---|---|---|---|
|
|
111
|
+
| 1 | 4 | 150–180 | market, onchain core | Simplest endpoints, high-demand |
|
|
112
|
+
| 2 | 5 | 120–150 | sentiment, social_signals | 1 integration_pending |
|
|
113
|
+
| 3 | 7 | 140–170 | indicators, onchain token_holders | Shared window+slug pattern |
|
|
114
|
+
| 4 | 7 | 160–200 | fundamentals, onchain defi | |
|
|
115
|
+
| 5 | 6 | 180–220 | agent_jobs (async POST + poll) | New pattern class |
|
|
116
|
+
| 6 | 16 | 250–320 | directories, services | Largest batch; all list-shaped |
|
|
117
|
+
| 7 | 15 | 200–250 | narrative, regulatory, security, compute | |
|
|
118
|
+
| 8 | 17 | 180–220 | chain-specific, memes, microstructure, history | |
|
|
119
|
+
| 9 | 13 | 150–180 | corpus_meta, memos_theses, currencies | |
|
|
120
|
+
|
|
121
|
+
**Total:** 9 batches, 91 tools, ~1,630–1,890 LOC + tests.
|
|
122
|
+
|
|
123
|
+
## Recommended Batch 1 targets (start here)
|
|
124
|
+
|
|
125
|
+
1. `get_ohlc` — `GET /v1/market/ohlc` | params: id, days, vs
|
|
126
|
+
2. `get_pair_data` — `GET /v1/market/pair` | params: chain, pair
|
|
127
|
+
3. `get_wallet_profile` — on-chain research foundation
|
|
128
|
+
4. `get_tx` — transaction decoding
|
|
129
|
+
5. `get_token_holders` — concentration risk
|
|
130
|
+
|
|
131
|
+
Unblocks ~30% of downstream use cases; zero cross-batch dependencies.
|
|
132
|
+
|
|
133
|
+
## Integration risks (full audit)
|
|
134
|
+
|
|
135
|
+
- **Only one tool flagged** as `integration_pending`: `get_social_pulse` (Twitter/Reddit OAuth pending). Its Python port is the same shape — backend returns envelope `{data: null, status: "integration_pending"}` unchanged.
|
|
136
|
+
- Schema fidelity across `extended.ts` (31 KB, 812 lines) is consistent — no sketchy zod declarations.
|
|
137
|
+
- No missing implementation details in TS source.
|
|
138
|
+
- `client.py` in Python MCP already supports GET + POST patterns needed.
|
|
139
|
+
|
|
140
|
+
## Open decisions for Wael before executing batches
|
|
141
|
+
|
|
142
|
+
1. **Version gate:** `pyproject.toml` currently reads `0.2.0`. Options: (a) roll back to `0.2.0.dev0` and bump to `0.2.0` only when all 91 land, (b) keep `0.2.0` and ship batches as `0.2.0.post1`, `0.2.0.post2`, etc.
|
|
143
|
+
2. **0.1.0 release artifact:** currently un-pushed, un-tagged. Ship `v0.1.0` to PyPI first so we have an 8-tool baseline in the wild? Or go straight to 0.2.0 with 99 tools?
|
|
144
|
+
3. **CLI flag:** `--list-tools` isn't implemented. Add as part of batch 1, or keep `python -m bca_mcp --list-tools` as the contract?
|
|
145
|
+
|
|
146
|
+
Defaults if no answer: roll to `0.2.0.dev0`, skip 0.1.0 release, add `--list-tools` in batch 1.
|