Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -242,59 +242,6 @@ pip install --upgrade mcp
|
|||||||
|
|
||||||
The client retries up to 5 times with exponential backoff (1s, 2s, 4s, 8s, 16s, capped at 60s). If the server is fundamentally unreachable, it gives up after 5 attempts. Check the server process and network connectivity.
|
The client retries up to 5 times with exponential backoff (1s, 2s, 4s, 8s, 16s, capped at 60s). If the server is fundamentally unreachable, it gives up after 5 attempts. Check the server process and network connectivity.
|
||||||
|
|
||||||
### feishu-mcp causes EPIPE / "write EPIPE" errors in stdio mode
|
|
||||||
|
|
||||||
Many community MCP servers (e.g. `cso1z/Feishu-MCP`) emit console.log/warn output to stdout *before* the JSON-RPC handshake begins. This corrupts the stdio stream, causing `httpx.ReadError` on the Hermes side and EPIPE errors in the Node process.
|
|
||||||
|
|
||||||
**Symptoms:**
|
|
||||||
- `Error: write EPIPE` in the MCP server process
|
|
||||||
- `httpx.ReadError` or `Session termination failed: All connection attempts failed` in Hermes logs
|
|
||||||
- Tools register briefly then immediately fail on first use
|
|
||||||
|
|
||||||
**Solution — use HTTP transport instead of stdio:**
|
|
||||||
|
|
||||||
1. Run feishu-mcp as a persistent HTTP server behind a systemd service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install globally
|
|
||||||
npm install -g feishu-mcp
|
|
||||||
|
|
||||||
# Create systemd user service at ~/.config/systemd/user/feishu-mcp.service
|
|
||||||
[Unit]
|
|
||||||
Description=Feishu MCP Server
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
Restart=always
|
|
||||||
RestartSec=5
|
|
||||||
ExecStart=/root/.hermes/node/bin/node /root/.hermes/node/lib/node_modules/feishu-mcp/dist/index.js --log-level=none --feishu-app-id=YOUR_APP_ID --feishu-app-secret=YOUR_APP_SECRET --feishu-auth-type=tenant --enabled-modules=document,task
|
|
||||||
StandardOutput=null
|
|
||||||
StandardError=journal
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Reload and start the service:
|
|
||||||
```bash
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
systemctl --user enable --now feishu-mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Configure Hermes to connect via HTTP instead of stdio:
|
|
||||||
```yaml
|
|
||||||
mcp_servers:
|
|
||||||
feishu:
|
|
||||||
url: http://127.0.0.1:3333/mcp
|
|
||||||
timeout: 120
|
|
||||||
connect_timeout: 60
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Restart Hermes gateway: `hermes gateway restart`
|
|
||||||
|
|
||||||
5. Verify: `hermes mcp test feishu` — should show "✓ Connected" with tools listed.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Time Server (uvx)
|
### Time Server (uvx)
|
||||||
|
|||||||
28
sync.sh
28
sync.sh
@@ -1,19 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Hermes Sync Script - 真正的双向合并同步
|
|
||||||
set -e
|
set -e
|
||||||
|
SYNC_DIR="$HOME/.hermes-sync"
|
||||||
SYNC_DIR="${SYNC_DIR:-$HOME/.hermes-sync}"
|
HERMES_HOME="$HOME/.hermes"
|
||||||
HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}"
|
|
||||||
|
|
||||||
cd "$SYNC_DIR"
|
cd "$SYNC_DIR"
|
||||||
git config pull.rebase false
|
|
||||||
|
|
||||||
echo "[$(date '+%H:%M:%S')] Starting sync..."
|
echo "[$(date '+%H:%M:%S')] Syncing..."
|
||||||
|
|
||||||
# Stage local changes
|
# Stage local changes
|
||||||
cp "$HERMES_HOME/memories/MEMORY.md" "$SYNC_DIR/memories/MEMORY.md" 2>/dev/null || true
|
cp "$HERMES_HOME/memories/MEMORY.md" "$SYNC_DIR/memories/MEMORY.md" 2>/dev/null || true
|
||||||
if [ -d "$HERMES_HOME/skills" ]; then
|
if [ -d "$HERMES_HOME/skills" ]; then
|
||||||
mkdir -p "$SYNC_DIR/memories" "$SYNC_DIR/skills"
|
mkdir -p "$SYNC_DIR/skills"
|
||||||
rsync -a --delete "$HERMES_HOME/skills/" "$SYNC_DIR/skills/" 2>/dev/null || true
|
rsync -a --delete "$HERMES_HOME/skills/" "$SYNC_DIR/skills/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
git add -A
|
git add -A
|
||||||
@@ -25,17 +21,13 @@ fi
|
|||||||
|
|
||||||
# Fetch and merge remote
|
# Fetch and merge remote
|
||||||
git fetch origin main
|
git fetch origin main
|
||||||
|
|
||||||
if git rev-parse HEAD >/dev/null 2>&1 && \
|
if git rev-parse HEAD >/dev/null 2>&1 && \
|
||||||
git rev-parse origin/main >/dev/null 2>&1 && \
|
git rev-parse origin/main >/dev/null 2>&1 && \
|
||||||
! git merge-base --is-ancestor HEAD origin/main 2>/dev/null; then
|
! git merge-base --is-ancestor HEAD origin/main 2>/dev/null; then
|
||||||
echo "[$(date '+%H:%M:%S')] Remote has changes, merging..."
|
echo "Merging remote..."
|
||||||
|
|
||||||
if [ "$HAS_LOCAL" = true ]; then
|
if [ "$HAS_LOCAL" = true ]; then
|
||||||
git stash push -m "local $(date)" 2>/dev/null || true
|
git stash push -m "local $(date)" 2>/dev/null || true
|
||||||
if ! git merge origin/main --no-edit 2>/dev/null; then
|
if ! git merge origin/main --no-edit 2>/dev/null; then
|
||||||
# Conflict: keep ours for all
|
|
||||||
git checkout --ours sync.sh 2>/dev/null || true
|
|
||||||
git checkout --ours memories/MEMORY.md 2>/dev/null || true
|
git checkout --ours memories/MEMORY.md 2>/dev/null || true
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "Auto-resolve $(date)" 2>/dev/null || true
|
git commit -m "Auto-resolve $(date)" 2>/dev/null || true
|
||||||
@@ -56,19 +48,17 @@ fi
|
|||||||
if [ "$HAS_LOCAL" = true ]; then
|
if [ "$HAS_LOCAL" = true ]; then
|
||||||
git commit -m "Sync $(date '+%Y-%m-%d %H:%M')" 2>/dev/null || true
|
git commit -m "Sync $(date '+%Y-%m-%d %H:%M')" 2>/dev/null || true
|
||||||
if ! git push origin main 2>&1; then
|
if ! git push origin main 2>&1; then
|
||||||
echo "[$(date '+%H:%M:%S')] Push rejected, pulling..."
|
echo "Push rejected, pulling..."
|
||||||
git pull origin main --no-edit 2>/dev/null || true
|
git pull origin main --no-edit 2>/dev/null || true
|
||||||
git push origin main 2>&1 || echo "[$(date '+%H:%M:%S')] Push failed"
|
git push origin main 2>&1 || echo "Push failed"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "[$(date '+%H:%M:%S')] No local changes"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Apply merged result to hermes home
|
# Apply to hermes
|
||||||
cp "$SYNC_DIR/memories/MEMORY.md" "$HERMES_HOME/memories/MEMORY.md" 2>/dev/null || true
|
cp "$SYNC_DIR/memories/MEMORY.md" "$HERMES_HOME/memories/MEMORY.md" 2>/dev/null || true
|
||||||
if [ -d "$SYNC_DIR/skills" ]; then
|
if [ -d "$SYNC_DIR/skills" ]; then
|
||||||
rsync -a --ignore-existing "$SYNC_DIR/skills/" "$HERMES_HOME/skills/" 2>/dev/null || \
|
rsync -a --ignore-existing "$SYNC_DIR/skills/" "$HERMES_HOME/skills/" 2>/dev/null || \
|
||||||
cp -rn "$SYNC_DIR/skills/"* "$HERMES_HOME/skills/" 2>/dev/null || true
|
cp -rn "$SYNC_DIR/skills/"* "$HERMES_HOME/skills/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[$(date '+%H:%M:%S')] Sync complete"
|
echo "Done"
|
||||||
Reference in New Issue
Block a user