aver005/pooprusteek/pooprusteek-providers-and-mcp
Claude Code and agent skill by aver005/pooprusteek
- community
Checking that the SKILL.md file is still in the repository.
How PoopRusteek's LLM-provider and MCP subsystems are structured, for anyone editing src/provider/ or src/mcp/ — the LLMProvider trait + fork(), the four protocols, MCP transports/discovery/OAuth, and the lock-across-await invariant. Use before touching provider or MCP code.
Install
npx vskill@latest install aver005/pooprusteek/pooprusteek-providers-and-mcpSKILL.md
The same SKILL.md was published earlier as aver005/pooprusteek/pooprusteek-providers-and-mcp.
PoopRusteek Providers & MCP
Sources: src/provider/, src/mcp/. References: .memories/reference/PROVIDER.md, .memories/reference/MCP.md.
Providers (src/provider/)
The LLMProvider trait (provider/mod.rs) is the abstraction every backend implements:
complete(non-streaming) ·complete_stream(request, tx)(SSE over an mpsc sender) ·
model() · reset().
- `fork() -> Arc<dyn LLMProvider>` is the isolation primitive: each
Conversationgets its own
forked provider so per-conversation sessions never cross-talk. DeepSeek rebuilds a fresh SessionState (fork_session); the stateless HTTP providers just return a new instance.
- Session-resume methods
session_identity/session_is_alive/adopt_sessionlet a saved
DeepSeek session be re-adopted across restarts (default no-op for other providers).
Four implementations:
- Built-in DeepSeek web client (
deepseek.rs, split intodeepseek/{mod,http,session,stream,endpoints}.rs).
Reverse-engineered chat.deepseek.com/api/v0, cookie/token auth (not an API key). Every PoW-gated call needs a solved challenge in the x-ds-pow-response header — SHA-3 solved via a WASM blob (assets/sha3_wasm_bg.*.wasm) run through wasmtime (provider/pow.rs). The web API takes a single flattened prompt string (history is assembled in provider/prompt.rs), and responses stream as nested-JSON SSE (provider/sse.rs SseLineBuffer, byte-based). PoW solving is CPU-heavy → spawn_blocking.
- OpenAI Chat Completions (
openai_client.rs+openai_compat.rswire types) — one POST per
turn, data: [DONE] terminator, bearer auth, stateless fork().
- Anthropic Messages (
anthropic_client.rs+anthropic_compat.rs) —x-api-key+
anthropic-version, top-level system, strict role alternation, typed SSE.
- Gemini (
gemini_client.rs+gemini_compat.rs) — model-in-URL
(:generateContent / :streamGenerateContent?alt=sse), x-goog-api-key.
The three extra providers are managed by /providers (state in app/providers.rs) and built from config::ProviderEntry by the single construction point provider::build_provider. The _compat files are pure wire-format conversions (no I/O) — keep them testable and side-effect-free.
For per-protocol wire details (endpoint, auth, request/streaming/response mapping, LLMProvider surface + fork()), anchored to file::function names, see `references/protocol-mapping.md`.
MCP (src/mcp/)
External servers expose tools namespaced mcp__{server}__{tool}; the agent loop dispatches any call whose name starts with mcp__ through MCPManager::client_for + MCPClient::call_tool (agent/tools_step.rs), outside the manager lock.
- Transports (
transport.rs): stdio (subprocess, JSON+\n, 60s/req for write+read; a
failed or timed-out write closes the transport, so later calls fail fast; Windows auto-retries .cmd/.bat so npx resolves), HTTP (reqwest + cookie store, tracks MCP-Session-Id, SSE-fallback), SSE (text/event-stream, id-matched), Dummy (disabled servers). Protocol version 2024-11-05; handshake initialize → notifications/initialized → tools/list.
- 8-source config discovery (
config.rs, first-found-wins): ownmcp.json→ workspace
(./mcp.config.json, .vscode/mcp.json) → global → Claude Desktop → VSCode → Claude CLI → Cursor → Opencode. persist_config writes only pooprusteek-owned servers (foreign servers get enable/disable overrides, never secret copying).
- Manager (
manager.rs): server lifecycle, per-server tool cache (default TTL 300s, override
/mcp ttl), lock-free client_for(name) handles, shutdown_all on exit. MCPManager methods are short state changes under the lock; /mcp operations are free functions over &Mutex<MCPManager> (startup_initialize, reload, reconnect, toggle, add, remove): short lock, connect/close without the lock, short merge. A merge or install applies only if the entry still holds the same client (Arc::ptr_eq); a client that lost a race is closed.
- OAuth (
oauth.rs/oauth_store.rs,/mcp auth): a 401 during connect surfaces as
AuthRequired; the flow does RFC 9728 protected-resource discovery → RFC 8414 / OIDC AS metadata → RFC 7591 dynamic client registration (no DCR support = hard error) → PKCE S256 → local loopback redirect → token exchange. Tokens live in the OS keyring (service pooprusteek-mcp), never in mcp.json; keyring calls run on spawn_blocking. /mcp add (JSON paste / wizard / one-liner shorthand) converges on mcp::manager::add.
The load-bearing invariant
Never hold the `MCPManager` lock (or any shared `Mutex`) across an I/O `.await`. A slow tool call under the lock freezes every other consumer, including the UI. The manager exposes lock-free client_for(name) handles precisely so the network .await happens outside the lock; status polling uses try_lock. Same rule as the app-wide invariant #2 — the MCP subsystem is where it bites hardest.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/contributor/pooprusteek-providers-and-mcp/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aver005/pooprusteek/pooprusteek-providers-and-mcp)