mcp-server-agentpay 0.1.0__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.
- mcp_server_agentpay-0.1.0/.gitignore +15 -0
- mcp_server_agentpay-0.1.0/LICENSE +21 -0
- mcp_server_agentpay-0.1.0/PKG-INFO +206 -0
- mcp_server_agentpay-0.1.0/README.md +160 -0
- mcp_server_agentpay-0.1.0/pyproject.toml +81 -0
- mcp_server_agentpay-0.1.0/server.json +63 -0
- mcp_server_agentpay-0.1.0/src/agentpay/__init__.py +3 -0
- mcp_server_agentpay-0.1.0/src/agentpay/client/__init__.py +0 -0
- mcp_server_agentpay-0.1.0/src/agentpay/client/http_client.py +208 -0
- mcp_server_agentpay-0.1.0/src/agentpay/config.py +68 -0
- mcp_server_agentpay-0.1.0/src/agentpay/gateway/__init__.py +0 -0
- mcp_server_agentpay-0.1.0/src/agentpay/gateway/app.py +207 -0
- mcp_server_agentpay-0.1.0/src/agentpay/gateway/data.py +65 -0
- mcp_server_agentpay-0.1.0/src/agentpay/gateway/middleware.py +53 -0
- mcp_server_agentpay-0.1.0/src/agentpay/mcp_server/__init__.py +0 -0
- mcp_server_agentpay-0.1.0/src/agentpay/mcp_server/server.py +154 -0
- mcp_server_agentpay-0.1.0/src/agentpay/payment/__init__.py +0 -0
- mcp_server_agentpay-0.1.0/src/agentpay/payment/verifier.py +222 -0
- mcp_server_agentpay-0.1.0/src/agentpay/payment/x402_setup.py +170 -0
- mcp_server_agentpay-0.1.0/src/agentpay/xhs/__init__.py +5 -0
- mcp_server_agentpay-0.1.0/src/agentpay/xhs/dataflow.py +214 -0
- mcp_server_agentpay-0.1.0/src/agentpay/xhs/fetcher.py +263 -0
- mcp_server_agentpay-0.1.0/src/agentpay/xhs/normalize.py +245 -0
- mcp_server_agentpay-0.1.0/src/agentpay/xhs/tikhub.py +112 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AgentPay Contributors
|
|
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.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mcp-server-agentpay
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for x402 micropayments — query paid APIs with autonomous USDC payments on Base
|
|
5
|
+
Project-URL: Homepage, https://github.com/yyxqqq777/mcp-server-agentpay
|
|
6
|
+
Project-URL: Repository, https://github.com/yyxqqq777/mcp-server-agentpay
|
|
7
|
+
Project-URL: Documentation, https://github.com/yyxqqq777/mcp-server-agentpay#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/yyxqqq777/mcp-server-agentpay/issues
|
|
9
|
+
Author-email: yyx <yunxuan517@gmail.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agents,base,mcp,micropayments,model-context-protocol,usdc,x402
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: eth-account>=0.13.0
|
|
23
|
+
Requires-Dist: httpx>=0.28.0
|
|
24
|
+
Requires-Dist: mcp>=1.0.0
|
|
25
|
+
Requires-Dist: pydantic-settings>=2.6.0
|
|
26
|
+
Requires-Dist: pydantic>=2.10.0
|
|
27
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: uvicorn[standard]>=0.32.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: web3>=7.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: x402[evm,fastapi,httpx]>=2.0.0; extra == 'dev'
|
|
36
|
+
Provides-Extra: gateway
|
|
37
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'gateway'
|
|
38
|
+
Requires-Dist: uvicorn[standard]>=0.32.0; extra == 'gateway'
|
|
39
|
+
Requires-Dist: web3>=7.0.0; extra == 'gateway'
|
|
40
|
+
Requires-Dist: x402[evm,fastapi,httpx]>=2.0.0; extra == 'gateway'
|
|
41
|
+
Provides-Extra: wallet
|
|
42
|
+
Requires-Dist: web3>=7.0.0; extra == 'wallet'
|
|
43
|
+
Provides-Extra: x402
|
|
44
|
+
Requires-Dist: x402[evm,fastapi,httpx]>=2.0.0; extra == 'x402'
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# AgentPay MCP Server
|
|
48
|
+
|
|
49
|
+
**Agent-to-Agent micropayments via x402 + MCP** — let AI agents autonomously pay for API access with USDC on Base.
|
|
50
|
+
|
|
51
|
+
<!-- mcp-name: io.github.yyxqqq777/agentpay -->
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
### Option A — Remote MCP(推荐,无需本地安装)
|
|
56
|
+
|
|
57
|
+
在 Cursor / Claude / 任意支持 Streamable HTTP 的客户端添加:
|
|
58
|
+
|
|
59
|
+
`https://agentpay-xhs-production.up.railway.app/mcp`
|
|
60
|
+
|
|
61
|
+
官方 Registry 条目:`io.github.yyxqqq777/agentpay`
|
|
62
|
+
|
|
63
|
+
### Option B — 本地 stdio(`uvx` / PyPI)
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"agentpay": {
|
|
69
|
+
"command": "uvx",
|
|
70
|
+
"args": ["mcp-server-agentpay"],
|
|
71
|
+
"env": {
|
|
72
|
+
"GATEWAY_BASE_URL": "https://agentpay-xhs-production.up.railway.app",
|
|
73
|
+
"AGENT_PRIVATE_KEY": "0xYourAgentPrivateKey",
|
|
74
|
+
"MAX_SPEND_PER_CALL": "0.10",
|
|
75
|
+
"PYTHONUNBUFFERED": "1"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
或永久安装:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install mcp-server-agentpay
|
|
86
|
+
# or
|
|
87
|
+
uv tool install mcp-server-agentpay
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Tools
|
|
91
|
+
|
|
92
|
+
| Tool | Description | Cost |
|
|
93
|
+
|------|-------------|------|
|
|
94
|
+
| `xhs_get_note_detail` | Xiaohongshu note detail | 0.01 USDC/call |
|
|
95
|
+
| `xhs_get_user_notes` | Xiaohongshu user posted notes list | 0.01 USDC/call |
|
|
96
|
+
| `china_wholesale_pricing_query` | Factory-direct wholesale pricing (1688/Yiwu) | 0.01 USDC/call |
|
|
97
|
+
| `agentpay_payment_status` | View payment config, wallet, and spending limits | Free |
|
|
98
|
+
|
|
99
|
+
### Example prompts
|
|
100
|
+
|
|
101
|
+
- "帮我看看这条小红书笔记写了什么:https://www.xiaohongshu.com/explore/..."
|
|
102
|
+
- "拉一下这个博主最近发的笔记,user_id=..."
|
|
103
|
+
- "Search wholesale prices for wireless earbuds under $3"
|
|
104
|
+
- "What's my AgentPay wallet and spending limit?"
|
|
105
|
+
|
|
106
|
+
## Agent Skill(可发布 · agentskills.io)
|
|
107
|
+
|
|
108
|
+
符合 [Agent Skills](https://agentskills.io)。对外只暴露 **AgentPay 付费小红书接口**,Agent 不知道、也不应调用任何上游爬虫:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Agent / MCP --(x402 0.01 USDC)--> AgentPay Gateway --> 笔记 JSON
|
|
112
|
+
收款: 你的 Base 钱包
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx skills-ref validate ./skills/xhs-note-fetch
|
|
117
|
+
|
|
118
|
+
# 本地:Gateway 持有上游密钥;Agent 侧只配 GATEWAY_BASE_URL
|
|
119
|
+
PYTHONPATH=src python -m agentpay.gateway.app
|
|
120
|
+
GATEWAY_BASE_URL=http://127.0.0.1:8402 \
|
|
121
|
+
python skills/xhs-note-fetch/scripts/fetch_note.py "<笔记链接>"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
发布 `skills/xhs-note-fetch` 即可。上游密钥只写在 Gateway 部署环境。
|
|
125
|
+
|
|
126
|
+
## Environment Variables
|
|
127
|
+
|
|
128
|
+
| Variable | Required | Description |
|
|
129
|
+
|----------|----------|-------------|
|
|
130
|
+
| `GATEWAY_BASE_URL` | MCP / Skill | AgentPay 网关地址 |
|
|
131
|
+
| `AGENT_PRIVATE_KEY` | Production | 付款钱包私钥 |
|
|
132
|
+
| `MAX_SPEND_PER_CALL` | No | 单次上限(默认 `0.10`) |
|
|
133
|
+
| `PAYMENT_MODE` | Gateway | `demo` 或 `production` |
|
|
134
|
+
| `DATAFLOW_API_TOKEN` / `TIKHUB_API_KEY` | **仅 Gateway 部署** | 上游数据源(不对 Agent 暴露) |
|
|
135
|
+
|
|
136
|
+
## How it works
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
MCP Client → mcp-server-agentpay → x402 Gateway → Paid API
|
|
140
|
+
(auto 402 → sign → retry) (verify USDC)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
1. Tool call hits a paid API endpoint
|
|
144
|
+
2. Gateway returns `402 Payment Required` with USDC payment details
|
|
145
|
+
3. MCP server signs payment and retries automatically
|
|
146
|
+
4. JSON data flows back to the LLM
|
|
147
|
+
|
|
148
|
+
## Self-host the Gateway
|
|
149
|
+
|
|
150
|
+
If you operate the paid API, deploy the gateway separately:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pip install "mcp-server-agentpay[gateway]"
|
|
154
|
+
# .env: PAYMENT_MODE=production + upstream keys + your receive wallet
|
|
155
|
+
agentpay-gateway
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Real USDC settlement (x402)
|
|
159
|
+
|
|
160
|
+
| Mode | Behavior |
|
|
161
|
+
|------|----------|
|
|
162
|
+
| `PAYMENT_MODE=demo` | Local fake pay (dev only) |
|
|
163
|
+
| `PAYMENT_MODE=production` | Official Facilitator **verify + settle** on-chain |
|
|
164
|
+
|
|
165
|
+
**Testnet (Base Sepolia)** — use `https://x402.org/facilitator`, network `eip155:84532`.
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Fund a test agent with Sepolia USDC, then:
|
|
169
|
+
PYTHONPATH=src python scripts/test_x402_settlement.py
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Mainnet** — set `PAYMENT_NETWORK=eip155:8453` and a mainnet facilitator
|
|
173
|
+
(`https://api.cdp.coinbase.com/platform/v2/x402` or PayAI). USDC goes to `WALLET_RECIPIENT_ADDRESS`.
|
|
174
|
+
|
|
175
|
+
See [`.env.example`](.env.example).
|
|
176
|
+
|
|
177
|
+
## Publish to MCP Registry
|
|
178
|
+
|
|
179
|
+
This package is designed for the [official MCP Registry](https://registry.modelcontextprotocol.io).
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# 1. Publish to PyPI
|
|
183
|
+
pip install build twine
|
|
184
|
+
python -m build && twine upload dist/*
|
|
185
|
+
|
|
186
|
+
# 2. Publish to MCP Registry (packages + remotes)
|
|
187
|
+
./scripts/publish_all.sh
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Or create a GitHub Release (`v0.1.0`) — Actions uses Trusted Publishing to PyPI then updates the Registry.
|
|
191
|
+
|
|
192
|
+
Before publishing, update `server.json` and README `mcp-name` with your GitHub namespace (`io.github.<username>/agentpay`).
|
|
193
|
+
|
|
194
|
+
## Development
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
git clone https://github.com/yyxqqq777/mcp-server-agentpay
|
|
198
|
+
cd mcp-server-agentpay
|
|
199
|
+
python -m venv .venv && source .venv/bin/activate
|
|
200
|
+
pip install -e ".[dev]"
|
|
201
|
+
pytest tests/ -v
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
MIT
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# AgentPay MCP Server
|
|
2
|
+
|
|
3
|
+
**Agent-to-Agent micropayments via x402 + MCP** — let AI agents autonomously pay for API access with USDC on Base.
|
|
4
|
+
|
|
5
|
+
<!-- mcp-name: io.github.yyxqqq777/agentpay -->
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
### Option A — Remote MCP(推荐,无需本地安装)
|
|
10
|
+
|
|
11
|
+
在 Cursor / Claude / 任意支持 Streamable HTTP 的客户端添加:
|
|
12
|
+
|
|
13
|
+
`https://agentpay-xhs-production.up.railway.app/mcp`
|
|
14
|
+
|
|
15
|
+
官方 Registry 条目:`io.github.yyxqqq777/agentpay`
|
|
16
|
+
|
|
17
|
+
### Option B — 本地 stdio(`uvx` / PyPI)
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"agentpay": {
|
|
23
|
+
"command": "uvx",
|
|
24
|
+
"args": ["mcp-server-agentpay"],
|
|
25
|
+
"env": {
|
|
26
|
+
"GATEWAY_BASE_URL": "https://agentpay-xhs-production.up.railway.app",
|
|
27
|
+
"AGENT_PRIVATE_KEY": "0xYourAgentPrivateKey",
|
|
28
|
+
"MAX_SPEND_PER_CALL": "0.10",
|
|
29
|
+
"PYTHONUNBUFFERED": "1"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
或永久安装:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install mcp-server-agentpay
|
|
40
|
+
# or
|
|
41
|
+
uv tool install mcp-server-agentpay
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
| Tool | Description | Cost |
|
|
47
|
+
|------|-------------|------|
|
|
48
|
+
| `xhs_get_note_detail` | Xiaohongshu note detail | 0.01 USDC/call |
|
|
49
|
+
| `xhs_get_user_notes` | Xiaohongshu user posted notes list | 0.01 USDC/call |
|
|
50
|
+
| `china_wholesale_pricing_query` | Factory-direct wholesale pricing (1688/Yiwu) | 0.01 USDC/call |
|
|
51
|
+
| `agentpay_payment_status` | View payment config, wallet, and spending limits | Free |
|
|
52
|
+
|
|
53
|
+
### Example prompts
|
|
54
|
+
|
|
55
|
+
- "帮我看看这条小红书笔记写了什么:https://www.xiaohongshu.com/explore/..."
|
|
56
|
+
- "拉一下这个博主最近发的笔记,user_id=..."
|
|
57
|
+
- "Search wholesale prices for wireless earbuds under $3"
|
|
58
|
+
- "What's my AgentPay wallet and spending limit?"
|
|
59
|
+
|
|
60
|
+
## Agent Skill(可发布 · agentskills.io)
|
|
61
|
+
|
|
62
|
+
符合 [Agent Skills](https://agentskills.io)。对外只暴露 **AgentPay 付费小红书接口**,Agent 不知道、也不应调用任何上游爬虫:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Agent / MCP --(x402 0.01 USDC)--> AgentPay Gateway --> 笔记 JSON
|
|
66
|
+
收款: 你的 Base 钱包
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx skills-ref validate ./skills/xhs-note-fetch
|
|
71
|
+
|
|
72
|
+
# 本地:Gateway 持有上游密钥;Agent 侧只配 GATEWAY_BASE_URL
|
|
73
|
+
PYTHONPATH=src python -m agentpay.gateway.app
|
|
74
|
+
GATEWAY_BASE_URL=http://127.0.0.1:8402 \
|
|
75
|
+
python skills/xhs-note-fetch/scripts/fetch_note.py "<笔记链接>"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
发布 `skills/xhs-note-fetch` 即可。上游密钥只写在 Gateway 部署环境。
|
|
79
|
+
|
|
80
|
+
## Environment Variables
|
|
81
|
+
|
|
82
|
+
| Variable | Required | Description |
|
|
83
|
+
|----------|----------|-------------|
|
|
84
|
+
| `GATEWAY_BASE_URL` | MCP / Skill | AgentPay 网关地址 |
|
|
85
|
+
| `AGENT_PRIVATE_KEY` | Production | 付款钱包私钥 |
|
|
86
|
+
| `MAX_SPEND_PER_CALL` | No | 单次上限(默认 `0.10`) |
|
|
87
|
+
| `PAYMENT_MODE` | Gateway | `demo` 或 `production` |
|
|
88
|
+
| `DATAFLOW_API_TOKEN` / `TIKHUB_API_KEY` | **仅 Gateway 部署** | 上游数据源(不对 Agent 暴露) |
|
|
89
|
+
|
|
90
|
+
## How it works
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
MCP Client → mcp-server-agentpay → x402 Gateway → Paid API
|
|
94
|
+
(auto 402 → sign → retry) (verify USDC)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
1. Tool call hits a paid API endpoint
|
|
98
|
+
2. Gateway returns `402 Payment Required` with USDC payment details
|
|
99
|
+
3. MCP server signs payment and retries automatically
|
|
100
|
+
4. JSON data flows back to the LLM
|
|
101
|
+
|
|
102
|
+
## Self-host the Gateway
|
|
103
|
+
|
|
104
|
+
If you operate the paid API, deploy the gateway separately:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install "mcp-server-agentpay[gateway]"
|
|
108
|
+
# .env: PAYMENT_MODE=production + upstream keys + your receive wallet
|
|
109
|
+
agentpay-gateway
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Real USDC settlement (x402)
|
|
113
|
+
|
|
114
|
+
| Mode | Behavior |
|
|
115
|
+
|------|----------|
|
|
116
|
+
| `PAYMENT_MODE=demo` | Local fake pay (dev only) |
|
|
117
|
+
| `PAYMENT_MODE=production` | Official Facilitator **verify + settle** on-chain |
|
|
118
|
+
|
|
119
|
+
**Testnet (Base Sepolia)** — use `https://x402.org/facilitator`, network `eip155:84532`.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Fund a test agent with Sepolia USDC, then:
|
|
123
|
+
PYTHONPATH=src python scripts/test_x402_settlement.py
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Mainnet** — set `PAYMENT_NETWORK=eip155:8453` and a mainnet facilitator
|
|
127
|
+
(`https://api.cdp.coinbase.com/platform/v2/x402` or PayAI). USDC goes to `WALLET_RECIPIENT_ADDRESS`.
|
|
128
|
+
|
|
129
|
+
See [`.env.example`](.env.example).
|
|
130
|
+
|
|
131
|
+
## Publish to MCP Registry
|
|
132
|
+
|
|
133
|
+
This package is designed for the [official MCP Registry](https://registry.modelcontextprotocol.io).
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# 1. Publish to PyPI
|
|
137
|
+
pip install build twine
|
|
138
|
+
python -m build && twine upload dist/*
|
|
139
|
+
|
|
140
|
+
# 2. Publish to MCP Registry (packages + remotes)
|
|
141
|
+
./scripts/publish_all.sh
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Or create a GitHub Release (`v0.1.0`) — Actions uses Trusted Publishing to PyPI then updates the Registry.
|
|
145
|
+
|
|
146
|
+
Before publishing, update `server.json` and README `mcp-name` with your GitHub namespace (`io.github.<username>/agentpay`).
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
git clone https://github.com/yyxqqq777/mcp-server-agentpay
|
|
152
|
+
cd mcp-server-agentpay
|
|
153
|
+
python -m venv .venv && source .venv/bin/activate
|
|
154
|
+
pip install -e ".[dev]"
|
|
155
|
+
pytest tests/ -v
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-server-agentpay"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server for x402 micropayments — query paid APIs with autonomous USDC payments on Base"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
authors = [{ name = "yyx", email = "yunxuan517@gmail.com" }]
|
|
9
|
+
keywords = ["mcp", "x402", "micropayments", "agents", "usdc", "base", "model-context-protocol"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
dependencies = [
|
|
22
|
+
"mcp>=1.0.0",
|
|
23
|
+
"httpx>=0.28.0",
|
|
24
|
+
"pydantic>=2.10.0",
|
|
25
|
+
"pydantic-settings>=2.6.0",
|
|
26
|
+
"python-dotenv>=1.0.0",
|
|
27
|
+
"eth-account>=0.13.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
wallet = [
|
|
32
|
+
"web3>=7.0.0",
|
|
33
|
+
]
|
|
34
|
+
gateway = [
|
|
35
|
+
"fastapi>=0.115.0",
|
|
36
|
+
"uvicorn[standard]>=0.32.0",
|
|
37
|
+
"mcp-server-agentpay[wallet]",
|
|
38
|
+
"mcp-server-agentpay[x402]",
|
|
39
|
+
]
|
|
40
|
+
x402 = [
|
|
41
|
+
"x402[fastapi,httpx,evm]>=2.0.0",
|
|
42
|
+
]
|
|
43
|
+
dev = [
|
|
44
|
+
"pytest>=8.0.0",
|
|
45
|
+
"pytest-asyncio>=0.24.0",
|
|
46
|
+
"ruff>=0.8.0",
|
|
47
|
+
"mcp-server-agentpay[gateway,wallet,x402]",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
Homepage = "https://github.com/yyxqqq777/mcp-server-agentpay"
|
|
52
|
+
Repository = "https://github.com/yyxqqq777/mcp-server-agentpay"
|
|
53
|
+
Documentation = "https://github.com/yyxqqq777/mcp-server-agentpay#readme"
|
|
54
|
+
Issues = "https://github.com/yyxqqq777/mcp-server-agentpay/issues"
|
|
55
|
+
|
|
56
|
+
[project.scripts]
|
|
57
|
+
mcp-server-agentpay = "agentpay.mcp_server.server:main"
|
|
58
|
+
agentpay-gateway = "agentpay.gateway.app:main"
|
|
59
|
+
|
|
60
|
+
[build-system]
|
|
61
|
+
requires = ["hatchling"]
|
|
62
|
+
build-backend = "hatchling.build"
|
|
63
|
+
|
|
64
|
+
[tool.hatch.build.targets.wheel]
|
|
65
|
+
packages = ["src/agentpay"]
|
|
66
|
+
|
|
67
|
+
[tool.hatch.build.targets.sdist]
|
|
68
|
+
include = [
|
|
69
|
+
"/src",
|
|
70
|
+
"/README.md",
|
|
71
|
+
"/LICENSE",
|
|
72
|
+
"/server.json",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.pytest.ini_options]
|
|
76
|
+
asyncio_mode = "auto"
|
|
77
|
+
testpaths = ["tests"]
|
|
78
|
+
|
|
79
|
+
[tool.ruff]
|
|
80
|
+
line-length = 100
|
|
81
|
+
target-version = "py310"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.yyxqqq777/agentpay",
|
|
4
|
+
"title": "AgentPay",
|
|
5
|
+
"description": "x402 micropayments MCP: Xiaohongshu notes and paid APIs settled in USDC on Base.",
|
|
6
|
+
"websiteUrl": "https://github.com/yyxqqq777/mcp-server-agentpay",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/yyxqqq777/mcp-server-agentpay",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"id": "1357808114"
|
|
11
|
+
},
|
|
12
|
+
"version": "0.1.0",
|
|
13
|
+
"remotes": [
|
|
14
|
+
{
|
|
15
|
+
"type": "streamable-http",
|
|
16
|
+
"url": "https://agentpay-xhs-production.up.railway.app/mcp"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"packages": [
|
|
20
|
+
{
|
|
21
|
+
"registryType": "pypi",
|
|
22
|
+
"identifier": "mcp-server-agentpay",
|
|
23
|
+
"version": "0.1.0",
|
|
24
|
+
"transport": {
|
|
25
|
+
"type": "stdio"
|
|
26
|
+
},
|
|
27
|
+
"runtimeHint": "uvx",
|
|
28
|
+
"environmentVariables": [
|
|
29
|
+
{
|
|
30
|
+
"name": "GATEWAY_BASE_URL",
|
|
31
|
+
"description": "URL of the x402 payment gateway (e.g. https://agentpay-xhs-production.up.railway.app)",
|
|
32
|
+
"isRequired": true,
|
|
33
|
+
"format": "string",
|
|
34
|
+
"isSecret": false,
|
|
35
|
+
"default": "https://agentpay-xhs-production.up.railway.app"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "AGENT_PRIVATE_KEY",
|
|
39
|
+
"description": "EVM private key for signing USDC micropayments on Base",
|
|
40
|
+
"isRequired": false,
|
|
41
|
+
"format": "string",
|
|
42
|
+
"isSecret": true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "MAX_SPEND_PER_CALL",
|
|
46
|
+
"description": "Maximum USDC the agent may spend per API call (default: 0.10)",
|
|
47
|
+
"isRequired": false,
|
|
48
|
+
"format": "string",
|
|
49
|
+
"isSecret": false,
|
|
50
|
+
"default": "0.10"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "PAYMENT_MODE",
|
|
54
|
+
"description": "Payment verification mode: demo (no on-chain) or production",
|
|
55
|
+
"isRequired": false,
|
|
56
|
+
"format": "string",
|
|
57
|
+
"isSecret": false,
|
|
58
|
+
"default": "production"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
File without changes
|