fix: replace 'mcporter list' with 'mcporter config list' to prevent hangs
mcporter list probes all configured servers sequentially, which can hang indefinitely when servers are slow/offline. mcporter config list reads config without probing — sufficient for checking if a server is configured. Affected: doctor checks (4 channels) and install command (2 calls). Fixes #34
This commit is contained in:
@@ -29,7 +29,7 @@ class DouyinChannel(Channel):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["mcporter", "list"], capture_output=True, text=True, timeout=10
|
["mcporter", "config", "list"], capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if "douyin" not in r.stdout:
|
if "douyin" not in r.stdout:
|
||||||
return "off", (
|
return "off", (
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ExaSearchChannel(Channel):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["mcporter", "list"], capture_output=True, text=True, timeout=10
|
["mcporter", "config", "list"], capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if "exa" in r.stdout.lower():
|
if "exa" in r.stdout.lower():
|
||||||
return "ok", "全网语义搜索可用(免费,无需 API Key)"
|
return "ok", "全网语义搜索可用(免费,无需 API Key)"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class LinkedInChannel(Channel):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["mcporter", "list"], capture_output=True, text=True, timeout=10
|
["mcporter", "config", "list"], capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if "linkedin" in r.stdout.lower():
|
if "linkedin" in r.stdout.lower():
|
||||||
return "ok", "完整可用(Profile、公司、职位搜索)"
|
return "ok", "完整可用(Profile、公司、职位搜索)"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class XiaoHongShuChannel(Channel):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["mcporter", "list"], capture_output=True, text=True, timeout=10
|
["mcporter", "config", "list"], capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if "xiaohongshu" not in r.stdout:
|
if "xiaohongshu" not in r.stdout:
|
||||||
return "off", (
|
return "off", (
|
||||||
|
|||||||
+2
-2
@@ -453,7 +453,7 @@ def _install_mcporter():
|
|||||||
# Configure Exa MCP (free, no key needed)
|
# Configure Exa MCP (free, no key needed)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["mcporter", "list"], capture_output=True, text=True, timeout=10
|
["mcporter", "config", "list"], capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if "exa" not in r.stdout:
|
if "exa" not in r.stdout:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
@@ -469,7 +469,7 @@ def _install_mcporter():
|
|||||||
# Check XiaoHongShu MCP (only if server is running)
|
# Check XiaoHongShu MCP (only if server is running)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["mcporter", "list"], capture_output=True, text=True, timeout=10
|
["mcporter", "config", "list"], capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if "xiaohongshu" in r.stdout:
|
if "xiaohongshu" in r.stdout:
|
||||||
print(" ✅ XiaoHongShu MCP already configured")
|
print(" ✅ XiaoHongShu MCP already configured")
|
||||||
|
|||||||
Reference in New Issue
Block a user