alloc-context 0.2.2__tar.gz → 0.2.4__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.
- {alloc_context-0.2.2 → alloc_context-0.2.4}/PKG-INFO +29 -18
- {alloc_context-0.2.2 → alloc_context-0.2.4}/README.md +21 -11
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloc_context.egg-info/PKG-INFO +29 -18
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloc_context.egg-info/SOURCES.txt +4 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloc_context.egg-info/requires.txt +1 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/__init__.py +1 -1
- alloc_context-0.2.4/alloccontext/integrations/__init__.py +1 -0
- alloc_context-0.2.4/alloccontext/integrations/langchain.py +125 -0
- alloc_context-0.2.4/alloccontext/mcp/bazaar.py +338 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/bridge.py +22 -8
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/http.py +48 -15
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/server.py +14 -69
- alloc_context-0.2.4/alloccontext/mcp/tool_catalog.py +661 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/x402_config.py +41 -5
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/x402_production_check.py +14 -4
- {alloc_context-0.2.2 → alloc_context-0.2.4}/pyproject.toml +12 -11
- alloc_context-0.2.4/tests/test_check_pypi_release_json.py +55 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_deploy.py +6 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_glama_well_known.py +1 -1
- alloc_context-0.2.4/tests/test_langchain_integration.py +115 -0
- alloc_context-0.2.4/tests/test_mcp_x402.py +290 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_server_json.py +1 -1
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_tool_catalog.py +30 -2
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_workflows.py +16 -2
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_x402_production_check.py +27 -0
- alloc_context-0.2.2/alloccontext/mcp/bazaar.py +0 -644
- alloc_context-0.2.2/alloccontext/mcp/tool_catalog.py +0 -311
- alloc_context-0.2.2/tests/test_mcp_x402.py +0 -139
- {alloc_context-0.2.2 → alloc_context-0.2.4}/LICENSE +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloc_context.egg-info/dependency_links.txt +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloc_context.egg-info/entry_points.txt +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloc_context.egg-info/top_level.txt +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/__main__.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/config.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/constants.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/horizon.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/__init__.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/alt_quote_registry.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/alt_quote_store.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/alt_quotes.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/asset_registry.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/cf_benchmarks.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/cf_history.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/coinbase_client.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/coinbase_portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/coingecko.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/coinmarketcap.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/env_keys.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/etf_flows.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange/__init__.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange/coinbase_adapter.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange/kraken_adapter.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange/live.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange/portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange/registry.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange/types.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/exchange_http.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/fear_greed.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/fred.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/http_errors.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/kalshi.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/kalshi_api.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/kalshi_client.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/kalshi_files.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/kalshi_state.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/kraken_client.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/kraken_portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/macro_calendar.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/macro_normalize.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/market_snapshots.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/outcome.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/parse_helpers.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/portfolio_holdings.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/quote_resolver.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/ingest/runner.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/__init__.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/assets.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/bridge_portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/contracts.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/glama.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/handlers.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/instructions.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/payer.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/payment_middleware.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/setup.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/staleness.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/tool_fields.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/upstream.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/validation.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/x402_bazaar_dynamic.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/x402_pricing.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/mcp/x402_stables.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/__init__.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/allocation_analysis.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/band.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/breadth.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/cf_math.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/cluster.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/cluster_config.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/comparison.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/context.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/delta.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/etf.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/fear_greed.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/macro.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/portfolio_payload.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/rebalance.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/regime.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/sentiment.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/snapshots.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/rollup/tape.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/status_report.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/store/__init__.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/store/db.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/store/jsonutil.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/store/meta.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/store/retention.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/store/status.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/timeutil.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/user_config.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/alloccontext/x402_smoke_redact.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/setup.cfg +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_backup_sqlite.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_bridge.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_bridge_portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_bump_version.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_coinbase_portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_config_cli.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_context_bundle_schema.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_context_snapshots.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_db_schema.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_dev_stack.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_etf.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_exchanges_config.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_fear_greed.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_fred.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_holdings_scoped_delta_regime.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_holdings_scoped_market.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_horizon.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_ingest_outcome.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_ingest_runner.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_ingest_store_integration.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_kalshi_api.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_kraken_portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_live_ingest_handlers.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_macro.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_market_breadth.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_assets_regime.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_bazaar.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_contracts.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_data_staleness.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_handlers.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_health.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_http_lifecycle.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_live_portfolio.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_server.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_validation.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_x402_http.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_x402_pricing.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_mcp_x402_stables.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_payer.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_portfolio_holdings.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_quote_resolver.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_rebalance.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_rollup.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_script_runtime.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_security_hardening.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_setup.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_snapshots_and_delta.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_status_report.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_user_config.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_x402_bazaar_dynamic.py +0 -0
- {alloc_context-0.2.2 → alloc_context-0.2.4}/tests/test_x402_smoke_redact.py +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alloc-context
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: Portfolio-aware crypto context for agents — holdings
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: Portfolio-aware crypto context for agents — holdings-scoped market, sentiment, optional allocation analysis
|
|
5
5
|
License: Elastic-2.0
|
|
6
6
|
Project-URL: Homepage, https://mcp.alloc-context.com/llms.txt
|
|
7
|
-
Project-URL: Documentation, https://github.com/
|
|
8
|
-
Project-URL: Repository, https://github.com/
|
|
9
|
-
Project-URL: Issues, https://github.com/
|
|
10
|
-
Project-URL: Changelog, https://github.com/
|
|
7
|
+
Project-URL: Documentation, https://github.com/AllocContext/alloc-context/blob/main/docs/agent-integration.md
|
|
8
|
+
Project-URL: Repository, https://github.com/AllocContext/alloc-context
|
|
9
|
+
Project-URL: Issues, https://github.com/AllocContext/alloc-context/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/AllocContext/alloc-context/releases
|
|
11
11
|
Project-URL: MCP Server, https://mcp.alloc-context.com/mcp
|
|
12
|
-
Keywords: mcp,x402,
|
|
12
|
+
Keywords: mcp,x402,holdings,portfolio,crypto,cryptocurrency,bitcoin,ethereum,agents,allocation,rebalance,coinbase,kraken
|
|
13
13
|
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -40,18 +40,23 @@ Requires-Dist: mcp>=1.6; extra == "dev"
|
|
|
40
40
|
Requires-Dist: x402[evm,fastapi]>=2.0; extra == "dev"
|
|
41
41
|
Requires-Dist: cdp-sdk>=1.46; extra == "dev"
|
|
42
42
|
Requires-Dist: uvicorn[standard]>=0.30; extra == "dev"
|
|
43
|
+
Requires-Dist: langchain-core>=0.3.0; extra == "dev"
|
|
43
44
|
Dynamic: license-file
|
|
44
45
|
|
|
45
46
|
# AllocContext
|
|
46
47
|
|
|
47
|
-
[](https://glama.ai/mcp/servers/negillett/alloc-context)
|
|
48
|
+
[](https://smithery.ai/servers/alloccontext/alloc-context)
|
|
49
49
|
|
|
50
|
-
mcp-name: io.github.
|
|
50
|
+
mcp-name: io.github.AllocContext/alloc-context
|
|
51
51
|
|
|
52
|
-
**Portfolio-aware crypto context for
|
|
53
|
-
sentiment, macro, and regime; optional
|
|
54
|
-
JSON over MCP with
|
|
52
|
+
**Portfolio-aware crypto context for whatever you hold** — discover your
|
|
53
|
+
holdings, holdings-scoped market data, sentiment, macro, and regime; optional
|
|
54
|
+
allocation analysis when you supply targets. Deterministic JSON over MCP with
|
|
55
|
+
x402 pay-per-call on Base.
|
|
56
|
+
|
|
57
|
+
**New here?** [Agent on-ramp (~2 min)](docs/agent-onramp.md) — copy-paste path to
|
|
58
|
+
your first ContextBundle. **Organization:**
|
|
59
|
+
[AllocContext on GitHub](https://github.com/AllocContext) — overview and integration links.
|
|
55
60
|
|
|
56
61
|
> **Privacy:** nothing stored · one-time read-only · pass-through only — your
|
|
57
62
|
> keys and portfolio never persist on our servers. See [USE.md](docs/USE.md).
|
|
@@ -113,7 +118,7 @@ Not financial advice.
|
|
|
113
118
|
| **Discovery** | [llms.txt](https://mcp.alloc-context.com/llms.txt), [x402 manifest](https://mcp.alloc-context.com/.well-known/x402.json) |
|
|
114
119
|
| **Pricing** | **$0.02** cached context/math · **$0.05** live ingest or portfolio |
|
|
115
120
|
| **Payment** | x402 on Base — USDC or EURC |
|
|
116
|
-
| **Market scope** |
|
|
121
|
+
| **Market scope** | Tailored to your holdings (band OHLC for BTC/ETH; alt quote snapshots); bridge auto-scopes from portfolio |
|
|
117
122
|
|
|
118
123
|
Agents and wallets connect directly to the hosted endpoint — see
|
|
119
124
|
[agent-integration.md](docs/agent-integration.md). The Cursor bridge above
|
|
@@ -130,7 +135,7 @@ combines local portfolio reads with this upstream for market context.
|
|
|
130
135
|
| `get_rebalance_plan` | USD rebalance moves from allocation, target, and NAV |
|
|
131
136
|
| `check_allocation_band` | Drift vs target and whether allocation is outside the band |
|
|
132
137
|
| `check_allocation_bands` | Batch band checks for multiple target scenarios |
|
|
133
|
-
| `get_portfolio_state` | Live NAV and holdings
|
|
138
|
+
| `get_portfolio_state` | Live NAV and holdings (e.g. Coinbase, Kraken read-only keys) |
|
|
134
139
|
|
|
135
140
|
Market context is **holdings-scoped**: band assets (BTC/ETH) use OHLC bars; alt
|
|
136
141
|
holdings (e.g. HYPE) use quote snapshots when cached. The bridge auto-scopes
|
|
@@ -142,11 +147,13 @@ See [mcp.md](docs/mcp.md) for arguments, pricing, and resources.
|
|
|
142
147
|
## Self-host and development
|
|
143
148
|
|
|
144
149
|
Run ingest and MCP entirely on your machine — no x402 upstream required.
|
|
145
|
-
See [self-hosting.md](docs/self-hosting.md) (`self_host: true` in user config)
|
|
146
|
-
|
|
150
|
+
See [self-hosting.md](docs/self-hosting.md) (`self_host: true` in user config),
|
|
151
|
+
[local-dev.md](docs/local-dev.md) for the native dev stack (`./scripts/dev-up.sh`),
|
|
152
|
+
or `./docker/up.sh` / [docker-self-host.md](docs/docker-self-host.md) for Docker
|
|
153
|
+
on loopback `:8000`.
|
|
147
154
|
|
|
148
155
|
```bash
|
|
149
|
-
git clone git@github.com:
|
|
156
|
+
git clone git@github.com:AllocContext/alloc-context.git
|
|
150
157
|
cd alloc-context
|
|
151
158
|
python3.11 -m venv .venv && source .venv/bin/activate
|
|
152
159
|
pip install -e ".[dev]"
|
|
@@ -172,6 +179,10 @@ HTTP MCP + x402: [mcp-http.md](docs/mcp-http.md). CLI entry point:
|
|
|
172
179
|
|
|
173
180
|
| Document | Purpose |
|
|
174
181
|
|----------|---------|
|
|
182
|
+
| [docs/agent-onramp.md](docs/agent-onramp.md) | **Start here** — ~2 min to first ContextBundle |
|
|
183
|
+
| [docs/deterministic-context-mcp-pattern.md](docs/deterministic-context-mcp-pattern.md) | Reusable ingest → rollup → MCP → x402 pattern |
|
|
184
|
+
| [docs/langchain-integration.md](docs/langchain-integration.md) | LangChain tools for hosted MCP (x402) |
|
|
185
|
+
| [docs/docker-self-host.md](docs/docker-self-host.md) | Docker Compose self-host evaluation |
|
|
175
186
|
| [docs/cursor-mcp.md](docs/cursor-mcp.md) | Cursor stdio MCP (bridge default) |
|
|
176
187
|
| [docs/user-config.md](docs/user-config.md) | Bridge `user.yaml` reference |
|
|
177
188
|
| [docs/mcp.md](docs/mcp.md) | MCP tools and x402 |
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# AllocContext
|
|
2
2
|
|
|
3
|
-
[](https://glama.ai/mcp/servers/negillett/alloc-context)
|
|
3
|
+
[](https://smithery.ai/servers/alloccontext/alloc-context)
|
|
5
4
|
|
|
6
|
-
mcp-name: io.github.
|
|
5
|
+
mcp-name: io.github.AllocContext/alloc-context
|
|
7
6
|
|
|
8
|
-
**Portfolio-aware crypto context for
|
|
9
|
-
sentiment, macro, and regime; optional
|
|
10
|
-
JSON over MCP with
|
|
7
|
+
**Portfolio-aware crypto context for whatever you hold** — discover your
|
|
8
|
+
holdings, holdings-scoped market data, sentiment, macro, and regime; optional
|
|
9
|
+
allocation analysis when you supply targets. Deterministic JSON over MCP with
|
|
10
|
+
x402 pay-per-call on Base.
|
|
11
|
+
|
|
12
|
+
**New here?** [Agent on-ramp (~2 min)](docs/agent-onramp.md) — copy-paste path to
|
|
13
|
+
your first ContextBundle. **Organization:**
|
|
14
|
+
[AllocContext on GitHub](https://github.com/AllocContext) — overview and integration links.
|
|
11
15
|
|
|
12
16
|
> **Privacy:** nothing stored · one-time read-only · pass-through only — your
|
|
13
17
|
> keys and portfolio never persist on our servers. See [USE.md](docs/USE.md).
|
|
@@ -69,7 +73,7 @@ Not financial advice.
|
|
|
69
73
|
| **Discovery** | [llms.txt](https://mcp.alloc-context.com/llms.txt), [x402 manifest](https://mcp.alloc-context.com/.well-known/x402.json) |
|
|
70
74
|
| **Pricing** | **$0.02** cached context/math · **$0.05** live ingest or portfolio |
|
|
71
75
|
| **Payment** | x402 on Base — USDC or EURC |
|
|
72
|
-
| **Market scope** |
|
|
76
|
+
| **Market scope** | Tailored to your holdings (band OHLC for BTC/ETH; alt quote snapshots); bridge auto-scopes from portfolio |
|
|
73
77
|
|
|
74
78
|
Agents and wallets connect directly to the hosted endpoint — see
|
|
75
79
|
[agent-integration.md](docs/agent-integration.md). The Cursor bridge above
|
|
@@ -86,7 +90,7 @@ combines local portfolio reads with this upstream for market context.
|
|
|
86
90
|
| `get_rebalance_plan` | USD rebalance moves from allocation, target, and NAV |
|
|
87
91
|
| `check_allocation_band` | Drift vs target and whether allocation is outside the band |
|
|
88
92
|
| `check_allocation_bands` | Batch band checks for multiple target scenarios |
|
|
89
|
-
| `get_portfolio_state` | Live NAV and holdings
|
|
93
|
+
| `get_portfolio_state` | Live NAV and holdings (e.g. Coinbase, Kraken read-only keys) |
|
|
90
94
|
|
|
91
95
|
Market context is **holdings-scoped**: band assets (BTC/ETH) use OHLC bars; alt
|
|
92
96
|
holdings (e.g. HYPE) use quote snapshots when cached. The bridge auto-scopes
|
|
@@ -98,11 +102,13 @@ See [mcp.md](docs/mcp.md) for arguments, pricing, and resources.
|
|
|
98
102
|
## Self-host and development
|
|
99
103
|
|
|
100
104
|
Run ingest and MCP entirely on your machine — no x402 upstream required.
|
|
101
|
-
See [self-hosting.md](docs/self-hosting.md) (`self_host: true` in user config)
|
|
102
|
-
|
|
105
|
+
See [self-hosting.md](docs/self-hosting.md) (`self_host: true` in user config),
|
|
106
|
+
[local-dev.md](docs/local-dev.md) for the native dev stack (`./scripts/dev-up.sh`),
|
|
107
|
+
or `./docker/up.sh` / [docker-self-host.md](docs/docker-self-host.md) for Docker
|
|
108
|
+
on loopback `:8000`.
|
|
103
109
|
|
|
104
110
|
```bash
|
|
105
|
-
git clone git@github.com:
|
|
111
|
+
git clone git@github.com:AllocContext/alloc-context.git
|
|
106
112
|
cd alloc-context
|
|
107
113
|
python3.11 -m venv .venv && source .venv/bin/activate
|
|
108
114
|
pip install -e ".[dev]"
|
|
@@ -128,6 +134,10 @@ HTTP MCP + x402: [mcp-http.md](docs/mcp-http.md). CLI entry point:
|
|
|
128
134
|
|
|
129
135
|
| Document | Purpose |
|
|
130
136
|
|----------|---------|
|
|
137
|
+
| [docs/agent-onramp.md](docs/agent-onramp.md) | **Start here** — ~2 min to first ContextBundle |
|
|
138
|
+
| [docs/deterministic-context-mcp-pattern.md](docs/deterministic-context-mcp-pattern.md) | Reusable ingest → rollup → MCP → x402 pattern |
|
|
139
|
+
| [docs/langchain-integration.md](docs/langchain-integration.md) | LangChain tools for hosted MCP (x402) |
|
|
140
|
+
| [docs/docker-self-host.md](docs/docker-self-host.md) | Docker Compose self-host evaluation |
|
|
131
141
|
| [docs/cursor-mcp.md](docs/cursor-mcp.md) | Cursor stdio MCP (bridge default) |
|
|
132
142
|
| [docs/user-config.md](docs/user-config.md) | Bridge `user.yaml` reference |
|
|
133
143
|
| [docs/mcp.md](docs/mcp.md) | MCP tools and x402 |
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alloc-context
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: Portfolio-aware crypto context for agents — holdings
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: Portfolio-aware crypto context for agents — holdings-scoped market, sentiment, optional allocation analysis
|
|
5
5
|
License: Elastic-2.0
|
|
6
6
|
Project-URL: Homepage, https://mcp.alloc-context.com/llms.txt
|
|
7
|
-
Project-URL: Documentation, https://github.com/
|
|
8
|
-
Project-URL: Repository, https://github.com/
|
|
9
|
-
Project-URL: Issues, https://github.com/
|
|
10
|
-
Project-URL: Changelog, https://github.com/
|
|
7
|
+
Project-URL: Documentation, https://github.com/AllocContext/alloc-context/blob/main/docs/agent-integration.md
|
|
8
|
+
Project-URL: Repository, https://github.com/AllocContext/alloc-context
|
|
9
|
+
Project-URL: Issues, https://github.com/AllocContext/alloc-context/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/AllocContext/alloc-context/releases
|
|
11
11
|
Project-URL: MCP Server, https://mcp.alloc-context.com/mcp
|
|
12
|
-
Keywords: mcp,x402,
|
|
12
|
+
Keywords: mcp,x402,holdings,portfolio,crypto,cryptocurrency,bitcoin,ethereum,agents,allocation,rebalance,coinbase,kraken
|
|
13
13
|
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -40,18 +40,23 @@ Requires-Dist: mcp>=1.6; extra == "dev"
|
|
|
40
40
|
Requires-Dist: x402[evm,fastapi]>=2.0; extra == "dev"
|
|
41
41
|
Requires-Dist: cdp-sdk>=1.46; extra == "dev"
|
|
42
42
|
Requires-Dist: uvicorn[standard]>=0.30; extra == "dev"
|
|
43
|
+
Requires-Dist: langchain-core>=0.3.0; extra == "dev"
|
|
43
44
|
Dynamic: license-file
|
|
44
45
|
|
|
45
46
|
# AllocContext
|
|
46
47
|
|
|
47
|
-
[](https://glama.ai/mcp/servers/negillett/alloc-context)
|
|
48
|
+
[](https://smithery.ai/servers/alloccontext/alloc-context)
|
|
49
49
|
|
|
50
|
-
mcp-name: io.github.
|
|
50
|
+
mcp-name: io.github.AllocContext/alloc-context
|
|
51
51
|
|
|
52
|
-
**Portfolio-aware crypto context for
|
|
53
|
-
sentiment, macro, and regime; optional
|
|
54
|
-
JSON over MCP with
|
|
52
|
+
**Portfolio-aware crypto context for whatever you hold** — discover your
|
|
53
|
+
holdings, holdings-scoped market data, sentiment, macro, and regime; optional
|
|
54
|
+
allocation analysis when you supply targets. Deterministic JSON over MCP with
|
|
55
|
+
x402 pay-per-call on Base.
|
|
56
|
+
|
|
57
|
+
**New here?** [Agent on-ramp (~2 min)](docs/agent-onramp.md) — copy-paste path to
|
|
58
|
+
your first ContextBundle. **Organization:**
|
|
59
|
+
[AllocContext on GitHub](https://github.com/AllocContext) — overview and integration links.
|
|
55
60
|
|
|
56
61
|
> **Privacy:** nothing stored · one-time read-only · pass-through only — your
|
|
57
62
|
> keys and portfolio never persist on our servers. See [USE.md](docs/USE.md).
|
|
@@ -113,7 +118,7 @@ Not financial advice.
|
|
|
113
118
|
| **Discovery** | [llms.txt](https://mcp.alloc-context.com/llms.txt), [x402 manifest](https://mcp.alloc-context.com/.well-known/x402.json) |
|
|
114
119
|
| **Pricing** | **$0.02** cached context/math · **$0.05** live ingest or portfolio |
|
|
115
120
|
| **Payment** | x402 on Base — USDC or EURC |
|
|
116
|
-
| **Market scope** |
|
|
121
|
+
| **Market scope** | Tailored to your holdings (band OHLC for BTC/ETH; alt quote snapshots); bridge auto-scopes from portfolio |
|
|
117
122
|
|
|
118
123
|
Agents and wallets connect directly to the hosted endpoint — see
|
|
119
124
|
[agent-integration.md](docs/agent-integration.md). The Cursor bridge above
|
|
@@ -130,7 +135,7 @@ combines local portfolio reads with this upstream for market context.
|
|
|
130
135
|
| `get_rebalance_plan` | USD rebalance moves from allocation, target, and NAV |
|
|
131
136
|
| `check_allocation_band` | Drift vs target and whether allocation is outside the band |
|
|
132
137
|
| `check_allocation_bands` | Batch band checks for multiple target scenarios |
|
|
133
|
-
| `get_portfolio_state` | Live NAV and holdings
|
|
138
|
+
| `get_portfolio_state` | Live NAV and holdings (e.g. Coinbase, Kraken read-only keys) |
|
|
134
139
|
|
|
135
140
|
Market context is **holdings-scoped**: band assets (BTC/ETH) use OHLC bars; alt
|
|
136
141
|
holdings (e.g. HYPE) use quote snapshots when cached. The bridge auto-scopes
|
|
@@ -142,11 +147,13 @@ See [mcp.md](docs/mcp.md) for arguments, pricing, and resources.
|
|
|
142
147
|
## Self-host and development
|
|
143
148
|
|
|
144
149
|
Run ingest and MCP entirely on your machine — no x402 upstream required.
|
|
145
|
-
See [self-hosting.md](docs/self-hosting.md) (`self_host: true` in user config)
|
|
146
|
-
|
|
150
|
+
See [self-hosting.md](docs/self-hosting.md) (`self_host: true` in user config),
|
|
151
|
+
[local-dev.md](docs/local-dev.md) for the native dev stack (`./scripts/dev-up.sh`),
|
|
152
|
+
or `./docker/up.sh` / [docker-self-host.md](docs/docker-self-host.md) for Docker
|
|
153
|
+
on loopback `:8000`.
|
|
147
154
|
|
|
148
155
|
```bash
|
|
149
|
-
git clone git@github.com:
|
|
156
|
+
git clone git@github.com:AllocContext/alloc-context.git
|
|
150
157
|
cd alloc-context
|
|
151
158
|
python3.11 -m venv .venv && source .venv/bin/activate
|
|
152
159
|
pip install -e ".[dev]"
|
|
@@ -172,6 +179,10 @@ HTTP MCP + x402: [mcp-http.md](docs/mcp-http.md). CLI entry point:
|
|
|
172
179
|
|
|
173
180
|
| Document | Purpose |
|
|
174
181
|
|----------|---------|
|
|
182
|
+
| [docs/agent-onramp.md](docs/agent-onramp.md) | **Start here** — ~2 min to first ContextBundle |
|
|
183
|
+
| [docs/deterministic-context-mcp-pattern.md](docs/deterministic-context-mcp-pattern.md) | Reusable ingest → rollup → MCP → x402 pattern |
|
|
184
|
+
| [docs/langchain-integration.md](docs/langchain-integration.md) | LangChain tools for hosted MCP (x402) |
|
|
185
|
+
| [docs/docker-self-host.md](docs/docker-self-host.md) | Docker Compose self-host evaluation |
|
|
175
186
|
| [docs/cursor-mcp.md](docs/cursor-mcp.md) | Cursor stdio MCP (bridge default) |
|
|
176
187
|
| [docs/user-config.md](docs/user-config.md) | Bridge `user.yaml` reference |
|
|
177
188
|
| [docs/mcp.md](docs/mcp.md) | MCP tools and x402 |
|
|
@@ -56,6 +56,8 @@ alloccontext/ingest/exchange/live.py
|
|
|
56
56
|
alloccontext/ingest/exchange/portfolio.py
|
|
57
57
|
alloccontext/ingest/exchange/registry.py
|
|
58
58
|
alloccontext/ingest/exchange/types.py
|
|
59
|
+
alloccontext/integrations/__init__.py
|
|
60
|
+
alloccontext/integrations/langchain.py
|
|
59
61
|
alloccontext/mcp/__init__.py
|
|
60
62
|
alloccontext/mcp/assets.py
|
|
61
63
|
alloccontext/mcp/bazaar.py
|
|
@@ -109,6 +111,7 @@ tests/test_backup_sqlite.py
|
|
|
109
111
|
tests/test_bridge.py
|
|
110
112
|
tests/test_bridge_portfolio.py
|
|
111
113
|
tests/test_bump_version.py
|
|
114
|
+
tests/test_check_pypi_release_json.py
|
|
112
115
|
tests/test_coinbase_portfolio.py
|
|
113
116
|
tests/test_config_cli.py
|
|
114
117
|
tests/test_context_bundle_schema.py
|
|
@@ -129,6 +132,7 @@ tests/test_ingest_runner.py
|
|
|
129
132
|
tests/test_ingest_store_integration.py
|
|
130
133
|
tests/test_kalshi_api.py
|
|
131
134
|
tests/test_kraken_portfolio.py
|
|
135
|
+
tests/test_langchain_integration.py
|
|
132
136
|
tests/test_live_ingest_handlers.py
|
|
133
137
|
tests/test_macro.py
|
|
134
138
|
tests/test_market_breadth.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Optional framework integrations (LangChain, etc.)."""
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""LangChain tools for the hosted AllocContext MCP (x402 on Base)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from dataclasses import replace
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from alloccontext.mcp.bazaar import OFFICIAL_HOSTED_MCP_URL, mcp_tool_specs
|
|
10
|
+
from alloccontext.mcp.upstream import call_upstream_tool
|
|
11
|
+
from alloccontext.user_config import (
|
|
12
|
+
DEFAULT_UPSTREAM_URL,
|
|
13
|
+
UserConfig,
|
|
14
|
+
load_user_config,
|
|
15
|
+
resolve_user_config_path,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
DEFAULT_HOSTED_TOOLS = (
|
|
19
|
+
"get_market_context",
|
|
20
|
+
"get_context_bundle",
|
|
21
|
+
"get_rebalance_plan",
|
|
22
|
+
"check_allocation_band",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def hosted_user_config(*, upstream_url: str | None = None) -> UserConfig:
|
|
27
|
+
"""Minimal bridge user config for hosted-only LangChain calls."""
|
|
28
|
+
base = UserConfig.empty()
|
|
29
|
+
return replace(
|
|
30
|
+
base,
|
|
31
|
+
upstream=upstream_url or DEFAULT_UPSTREAM_URL,
|
|
32
|
+
self_host=False,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def resolve_hosted_user_config(*, upstream_url: str | None = None) -> UserConfig:
|
|
37
|
+
"""Hosted bridge config: ``user.yaml`` when present, else env-only defaults.
|
|
38
|
+
|
|
39
|
+
Loads ``~/.config/alloc-context/user.yaml`` (or ``ALLOC_CONTEXT_USER_CONFIG``)
|
|
40
|
+
so ``x402.payer_private_key_file`` and inline payer keys work like the stdio
|
|
41
|
+
bridge. Exchange blocks in ``user.yaml`` are ignored for hosted tool calls.
|
|
42
|
+
"""
|
|
43
|
+
path = resolve_user_config_path()
|
|
44
|
+
if path is None or not path.is_file():
|
|
45
|
+
return hosted_user_config(upstream_url=upstream_url)
|
|
46
|
+
|
|
47
|
+
loaded = load_user_config(path)
|
|
48
|
+
upstream = upstream_url or loaded.upstream
|
|
49
|
+
if loaded.self_host:
|
|
50
|
+
return replace(
|
|
51
|
+
hosted_user_config(upstream_url=upstream),
|
|
52
|
+
x402=loaded.x402,
|
|
53
|
+
path=loaded.path,
|
|
54
|
+
)
|
|
55
|
+
return replace(loaded, upstream=upstream, self_host=False)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _args_model(tool_name: str, input_schema: dict[str, Any]) -> type[Any]:
|
|
59
|
+
from pydantic import Field, create_model
|
|
60
|
+
|
|
61
|
+
properties = input_schema.get("properties") or {}
|
|
62
|
+
required = frozenset(input_schema.get("required") or [])
|
|
63
|
+
field_defs: dict[str, Any] = {}
|
|
64
|
+
for key, prop in properties.items():
|
|
65
|
+
description = str(prop.get("description") or "")
|
|
66
|
+
if key in required:
|
|
67
|
+
field_defs[key] = (Any, Field(description=description))
|
|
68
|
+
else:
|
|
69
|
+
field_defs[key] = (Any | None, Field(default=None, description=description))
|
|
70
|
+
model_name = "".join(part.title() for part in tool_name.split("_")) + "Input"
|
|
71
|
+
return create_model(model_name, **field_defs)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def build_hosted_langchain_tools(
|
|
75
|
+
user: UserConfig | None = None,
|
|
76
|
+
*,
|
|
77
|
+
tool_names: tuple[str, ...] | None = None,
|
|
78
|
+
) -> list[Any]:
|
|
79
|
+
"""Return LangChain tools that call the hosted MCP with x402 payment.
|
|
80
|
+
|
|
81
|
+
Requires ``langchain-core`` and ``alloc-context[hosted]``. Configure an x402
|
|
82
|
+
payer via ``EVM_PRIVATE_KEY``, ``user.yaml`` (``x402.payer_private_key_file``),
|
|
83
|
+
or pass a ``UserConfig`` explicitly.
|
|
84
|
+
"""
|
|
85
|
+
try:
|
|
86
|
+
from langchain_core.tools import StructuredTool
|
|
87
|
+
except ImportError as exc:
|
|
88
|
+
raise ImportError(
|
|
89
|
+
"LangChain integration requires langchain-core: pip install langchain-core"
|
|
90
|
+
) from exc
|
|
91
|
+
|
|
92
|
+
user = user or resolve_hosted_user_config()
|
|
93
|
+
selected = frozenset(tool_names or DEFAULT_HOSTED_TOOLS)
|
|
94
|
+
specs = {spec["tool_name"]: spec for spec in mcp_tool_specs()}
|
|
95
|
+
missing = selected - specs.keys()
|
|
96
|
+
if missing:
|
|
97
|
+
raise ValueError(f"Unknown MCP tool(s): {', '.join(sorted(missing))}")
|
|
98
|
+
|
|
99
|
+
tools: list[Any] = []
|
|
100
|
+
for name in tool_names or DEFAULT_HOSTED_TOOLS:
|
|
101
|
+
spec = specs[name]
|
|
102
|
+
|
|
103
|
+
def _invoke(*, _tool_name: str = name, **kwargs: Any) -> str:
|
|
104
|
+
arguments = {key: value for key, value in kwargs.items() if value is not None}
|
|
105
|
+
payload = call_upstream_tool(user, _tool_name, arguments)
|
|
106
|
+
if payload.get("reason") == "upstream_payment_required":
|
|
107
|
+
message = payload.get("message") or (
|
|
108
|
+
"Configure an x402 payer wallet to call hosted upstream."
|
|
109
|
+
)
|
|
110
|
+
raise RuntimeError(message)
|
|
111
|
+
return json.dumps(payload, separators=(",", ":"))
|
|
112
|
+
|
|
113
|
+
tools.append(
|
|
114
|
+
StructuredTool(
|
|
115
|
+
name=name,
|
|
116
|
+
description=spec["description"],
|
|
117
|
+
func=_invoke,
|
|
118
|
+
args_schema=_args_model(name, spec["input_schema"]),
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
return tools
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def official_hosted_mcp_url() -> str:
|
|
125
|
+
return OFFICIAL_HOSTED_MCP_URL
|