golfgolfgolf200 commited on
Commit
b051a1f
·
verified ·
1 Parent(s): be34ff5

Publish warppay402-python synced with GitHub https://github.com/Warppay402/warppay402-python

Browse files
.gitignore ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ==========================================
2
+ # 1. Python & Build Artifacts
3
+ # ==========================================
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ *.so
8
+
9
+ # Distribution & Packaging
10
+ build/
11
+ bdist/
12
+ dist/
13
+ sdist/
14
+ eggs/
15
+ *.egg-info/
16
+ .eggs/
17
+ *.egg
18
+ MANIFEST
19
+
20
+ # ==========================================
21
+ # 2. Virtual Environments
22
+ # ==========================================
23
+ .venv/
24
+ venv/
25
+ ENV/
26
+ env/
27
+ env.bak/
28
+ venv.bak/
29
+
30
+ # ==========================================
31
+ # 3. Environment Variables & Secret Files
32
+ # ==========================================
33
+ .env
34
+ .env.*
35
+ !.env.example
36
+ *.pem
37
+ *.key
38
+ *.crt
39
+
40
+ # MCP Local Client Configuration (may contain auth headers/keys)
41
+ .mcp.json
42
+
43
+ # ==========================================
44
+ # 4. Editors, IDEs & OS Junk
45
+ # ==========================================
46
+ # VS Code
47
+ .vscode/
48
+ !.vscode/settings.json
49
+ !.vscode/tasks.json
50
+ !.vscode/launch.json
51
+ !.vscode/extensions.json
52
+ *.code-workspace
53
+
54
+ # JetBrains / PyCharm
55
+ .idea/
56
+
57
+ # Mac / Linux OS
58
+ .DS_Store
59
+ .DS_Store?
60
+ ._*
61
+ .Spotlight-V100
62
+ .Trashes
63
+ ehthumbs.db
64
+ Thumbs.db
65
+
66
+ # ==========================================
67
+ # 5. Project Reviews & Temporary Logs
68
+ # ==========================================
69
+ review*.txt
70
+ *.log
71
+ *.sqlite3
LICENSE.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WarpPay402
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 do so, permissions, and 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.
dist/warppay402_mcp-1.3.0-py3-none-any.whl ADDED
Binary file (11.5 kB). View file
 
dist/warppay402_mcp-1.3.0.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac5df170ce63a45165e94ed31d5388f6888910aeabd122ce79ae6ecaed294191
3
+ size 11856
pyproject.toml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "warppay402-mcp"
7
+ version = "1.3.0"
8
+ description = "Keyless, zero-API LangChain, LlamaIndex, & CrewAI tool suite for WarpPay402 x402 micropayment infrastructure across Base, Solana, Arbitrum, and Arc Mainnet."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.9"
12
+ dependencies = [
13
+ "requests>=2.28.0",
14
+ "langchain-core>=0.1.0",
15
+ "mcp>=1.0.0",
16
+ ]
17
+
18
+ [project.optional-dependencies]
19
+ llamaindex = [
20
+ "llama-index-core>=0.10.0",
21
+ ]
22
+
23
+ keywords = [
24
+ "mcp",
25
+ "model-context-protocol",
26
+ "x402",
27
+ "micropayments",
28
+ "langchain",
29
+ "llamaindex",
30
+ "crewai",
31
+ "ai-agents",
32
+ "base-chain",
33
+ "solana",
34
+ "arc-mainnet"
35
+ ]
36
+
37
+ [project.scripts]
38
+ warppay402-mcp = "warppay402_mcp.cli:main"
test_llamaindex.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import unittest
3
+ import logging
4
+ from unittest.mock import patch, MagicMock
5
+
6
+ # Configure verbose logging output
7
+ logging.basicConfig(
8
+ level=logging.INFO,
9
+ format="%(asctime)s [%(levelname)s] %(message)s",
10
+ handlers=[logging.StreamHandler(sys.stdout)]
11
+ )
12
+ logger = logging.getLogger("TestWarpPayLlamaIndexTools")
13
+
14
+ class TestWarpPayLlamaIndexTools(unittest.TestCase):
15
+
16
+ def test_import_and_fallback_behavior(self):
17
+ """Test that WarpPayLlamaIndexTools imports cleanly or handles missing dependencies."""
18
+ logger.info("==================================================")
19
+ logger.info("TEST 1: Testing import and fallback behavior...")
20
+
21
+ try:
22
+ import llama_index.core.tools # noqa: F401
23
+ logger.info(" [✓] 'llama-index-core' is detected in the active environment.")
24
+
25
+ from warppay402_mcp import WarpPayLlamaIndexTools
26
+ self.assertIsNotNone(
27
+ WarpPayLlamaIndexTools,
28
+ "WarpPayLlamaIndexTools should be defined when llama-index-core is installed"
29
+ )
30
+ logger.info(" [✓] Successfully verified WarpPayLlamaIndexTools is available.")
31
+
32
+ except ImportError as e:
33
+ logger.warning(f" [!] 'llama-index-core' is NOT installed: {e}")
34
+ from warppay402_mcp import WarpPayLlamaIndexTools
35
+ self.assertIsNone(
36
+ WarpPayLlamaIndexTools,
37
+ "WarpPayLlamaIndexTools should be None when llama-index-core is absent"
38
+ )
39
+ logger.info(" [✓] Verified graceful fallback: WarpPayLlamaIndexTools is set to None.")
40
+
41
+ def test_get_tools_returns_all_29_tools(self):
42
+ """Verify that get_tools() wraps all 29 tools as FunctionTool instances."""
43
+ logger.info("==================================================")
44
+ logger.info("TEST 2: Verifying LlamaIndex tool generation for all 29 tools...")
45
+
46
+ try:
47
+ import llama_index.core.tools # noqa: F401
48
+ logger.info(" [✓] Found 'llama-index-core'. Proceeding with tool generation check...")
49
+ except ImportError:
50
+ logger.warning(" [!] Skipping tool wrapping check because 'llama-index-core' is not installed.")
51
+ self.skipTest("llama-index-core is not installed in the environment. Skipping mock test.")
52
+
53
+ with patch("warppay402_mcp.llamaindex.FunctionTool") as mock_function_tool:
54
+ # Helper function to create mock objects with attributes set properly
55
+ def create_mock_tool(fn, name, description):
56
+ mock_tool = MagicMock()
57
+ mock_tool.name = name
58
+ mock_tool.description = description
59
+ mock_tool.metadata.name = name
60
+ mock_tool.metadata.description = description
61
+ return mock_tool
62
+
63
+ mock_function_tool.from_defaults.side_effect = create_mock_tool
64
+
65
+ from warppay402_mcp.llamaindex import WarpPayLlamaIndexTools, ALL_LANGCHAIN_TOOLS
66
+
67
+ logger.info(f" [ℹ] Source tools loaded: {len(ALL_LANGCHAIN_TOOLS)} tools in ALL_LANGCHAIN_TOOLS.")
68
+
69
+ tools = WarpPayLlamaIndexTools.get_tools()
70
+ logger.info(f" [ℹ] Converted tools generated: {len(tools)} LlamaIndex FunctionTools.")
71
+
72
+ # Print full itemized log of converted tools
73
+ logger.info(" --------------------------------------------------")
74
+ logger.info(" Itemized Converted Tool Log:")
75
+ for idx, tool in enumerate(tools, start=1):
76
+ logger.info(f" {idx:02d}. Name: {tool.name:<28} | Description: {tool.description[:45]}...")
77
+ logger.info(" --------------------------------------------------")
78
+
79
+ # Assertions
80
+ self.assertEqual(len(tools), 29, "Expected exactly 29 converted tools.")
81
+ self.assertEqual(len(ALL_LANGCHAIN_TOOLS), 29, "Expected 29 source LangChain tools.")
82
+ self.assertEqual(mock_function_tool.from_defaults.call_count, 29)
83
+ logger.info(" [✓] Tool count assertion passed: 29/29 tools converted successfully.")
84
+
85
+ # Specific capability checks
86
+ names = [tool.name for tool in tools]
87
+ required_sample_names = ["arc_dex_oracle", "get_aerodrome_yields", "web_scraper", "ucp_deals_oracle"]
88
+ for name in required_sample_names:
89
+ self.assertIn(name, names)
90
+ logger.info(f" [✓] Confirmed presence of sample capability: '{name}'")
91
+
92
+ logger.info("==================================================")
93
+ logger.info("TEST SUMMARY: All LlamaIndex integration tests completed successfully!")
94
+
95
+ if __name__ == "__main__":
96
+ unittest.main(verbosity=2)
warppay402_mcp/.gitignore ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ build/
11
+ devel/
12
+ dist/
13
+ downloads/
14
+ eggs/
15
+ .eggs/
16
+ lib/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ wheels/
22
+ share/python-wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+ MANIFEST
27
+
28
+ # PyInstaller / Py2exe / Executable artifacts
29
+ *.manifest
30
+ *.spec
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+
36
+ # Unit test / coverage reports
37
+ htmlcov/
38
+ .tox/
39
+ .nox/
40
+ .coverage
41
+ .coverage.*
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+ *.cover
46
+ *.pydevproject
47
+ .hypothesis/
48
+ .pytest_cache/
49
+ cover/
50
+
51
+ # Translations
52
+ *.mo
53
+ *.pot
54
+
55
+ # Django stuff:
56
+ *.log
57
+ local_settings.py
58
+ db.sqlite3
59
+ db.sqlite3-journal
60
+
61
+ # Flask stuff:
62
+ instance/
63
+ .webassets-cache
64
+
65
+ # Scrapy stuff:
66
+ .scrapy
67
+
68
+ # Sphinx documentation
69
+ docs/_build/
70
+
71
+ # PyBuilder
72
+ .pybuilder/
73
+
74
+ # Jupyter Notebook & REPL history
75
+ .ipynb_checkpoints
76
+ .python_history
77
+ .python_history*
78
+
79
+ # IPython
80
+ profile_default/
81
+ ipython_config.py
82
+
83
+ # Terminal / Shell History & State Files
84
+ .bash_history
85
+ .zsh_history
86
+ .fish_history
87
+ .history
88
+ .node_repl_history
89
+ .bash_sessions/
90
+ .zsh_sessions/
91
+ *.history
92
+
93
+ # Environments & Local Secrets
94
+ .env
95
+ .env.*
96
+ !.env.example
97
+ .venv
98
+ env/
99
+ venv/
100
+ ENV/
101
+ env.bak/
102
+ venv.bak/
103
+
104
+ # mypy, pyright, & linting
105
+ .mypy_cache/
106
+ .pyre/
107
+ .pytype/
108
+ .ruff_cache/
109
+ .dmypy.json
110
+ dmypy.json
111
+
112
+ # IDEs and Editors
113
+ .idea/
114
+ .vscode/
115
+ *.swp
116
+ *.swo
117
+ *~
118
+ .DS_Store
119
+ Thumbs.db
120
+
121
+ # Node / Web Workers / Micro-services
122
+ node_modules/
123
+ npm-debug.log*
124
+ yarn-debug.log*
125
+ yarn-error.log*
126
+ pnpm-debug.log*
warppay402_mcp/__init__.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __version__ = "1.3.0"
2
+
3
+ from .tools import (
4
+ ArcDexOracleTool,
5
+ WebScraperTool,
6
+ BrowserScraperTool,
7
+ BaseAnalyticsTool,
8
+ ArcAnalyticsTool,
9
+ ArcNetworkQueryTool,
10
+ PdfExtractorTool,
11
+ RenderScreenshotTool,
12
+ ExtractJsonTool,
13
+ SmartContractVerifierTool,
14
+ AerodromeYieldsTool,
15
+ AerodromeSwapTool,
16
+ AerodromeClammTool,
17
+ AerodromeVeaeroTool,
18
+ DeployBaseContractTool,
19
+ DeploySolanaContractTool,
20
+ DeployArcContractTool,
21
+ ArcCctpBridgeTool,
22
+ PublicDataFeedTool,
23
+ DataFeedsTool,
24
+ RealEstateCalculatorTool,
25
+ AddressNormalizerTool,
26
+ WeatherOracleTool,
27
+ OutageOracleTool,
28
+ ForexOracleTool,
29
+ ShippingRateEstimatorTool,
30
+ GithubHealthAnalyzerTool,
31
+ PropertyCompsEstimatorTool,
32
+ UcpDealsOracleTool,
33
+ DefiExecutorAgentTool,
34
+ DeepResearchAgentTool,
35
+ )
36
+
37
+ # Optional import for LlamaIndex support
38
+ try:
39
+ from .llamaindex import WarpPayLlamaIndexTools
40
+ except ImportError:
41
+ WarpPayLlamaIndexTools = None # Fallback if llama-index-core is not installed
42
+
43
+ __all__ = [
44
+ "ArcDexOracleTool",
45
+ "WebScraperTool",
46
+ "BrowserScraperTool",
47
+ "BaseAnalyticsTool",
48
+ "ArcAnalyticsTool",
49
+ "ArcNetworkQueryTool",
50
+ "PdfExtractorTool",
51
+ "RenderScreenshotTool",
52
+ "ExtractJsonTool",
53
+ "SmartContractVerifierTool",
54
+ "AerodromeYieldsTool",
55
+ "AerodromeSwapTool",
56
+ "AerodromeClammTool",
57
+ "AerodromeVeaeroTool",
58
+ "DeployBaseContractTool",
59
+ "DeploySolanaContractTool",
60
+ "DeployArcContractTool",
61
+ "ArcCctpBridgeTool",
62
+ "PublicDataFeedTool",
63
+ "DataFeedsTool",
64
+ "RealEstateCalculatorTool",
65
+ "AddressNormalizerTool",
66
+ "WeatherOracleTool",
67
+ "OutageOracleTool",
68
+ "ForexOracleTool",
69
+ "ShippingRateEstimatorTool",
70
+ "GithubHealthAnalyzerTool",
71
+ "PropertyCompsEstimatorTool",
72
+ "UcpDealsOracleTool",
73
+ "DefiExecutorAgentTool",
74
+ "DeepResearchAgentTool",
75
+ "WarpPayLlamaIndexTools",
76
+ ]
warppay402_mcp/cli.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import asyncio
3
+ from mcp.server.mcpserver import MCPServer
4
+ from warppay402_mcp.tools import (
5
+ ArcDexOracleTool,
6
+ WebScraperTool,
7
+ BrowserScraperTool,
8
+ BaseAnalyticsTool,
9
+ ArcAnalyticsTool,
10
+ ArcNetworkQueryTool,
11
+ PdfExtractorTool,
12
+ RenderScreenshotTool,
13
+ ExtractJsonTool,
14
+ SmartContractVerifierTool,
15
+ AerodromeYieldsTool,
16
+ AerodromeSwapTool,
17
+ AerodromeClammTool,
18
+ AerodromeVeaeroTool,
19
+ DeployBaseContractTool,
20
+ DeploySolanaContractTool,
21
+ DeployArcContractTool,
22
+ ArcCctpBridgeTool,
23
+ PublicDataFeedTool,
24
+ DataFeedsTool,
25
+ RealEstateCalculatorTool,
26
+ AddressNormalizerTool,
27
+ WeatherOracleTool,
28
+ OutageOracleTool,
29
+ ForexOracleTool,
30
+ ShippingRateEstimatorTool,
31
+ GithubHealthAnalyzerTool,
32
+ PropertyCompsEstimatorTool,
33
+ UcpDealsOracleTool,
34
+ DefiExecutorAgentTool,
35
+ DeepResearchAgentTool,
36
+ )
37
+
38
+ # Initialize MCPServer (mcp 2.x)
39
+ mcp = MCPServer("WarpPay402 MCP Gateway")
40
+
41
+ # Instantiate all tools
42
+ tools = [
43
+ ArcDexOracleTool(), WebScraperTool(), BrowserScraperTool(), BaseAnalyticsTool(),
44
+ ArcAnalyticsTool(), ArcNetworkQueryTool(), PdfExtractorTool(), RenderScreenshotTool(),
45
+ ExtractJsonTool(), SmartContractVerifierTool(), AerodromeYieldsTool(), AerodromeSwapTool(),
46
+ AerodromeClammTool(), AerodromeVeaeroTool(), DeployBaseContractTool(), DeploySolanaContractTool(),
47
+ DeployArcContractTool(), ArcCctpBridgeTool(), PublicDataFeedTool(), DataFeedsTool(),
48
+ RealEstateCalculatorTool(), AddressNormalizerTool(), WeatherOracleTool(), OutageOracleTool(),
49
+ ForexOracleTool(), ShippingRateEstimatorTool(), GithubHealthAnalyzerTool(), PropertyCompsEstimatorTool(),
50
+ UcpDealsOracleTool(), DefiExecutorAgentTool(), DeepResearchAgentTool()
51
+ ]
52
+
53
+ def register_tool(tool_instance):
54
+ """Factory helper to capture unique closure scope for each tool."""
55
+ def handler(*args, **kwargs):
56
+ return tool_instance._run(*args, **kwargs)
57
+
58
+ handler.__name__ = tool_instance.name
59
+ return mcp.tool(name=tool_instance.name, description=tool_instance.description)(handler)
60
+
61
+ # Properly register each tool with MCPServer
62
+ for tool in tools:
63
+ register_tool(tool)
64
+
65
+ def main():
66
+ """Main CLI entry point for warppay402-mcp server process."""
67
+ mcp.run()
68
+
69
+ if __name__ == "__main__":
70
+ main()
warppay402_mcp/llamaindex.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+ from llama_index.core.tools import FunctionTool
3
+ from warppay402_mcp.tools import (
4
+ ArcDexOracleTool,
5
+ WebScraperTool,
6
+ BrowserScraperTool,
7
+ BaseAnalyticsTool,
8
+ ArcAnalyticsTool,
9
+ ArcNetworkQueryTool,
10
+ PdfExtractorTool,
11
+ RenderScreenshotTool,
12
+ ExtractJsonTool,
13
+ SmartContractVerifierTool,
14
+ AerodromeYieldsTool,
15
+ AerodromeSwapTool,
16
+ AerodromeClammTool,
17
+ AerodromeVeaeroTool,
18
+ DeployBaseContractTool,
19
+ DeploySolanaContractTool,
20
+ DeployArcContractTool,
21
+ ArcCctpBridgeTool,
22
+ PublicDataFeedTool,
23
+ DataFeedsTool,
24
+ RealEstateCalculatorTool,
25
+ AddressNormalizerTool,
26
+ WeatherOracleTool,
27
+ OutageOracleTool,
28
+ ForexOracleTool,
29
+ ShippingRateEstimatorTool,
30
+ GithubHealthAnalyzerTool,
31
+ PropertyCompsEstimatorTool,
32
+ UcpDealsOracleTool,
33
+ DefiExecutorAgentTool,
34
+ DeepResearchAgentTool,
35
+ )
36
+
37
+ ALL_LANGCHAIN_TOOLS = [
38
+ ArcDexOracleTool(), WebScraperTool(), BrowserScraperTool(), BaseAnalyticsTool(),
39
+ ArcAnalyticsTool(), ArcNetworkQueryTool(), PdfExtractorTool(), RenderScreenshotTool(),
40
+ ExtractJsonTool(), SmartContractVerifierTool(), AerodromeYieldsTool(), AerodromeSwapTool(),
41
+ AerodromeClammTool(), AerodromeVeaeroTool(), DeployBaseContractTool(), DeploySolanaContractTool(),
42
+ DeployArcContractTool(), ArcCctpBridgeTool(), PublicDataFeedTool(), DataFeedsTool(),
43
+ RealEstateCalculatorTool(), AddressNormalizerTool(), WeatherOracleTool(), OutageOracleTool(),
44
+ ForexOracleTool(), ShippingRateEstimatorTool(), GithubHealthAnalyzerTool(), PropertyCompsEstimatorTool(),
45
+ UcpDealsOracleTool(), DefiExecutorAgentTool(), DeepResearchAgentTool()
46
+ ]
47
+
48
+ class WarpPayLlamaIndexTools:
49
+ """Helper class to convert WarpPay402 tools into LlamaIndex FunctionTools."""
50
+
51
+ @staticmethod
52
+ def get_tools() -> List[FunctionTool]:
53
+ """Returns all WarpPay402 tools wrapped as LlamaIndex FunctionTool instances."""
54
+ llamaindex_tools = []
55
+ for tool in ALL_LANGCHAIN_TOOLS:
56
+ llamaindex_tool = FunctionTool.from_defaults(
57
+ fn=tool._run,
58
+ name=tool.name,
59
+ description=tool.description,
60
+ )
61
+ llamaindex_tools.append(llamaindex_tool)
62
+ return llamaindex_tools
warppay402_mcp/tools.py ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ from typing import Optional, Dict, Any
3
+ from langchain_core.tools import BaseTool
4
+
5
+ BASE_URL = "https://api.warppay402.com/api/v1"
6
+
7
+ class ArcDexOracleTool(BaseTool):
8
+ name: str = "arc_dex_oracle"
9
+ description: str = "Real-time ETH/USDC spot price resolver and DEX liquidity oracle for Arc Mainnet ($0.001 USDC)."
10
+
11
+ def _run(self, pair: str = "ETH/USDC") -> str:
12
+ res = requests.post(f"{BASE_URL}/tools/arc-dex-oracle", json={"pair": pair})
13
+ return res.text
14
+
15
+ class WebScraperTool(BaseTool):
16
+ name: str = "web_scraper"
17
+ description: str = "Scrapes any public webpage URL into clean Markdown for AI context window ingestion ($0.001 USDC)."
18
+
19
+ def _run(self, url: str) -> str:
20
+ res = requests.post(f"{BASE_URL}/tools/web-scraper", json={"url": url})
21
+ return res.text
22
+
23
+ class BrowserScraperTool(BaseTool):
24
+ name: str = "browser_scraper"
25
+ description: str = "Executes unblockable JavaScript Chromium rendering via proxy workers ($0.005 USDC)."
26
+
27
+ def _run(self, url: str) -> str:
28
+ res = requests.post(f"{BASE_URL}/tools/browser-scraper", json={"url": url})
29
+ return res.text
30
+
31
+ class BaseAnalyticsTool(BaseTool):
32
+ name: str = "base_analytics"
33
+ description: str = "Fetches ETH balance, nonce, and account stats for any 0x wallet on Base Mainnet ($0.002 USDC)."
34
+
35
+ def _run(self, address: str) -> str:
36
+ res = requests.post(f"{BASE_URL}/tools/base-analytics", json={"address": address})
37
+ return res.text
38
+
39
+ class ArcAnalyticsTool(BaseTool):
40
+ name: str = "arc_analytics"
41
+ description: str = "Fetches live block height, gas price, and RPC latency from Arc Mainnet ($0.001 USDC)."
42
+
43
+ def _run(self) -> str:
44
+ res = requests.post(f"{BASE_URL}/tools/arc-analytics")
45
+ return res.text
46
+
47
+ class ArcNetworkQueryTool(BaseTool):
48
+ name: str = "arc_network_oracle_query"
49
+ description: str = "Pre-flight Arc Mainnet telemetry: RPC latency (ms), gas prices (Gwei), native USDC balance, and account nonce ($0.10 USDC)."
50
+
51
+ def _run(self, includeGasTrends: bool = True, checkMerchantAccount: bool = True) -> str:
52
+ payload = {"includeGasTrends": includeGasTrends, "checkMerchantAccount": checkMerchantAccount}
53
+ res = requests.post(f"{BASE_URL}/tools/arc-network-query", json=payload)
54
+ return res.text
55
+
56
+ class PdfExtractorTool(BaseTool):
57
+ name: str = "pdf_extractor"
58
+ description: str = "Downloads and extracts clean plain text preview from public PDF document URLs ($0.005 USDC)."
59
+
60
+ def _run(self, pdfUrl: str) -> str:
61
+ res = requests.post(f"{BASE_URL}/tools/pdf-extractor", json={"pdfUrl": pdfUrl})
62
+ return res.text
63
+
64
+ class RenderScreenshotTool(BaseTool):
65
+ name: str = "render_screenshot"
66
+ description: str = "Captures full-page rendered screenshot image data from target URL ($0.01 USDC)."
67
+
68
+ def _run(self, url: str) -> str:
69
+ res = requests.post(f"{BASE_URL}/tools/render-screenshot", json={"url": url})
70
+ return res.text
71
+
72
+ class ExtractJsonTool(BaseTool):
73
+ name: str = "extract_json"
74
+ description: str = "Extracts structured JSON schema data from web page HTML content ($0.01 USDC)."
75
+
76
+ def _run(self, url: str, schema: Optional[Dict[str, Any]] = None) -> str:
77
+ payload = {"url": url, "schema": schema or {}}
78
+ res = requests.post(f"{BASE_URL}/tools/extract-json", json=payload)
79
+ return res.text
80
+
81
+ class SmartContractVerifierTool(BaseTool):
82
+ name: str = "smart_contract_verifier"
83
+ description: str = "Source code analysis, bytecode validation, ABI fetching, and proxy detection on Basescan ($0.02 USDC)."
84
+
85
+ def _run(self, address: str) -> str:
86
+ res = requests.post(f"{BASE_URL}/tools/smart-contract-verifier", json={"address": address})
87
+ return res.text
88
+
89
+ class AerodromeYieldsTool(BaseTool):
90
+ name: str = "get_aerodrome_yields"
91
+ description: str = "Fetches top live Aerodrome DEX yield pools, APYs, and TVL on Base Mainnet ($0.003 USDC)."
92
+
93
+ def _run(self) -> str:
94
+ res = requests.get(f"{BASE_URL}/tools/aerodrome-yields")
95
+ return res.text
96
+
97
+ class AerodromeSwapTool(BaseTool):
98
+ name: str = "aerodrome_swap"
99
+ description: str = "Executes low-slippage token swaps directly via Aerodrome Finance Router on Base ($0.01 USDC)."
100
+
101
+ def _run(self, tokenIn: str, tokenOut: str, amountIn: str, decimalsIn: int, isStable: bool) -> str:
102
+ payload = {
103
+ "tokenIn": tokenIn, "tokenOut": tokenOut,
104
+ "amountIn": amountIn, "decimalsIn": decimalsIn, "isStable": isStable
105
+ }
106
+ res = requests.post(f"{BASE_URL}/tools/aerodrome-swap", json=payload)
107
+ return res.text
108
+
109
+ class AerodromeClammTool(BaseTool):
110
+ name: str = "aerodrome_clamm"
111
+ description: str = "Open, adjust, and rebalance concentrated liquidity ranges on Aerodrome Slipstream ($0.01 USDC)."
112
+
113
+ def _run(self, action: str, token0: Optional[str] = None, token1: Optional[str] = None,
114
+ tickLower: Optional[int] = None, tickUpper: Optional[int] = None,
115
+ amount0Desired: Optional[str] = None, amount1Desired: Optional[str] = None,
116
+ tokenId: Optional[str] = None) -> str:
117
+ payload = {
118
+ "action": action, "token0": token0, "token1": token1,
119
+ "tickLower": tickLower, "tickUpper": tickUpper,
120
+ "amount0Desired": amount0Desired, "amount1Desired": amount1Desired, "tokenId": tokenId
121
+ }
122
+ res = requests.post(f"{BASE_URL}/tools/aerodrome-clamm", json=payload)
123
+ return res.text
124
+
125
+ class AerodromeVeaeroTool(BaseTool):
126
+ name: str = "aerodrome_veaero"
127
+ description: str = "Automates $AERO locking, epoch gauge voting, and bribe reward harvesting on Aerodrome ($0.01 USDC)."
128
+
129
+ def _run(self, action: str, amount: Optional[str] = None, lockDurationWeeks: Optional[int] = None,
130
+ tokenId: Optional[str] = None, poolVoteAddresses: Optional[list] = None) -> str:
131
+ payload = {
132
+ "action": action, "amount": amount, "lockDurationWeeks": lockDurationWeeks,
133
+ "tokenId": tokenId, "poolVoteAddresses": poolVoteAddresses
134
+ }
135
+ res = requests.post(f"{BASE_URL}/tools/aerodrome-veaero", json=payload)
136
+ return res.text
137
+
138
+ class DeployBaseContractTool(BaseTool):
139
+ name: str = "deploy_contract"
140
+ description: str = "Programmatically deploys custom Escrow, Bounty, or Subscription contracts to Base Mainnet ($5.00 USDC)."
141
+
142
+ def _run(self, contractType: str = "escrow") -> str:
143
+ res = requests.post(f"{BASE_URL}/tools/deploy-contract", json={"contractType": contractType})
144
+ return res.text
145
+
146
+ class DeploySolanaContractTool(BaseTool):
147
+ name: str = "deploy_solana_contract"
148
+ description: str = "Initializes SPL Escrows, cNFT Badge Issuers, or Raydium Vaults on Solana Mainnet ($5.00 USDC)."
149
+
150
+ def _run(self, contractType: str, params: Dict[str, Any]) -> str:
151
+ payload = {"contractType": contractType, "params": params}
152
+ res = requests.post(f"{BASE_URL}/tools/deploy-solana-contract", json=payload)
153
+ return res.text
154
+
155
+ class DeployArcContractTool(BaseTool):
156
+ name: str = "deploy_arc_contract"
157
+ description: str = "Programmatically deploys custom Escrow, Bounty, or Agent contracts directly to Arc Mainnet ($5.00 USDC)."
158
+
159
+ def _run(self, contractType: str = "escrow") -> str:
160
+ res = requests.post(f"{BASE_URL}/tools/deploy-arc-contract", json={"contractType": contractType})
161
+ return res.text
162
+
163
+ class ArcCctpBridgeTool(BaseTool):
164
+ name: str = "arc_cctp_bridge"
165
+ description: str = "Bridges USDC cross-chain from Arc Mainnet via Circle CCTP V2 ($0.25 USDC)."
166
+
167
+ def _run(self, amountUsdc: str, destinationChain: str, recipientAddress: str) -> str:
168
+ payload = {
169
+ "amountUsdc": amountUsdc, "destinationChain": destinationChain, "recipientAddress": recipientAddress
170
+ }
171
+ res = requests.post(f"{BASE_URL}/tools/arc-cctp-bridge", json=payload)
172
+ return res.text
173
+
174
+ class PublicDataFeedTool(BaseTool):
175
+ name: str = "public_data_feed"
176
+ description: str = "Retrieves signed attestation JSON payloads from the public data feed ($0.0001 USDC)."
177
+
178
+ def _run(self, filename: str) -> str:
179
+ res = requests.get(f"https://api.warppay402.com/public_data_feed/{filename}")
180
+ return res.text
181
+
182
+ class DataFeedsTool(BaseTool):
183
+ name: str = "data_feeds"
184
+ description: str = "Fetches pre-scraped market data feeds and yield reports ($0.001 USDC)."
185
+
186
+ def _run(self, feedId: str) -> str:
187
+ res = requests.get(f"{BASE_URL}/feeds/{feedId}")
188
+ return res.text
189
+
190
+ class RealEstateCalculatorTool(BaseTool):
191
+ name: str = "real_estate_calculator"
192
+ description: str = "Calculates NOI, Cap Rate, Monthly Cash Flow, and DSCR for real estate deals ($0.0005 USDC)."
193
+
194
+ def _run(self, purchasePrice: float, monthlyRent: float, annualTaxes: Optional[float] = None,
195
+ annualInsurance: Optional[float] = None, interestRate: float = 6.5, downPaymentPct: float = 20.0) -> str:
196
+ payload = {
197
+ "purchasePrice": purchasePrice,
198
+ "monthlyRent": monthlyRent,
199
+ "annualTaxes": annualTaxes,
200
+ "annualInsurance": annualInsurance,
201
+ "interestRate": interestRate,
202
+ "downPaymentPct": downPaymentPct,
203
+ }
204
+ res = requests.post(f"{BASE_URL}/tools/real-estate-calculator", json=payload)
205
+ return res.text
206
+
207
+ class AddressNormalizerTool(BaseTool):
208
+ name: str = "address_normalizer"
209
+ description: str = "Standardizes informal address queries and resolves lat/lon coordinates ($0.001 USDC)."
210
+
211
+ def _run(self, address: str) -> str:
212
+ res = requests.post(f"{BASE_URL}/tools/address-normalizer", json={"address": address})
213
+ return res.text
214
+
215
+ class WeatherOracleTool(BaseTool):
216
+ name: str = "weather_oracle"
217
+ description: str = "Fetches live atmospheric conditions, wind speed, visibility, and flight safety clearances ($0.001 USDC)."
218
+
219
+ def _run(self, latitude: float, longitude: float) -> str:
220
+ payload = {"latitude": latitude, "longitude": longitude}
221
+ res = requests.post(f"{BASE_URL}/tools/weather-oracle", json=payload)
222
+ return res.text
223
+
224
+ class ForexOracleTool(BaseTool):
225
+ name: str = "forex_oracle"
226
+ description: str = "Resolves real-time global foreign exchange fiat rates ($0.0005 USDC)."
227
+
228
+ def _run(self, baseCurrency: str = "USD") -> str:
229
+ res = requests.post(f"{BASE_URL}/tools/forex-oracle", json={"baseCurrency": baseCurrency})
230
+ return res.text
231
+
232
+ class ShippingRateEstimatorTool(BaseTool):
233
+ name: str = "shipping_rate_estimator"
234
+ description: str = "Calculates ground, priority, and express shipping rates for e-commerce ($0.001 USDC)."
235
+
236
+ def _run(self, weightLbs: float, originZip: str, destinationZip: str) -> str:
237
+ payload = {"weightLbs": weightLbs, "originZip": originZip, "destinationZip": destinationZip}
238
+ res = requests.post(f"{BASE_URL}/tools/shipping-rate-estimator", json=payload)
239
+ return res.text
240
+
241
+ class GithubHealthAnalyzerTool(BaseTool):
242
+ name: str = "github_health_analyzer"
243
+ description: str = "Queries public GitHub repo stars, open issues, licenses, and push activity ($0.002 USDC)."
244
+
245
+ def _run(self, repository: str) -> str:
246
+ res = requests.post(f"{BASE_URL}/tools/github-health-analyzer", json={"repository": repository})
247
+ return res.text
248
+
249
+ class PropertyCompsEstimatorTool(BaseTool):
250
+ name: str = "property_comps_estimator"
251
+ description: str = "Generates market valuations, price-per-sqft comps, and annual tax estimates ($0.005 USDC)."
252
+
253
+ def _run(self, squareFeet: float, bedrooms: int, zipCode: str) -> str:
254
+ payload = {"squareFeet": squareFeet, "bedrooms": bedrooms, "zipCode": zipCode}
255
+ res = requests.post(f"{BASE_URL}/tools/property-comps-estimator", json=payload)
256
+ return res.text
257
+
258
+ class OutageOracleTool(BaseTool):
259
+ name: str = "outage_oracle"
260
+ description: str = "Resolves real-time power grid, ISP broadband, and cellular network outages by ZIP code ($0.002 USDC)."
261
+
262
+ def _run(self, zipCode: str, state: Optional[str] = None, serviceType: str = "all") -> str:
263
+ payload = {"zipCode": zipCode, "state": state, "serviceType": serviceType}
264
+ res = requests.post(f"{BASE_URL}/tools/outage-oracle", json=payload)
265
+ return res.text
266
+
267
+ class UcpDealsOracleTool(BaseTool):
268
+ name: str = "ucp_deals_oracle"
269
+ description: str = "Aggregates UCP merchant catalogs, pricing, stock availability, and instant checkout URLs ($0.001 USDC)."
270
+
271
+ def _run(self, query: str, maxPriceUSD: Optional[float] = None, inStockOnly: bool = True) -> str:
272
+ payload = {"query": query, "maxPriceUSD": maxPriceUSD, "inStockOnly": inStockOnly}
273
+ res = requests.post(f"{BASE_URL}/ucp/search", json=payload)
274
+ return res.text
275
+ class DefiExecutorAgentTool(BaseTool):
276
+ name: str = "warppay_defi_executor"
277
+ description: str = "Autonomous DeFi due-diligence and quote agent orchestrating wallet/contract audits, Aerodrome pool yields, and swap simulation from a single goal ($0.15 USDC)."
278
+
279
+ def _run(self, goal: str) -> str:
280
+ res = requests.post(f"{BASE_URL}/agents/defi-executor", json={"goal": goal})
281
+ return res.text
282
+
283
+ class DeepResearchAgentTool(BaseTool):
284
+ name: str = "warppay_deep_research"
285
+ description: str = "Parallel web scraping, UCP merchant catalog search, and forex spot rate synthesis agent from a single goal ($0.05 USDC)."
286
+
287
+ def _run(self, goal: str) -> str:
288
+ res = requests.post(f"{BASE_URL}/agents/deep-research", json={"goal": goal})
289
+ return res.text