Localsend mcp

From plurigrid/asi · View interactive version

Localsend mcp is an AI agent skill from the GitHub repository plurigrid/asi. LocalSend-based P2P transfer with MCP server design for NATS/Tailscale discovery and throughput tuning.

How to use this skill

Skill file

LocalSend MCP Skill

Use This Skill When

Reality Check (LocalSend in This Repo)

Architecture: Advertise -> Negotiate -> Transfer -> Tune

  1. Advertise capabilities over NATS (or Tailscale if LAN multicast is blocked).
  2. Negotiate transport and parameters (LAN multicast vs direct IP).
  3. Transfer via LocalSend protocol/CLI.
  4. Tune throughput until spectral gap <= 0.25 (>= 75% of target throughput).

MCP Tool Set (Draft)

Discovery / Advertising

Session Negotiation

Transfer

Throughput Tuning

Spectral Gap Heuristic (Practical)

Define:

spectral_gap = 1.0 - (observed_throughput / target_throughput)

Stop tuning when spectral_gap <= 0.25.

Tuning Loop:

  1. Start chunk_bytes = 256KB, parallelism = 1
  2. Increase parallelism to 2, 4, 8 while loss < 1%
  3. Increase chunk size up to 1MB while RTT stable
  4. Recompute spectral gap each step

Integration Points in This Repo

GitHub GraphQL (GH CLI) Reference

Use gh api graphql for contributor snapshots (limit: history(first: 100)):

gh api graphql \
  -F owner=localsend \
  -F name=localsend \
  -F history=100 \
  -f query='query($owner:String!,$name:String!,$history:Int!){
    repository(owner:$owner,name:$name){
      defaultBranchRef{name target{
        ... on Commit{
          history(first:$history){
            nodes{author{user{login} name}}
          }
        }
      }}
    }
  }'

Aggregate top contributors:

gh api graphql -F owner=localsend -F name=localsend -F history=100 -f query='query($owner:String!,$name:String!,$history:Int!){repository(owner:$owner,name:$name){defaultBranchRef{name target{... on Commit{history(first:$history){nodes{author{user{login} name}}}}}}}}' \
  | jq -r '.data.repository.defaultBranchRef.target.history.nodes[].author | if .user then .user.login else .name end' \
  | sort | uniq -c | sort -nr | head -20

Duck Lake Snapshots (Feedback + Bidirectional Flow)

Persist LocalSend sessions and GitHub snapshots into DuckDB for time travel:

CREATE TABLE IF NOT EXISTS localsend_sessions (
  session_id TEXT,
  peer_id TEXT,
  direction TEXT, -- send|receive
  bytes BIGINT,
  throughput_bps DOUBLE,
  spectral_gap DOUBLE,
  created_at TIMESTAMP
);

CREATE TABLE IF NOT EXISTS localsend_contributors_snapshot (
  snapshot_at TIMESTAMP,
  repo TEXT,
  contributor TEXT,
  commit_count INT
);

Store snapshots per run and query later with existing DuckDB time-travel commands.

Implementation Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.