astrbotmcp 0.2.7__tar.gz → 0.2.8__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.
- {astrbotmcp-0.2.7/astrbotmcp.egg-info → astrbotmcp-0.2.8}/PKG-INFO +32 -1
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/README.md +31 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/astrbot_client.py +28 -8
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/config.py +8 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8/astrbotmcp.egg-info}/PKG-INFO +32 -1
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/pyproject.toml +1 -1
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/LICENSE.txt +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/__init__.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/server.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/__init__.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/config_search_tool.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/config_tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/control_tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/helpers.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/log_tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/message_tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/platform_tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/plugin_market_tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/session_tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools/types.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbot_mcp/tools.py +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbotmcp.egg-info/SOURCES.txt +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbotmcp.egg-info/dependency_links.txt +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbotmcp.egg-info/entry_points.txt +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbotmcp.egg-info/requires.txt +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/astrbotmcp.egg-info/top_level.txt +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/setup.cfg +0 -0
- {astrbotmcp-0.2.7 → astrbotmcp-0.2.8}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astrbotmcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -93,6 +93,37 @@ uv add astrbotmcp
|
|
|
93
93
|
| `ASTRBOT_USERNAME` | Dashboard 用户名 | - |
|
|
94
94
|
| `ASTRBOT_PASSWORD` | Dashboard 密码 | - |
|
|
95
95
|
| `ASTRBOT_LOG_LEVEL` | 日志级别 | `INFO` |
|
|
96
|
+
| `ASTRBOTMCP_DISABLE_PROXY` | 是否禁用代理(防止本地请求被代理拦截) | `true` |
|
|
97
|
+
|
|
98
|
+
#### 代理配置说明
|
|
99
|
+
|
|
100
|
+
如果你在使用代理工具(如 Clash、V2Ray 等),可能会遇到 502 Bad Gateway 错误,这是因为本地请求被代理拦截导致的。
|
|
101
|
+
|
|
102
|
+
**解决方案:**
|
|
103
|
+
|
|
104
|
+
1. **默认行为**:AstrBot MCP 默认禁用代理(`ASTRBOTMCP_DISABLE_PROXY=true`),确保本地请求直接发送到 AstrBot。
|
|
105
|
+
|
|
106
|
+
2. **如果需要使用代理**:设置 `ASTRBOTMCP_DISABLE_PROXY=false`,但请注意这可能导致本地 API 请求失败。
|
|
107
|
+
|
|
108
|
+
3. **推荐配置**:对于本地 AstrBot 实例,始终禁用代理:
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"astrbot-mcp": {
|
|
113
|
+
"command": "uvx",
|
|
114
|
+
"args": [
|
|
115
|
+
"--from",
|
|
116
|
+
"astrbotmcp",
|
|
117
|
+
"astrbot-mcp"
|
|
118
|
+
],
|
|
119
|
+
"env": {
|
|
120
|
+
"ASTRBOT_BASE_URL": "http://127.0.0.1:6185",
|
|
121
|
+
"ASTRBOTMCP_DISABLE_PROXY": "true"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
96
127
|
|
|
97
128
|
---
|
|
98
129
|
|
|
@@ -79,6 +79,37 @@ uv add astrbotmcp
|
|
|
79
79
|
| `ASTRBOT_USERNAME` | Dashboard 用户名 | - |
|
|
80
80
|
| `ASTRBOT_PASSWORD` | Dashboard 密码 | - |
|
|
81
81
|
| `ASTRBOT_LOG_LEVEL` | 日志级别 | `INFO` |
|
|
82
|
+
| `ASTRBOTMCP_DISABLE_PROXY` | 是否禁用代理(防止本地请求被代理拦截) | `true` |
|
|
83
|
+
|
|
84
|
+
#### 代理配置说明
|
|
85
|
+
|
|
86
|
+
如果你在使用代理工具(如 Clash、V2Ray 等),可能会遇到 502 Bad Gateway 错误,这是因为本地请求被代理拦截导致的。
|
|
87
|
+
|
|
88
|
+
**解决方案:**
|
|
89
|
+
|
|
90
|
+
1. **默认行为**:AstrBot MCP 默认禁用代理(`ASTRBOTMCP_DISABLE_PROXY=true`),确保本地请求直接发送到 AstrBot。
|
|
91
|
+
|
|
92
|
+
2. **如果需要使用代理**:设置 `ASTRBOTMCP_DISABLE_PROXY=false`,但请注意这可能导致本地 API 请求失败。
|
|
93
|
+
|
|
94
|
+
3. **推荐配置**:对于本地 AstrBot 实例,始终禁用代理:
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"mcpServers": {
|
|
98
|
+
"astrbot-mcp": {
|
|
99
|
+
"command": "uvx",
|
|
100
|
+
"args": [
|
|
101
|
+
"--from",
|
|
102
|
+
"astrbotmcp",
|
|
103
|
+
"astrbot-mcp"
|
|
104
|
+
],
|
|
105
|
+
"env": {
|
|
106
|
+
"ASTRBOT_BASE_URL": "http://127.0.0.1:6185",
|
|
107
|
+
"ASTRBOTMCP_DISABLE_PROXY": "true"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
82
113
|
|
|
83
114
|
---
|
|
84
115
|
|
|
@@ -98,7 +98,11 @@ class AstrBotClient:
|
|
|
98
98
|
pwd = hashlib.md5(pwd.encode("utf-8")).hexdigest()
|
|
99
99
|
|
|
100
100
|
url = f"{self.base_url}/api/auth/login"
|
|
101
|
-
|
|
101
|
+
client_kwargs = {"timeout": self.timeout}
|
|
102
|
+
if self.settings.disable_proxy:
|
|
103
|
+
client_kwargs["trust_env"] = False # 禁用代理,忽略环境变量设置
|
|
104
|
+
|
|
105
|
+
async with httpx.AsyncClient(**client_kwargs) as client:
|
|
102
106
|
resp = await client.post(
|
|
103
107
|
url,
|
|
104
108
|
json={"username": username, "password": pwd},
|
|
@@ -142,7 +146,11 @@ class AstrBotClient:
|
|
|
142
146
|
auth_headers = await self._get_auth_headers()
|
|
143
147
|
headers = {**headers, **auth_headers}
|
|
144
148
|
|
|
145
|
-
|
|
149
|
+
client_kwargs = {"timeout": self.timeout}
|
|
150
|
+
if self.settings.disable_proxy:
|
|
151
|
+
client_kwargs["trust_env"] = False # 禁用代理,忽略环境变量设置
|
|
152
|
+
|
|
153
|
+
async with httpx.AsyncClient(**client_kwargs) as client:
|
|
146
154
|
if stream:
|
|
147
155
|
return await client.build_request(method, url, params=params, json=json_body, files=files) # type: ignore[return-value]
|
|
148
156
|
response = await client.request(
|
|
@@ -181,7 +189,11 @@ class AstrBotClient:
|
|
|
181
189
|
|
|
182
190
|
headers = await self._get_auth_headers()
|
|
183
191
|
|
|
184
|
-
|
|
192
|
+
client_kwargs = {"timeout": self.timeout}
|
|
193
|
+
if self.settings.disable_proxy:
|
|
194
|
+
client_kwargs["trust_env"] = False # 禁用代理,忽略环境变量设置
|
|
195
|
+
|
|
196
|
+
async with httpx.AsyncClient(**client_kwargs) as client:
|
|
185
197
|
async with client.stream(
|
|
186
198
|
method,
|
|
187
199
|
url,
|
|
@@ -451,7 +463,11 @@ class AstrBotClient:
|
|
|
451
463
|
}
|
|
452
464
|
url = f"{self.base_url}/api/chat/post_file"
|
|
453
465
|
headers = await self._get_auth_headers()
|
|
454
|
-
|
|
466
|
+
client_kwargs = {"timeout": self.timeout}
|
|
467
|
+
if self.settings.disable_proxy:
|
|
468
|
+
client_kwargs["trust_env"] = False # 禁用代理,忽略环境变量设置
|
|
469
|
+
|
|
470
|
+
async with httpx.AsyncClient(**client_kwargs) as client:
|
|
455
471
|
response = await client.post(url, files=files, headers=headers)
|
|
456
472
|
response.raise_for_status()
|
|
457
473
|
return response.json()
|
|
@@ -471,10 +487,14 @@ class AstrBotClient:
|
|
|
471
487
|
"""
|
|
472
488
|
temp_path: str | None = None
|
|
473
489
|
try:
|
|
474
|
-
|
|
475
|
-
timeout
|
|
476
|
-
follow_redirects
|
|
477
|
-
|
|
490
|
+
client_kwargs = {
|
|
491
|
+
"timeout": self.timeout,
|
|
492
|
+
"follow_redirects": True
|
|
493
|
+
}
|
|
494
|
+
if self.settings.disable_proxy:
|
|
495
|
+
client_kwargs["trust_env"] = False # 禁用代理,忽略环境变量设置
|
|
496
|
+
|
|
497
|
+
async with httpx.AsyncClient(**client_kwargs) as http_client:
|
|
478
498
|
async with http_client.stream("GET", url) as response:
|
|
479
499
|
response.raise_for_status()
|
|
480
500
|
|
|
@@ -16,6 +16,7 @@ class AstrBotSettings:
|
|
|
16
16
|
default_model: str | None = None
|
|
17
17
|
file_root: str | None = None
|
|
18
18
|
direct_media_mode: str | None = None
|
|
19
|
+
disable_proxy: bool = True # 默认禁用代理,防止本地请求被代理拦截
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
def _get_env(name: str) -> str | None:
|
|
@@ -72,6 +73,12 @@ def get_settings() -> AstrBotSettings:
|
|
|
72
73
|
"ASTRBOT_MCP_DIRECT_MEDIA_MODE"
|
|
73
74
|
)
|
|
74
75
|
|
|
76
|
+
# 默认禁用代理,除非明确设置为false
|
|
77
|
+
disable_proxy_str = _get_env("ASTRBOTMCP_DISABLE_PROXY")
|
|
78
|
+
disable_proxy = True # 默认值
|
|
79
|
+
if disable_proxy_str is not None:
|
|
80
|
+
disable_proxy = disable_proxy_str.lower() not in ("false", "0", "no", "n")
|
|
81
|
+
|
|
75
82
|
return AstrBotSettings(
|
|
76
83
|
base_url=base_url,
|
|
77
84
|
timeout=timeout,
|
|
@@ -81,4 +88,5 @@ def get_settings() -> AstrBotSettings:
|
|
|
81
88
|
default_model=default_model,
|
|
82
89
|
file_root=file_root,
|
|
83
90
|
direct_media_mode=direct_media_mode,
|
|
91
|
+
disable_proxy=disable_proxy,
|
|
84
92
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astrbotmcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -93,6 +93,37 @@ uv add astrbotmcp
|
|
|
93
93
|
| `ASTRBOT_USERNAME` | Dashboard 用户名 | - |
|
|
94
94
|
| `ASTRBOT_PASSWORD` | Dashboard 密码 | - |
|
|
95
95
|
| `ASTRBOT_LOG_LEVEL` | 日志级别 | `INFO` |
|
|
96
|
+
| `ASTRBOTMCP_DISABLE_PROXY` | 是否禁用代理(防止本地请求被代理拦截) | `true` |
|
|
97
|
+
|
|
98
|
+
#### 代理配置说明
|
|
99
|
+
|
|
100
|
+
如果你在使用代理工具(如 Clash、V2Ray 等),可能会遇到 502 Bad Gateway 错误,这是因为本地请求被代理拦截导致的。
|
|
101
|
+
|
|
102
|
+
**解决方案:**
|
|
103
|
+
|
|
104
|
+
1. **默认行为**:AstrBot MCP 默认禁用代理(`ASTRBOTMCP_DISABLE_PROXY=true`),确保本地请求直接发送到 AstrBot。
|
|
105
|
+
|
|
106
|
+
2. **如果需要使用代理**:设置 `ASTRBOTMCP_DISABLE_PROXY=false`,但请注意这可能导致本地 API 请求失败。
|
|
107
|
+
|
|
108
|
+
3. **推荐配置**:对于本地 AstrBot 实例,始终禁用代理:
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"astrbot-mcp": {
|
|
113
|
+
"command": "uvx",
|
|
114
|
+
"args": [
|
|
115
|
+
"--from",
|
|
116
|
+
"astrbotmcp",
|
|
117
|
+
"astrbot-mcp"
|
|
118
|
+
],
|
|
119
|
+
"env": {
|
|
120
|
+
"ASTRBOT_BASE_URL": "http://127.0.0.1:6185",
|
|
121
|
+
"ASTRBOTMCP_DISABLE_PROXY": "true"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
96
127
|
|
|
97
128
|
---
|
|
98
129
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|