add-remote-mcp
Generate MCP-backed skills from remote MCP servers (Streamable HTTP). Covers discovery, wrapper generation, skill scaffolding, and authentication seams for HTTP endpoints.
What this skill does
# Add Remote MCP
Generate skills from any remote MCP server using the framework's shared `plaited/mcp` library surface.
Remote MCP URLs often start as discovery URLs that also accept Streamable HTTP MCP traffic.
For example, `https://bun.com/docs/mcp` is a valid remote MCP URL for discovery, tool listing,
and direct tool calls.
## When to use
- Adding a new remote MCP server as a searchable skill
- Discovering what tools, prompts, and resources an MCP server exposes
- Generating typed wrapper scripts for MCP tools
- Evaluating MCP prompts for adaptation into skill instructions
- Downloading or scripting access to MCP resources
## URL shapes
Remote MCP integrations commonly begin from one of two URL types:
- **Discovery/manifest URL** — Returns advertised capabilities as JSON.
Example: `https://bun.com/docs/mcp`
- **Live transport endpoint** — Supports Streamable HTTP MCP session traffic directly.
The shared `plaited/mcp` library accepts either URL type:
- `mcpDiscover`, `mcpListTools`, `mcpListPrompts`, `mcpListResources`
- accept either URL type
- `createRemoteMcpSession`, `remoteMcpConnect`, `mcpCallTool`, `mcpGetPrompt`, `mcpReadResource`
- work against live transport endpoints and manifest URLs that also serve Streamable HTTP
If you only have a discovery URL, start by trying it directly. If connection attempts fail,
then fall back to discovery/list wrappers or use the advertised capabilities to locate a
separate transport endpoint.
## Discovery
- Unified CLI for discovery, listing, prompt fetches, resource reads, and session summaries:
`bun skills/add-remote-mcp/scripts/run.ts '{"url":"https://bun.com/docs/mcp","operation":{"type":"session-summary"}}'`
- Full capability discovery and tool listing:
[references/discovery-template.ts](references/discovery-template.ts)
- Prompt retrieval:
[references/prompt-template.ts](references/prompt-template.ts)
- Resource reads:
[references/resource-template.ts](references/resource-template.ts)
## Session API (connection reuse)
For multiple operations against the same server, use a session when the URL accepts live MCP
traffic.
See [references/session-template.ts](references/session-template.ts).
`await using` automatically closes the connection when the block exits.
## Skill Generation Pattern
After discovery, evaluate each capability type and generate the appropriate skill structure.
### 1. Tools → `scripts/`
Tools become executable wrapper scripts. Use [references/wrapper-template.ts](references/wrapper-template.ts) as a starting point:
```bash
mkdir -p skills/search-my-service/scripts
cp skills/add-remote-mcp/references/wrapper-template.ts skills/search-my-service/scripts/search.ts
```
Edit the constants: `MCP_URL`, `TOOL_NAME`, and adjust the input validation if the tool takes
more than `query`.
Start with the discovery URL the server publishes. If direct execution fails, switch the wrapper
to the server's separate transport URL if one is advertised.
### 2. Prompts → evaluate for skill adaptation
MCP prompts are pre-built message templates. Evaluate whether to:
- **Adapt into SKILL.md instructions** — If the prompt teaches a workflow, extract its content into the skill's markdown body.
- **Create a prompt script in `scripts/`** — If the prompt is used at runtime.
See [references/prompt-template.ts](references/prompt-template.ts).
### 3. Resources → `assets/` or pull scripts
- **Static/small → `assets/`** — Download once and commit.
- **Dynamic/large → `scripts/`** — Fetch on demand.
See [references/resource-template.ts](references/resource-template.ts).
### 4. Scaffold SKILL.md
Create `skills/my-skill/SKILL.md` with frontmatter:
```yaml
---
name: my-skill
description: What this skill does. Use when...
license: ISC
compatibility: Requires bun and network access
allowed-tools: Bash
---
```
### 5. Validate
```bash
# Check the generated skill against the AgentSkills spec and repo conventions
bun run skills/search-agent-skills/scripts/search.ts '{"query":"SKILL.md frontmatter fields scripts references assets conventions"}'
# Or inspect the remote server directly through the unified add-remote-mcp CLI
bun skills/add-remote-mcp/scripts/run.ts '{"url":"https://bun.com/docs/mcp","operation":{"type":"session-summary"}}'
```
### 6. Test
```bash
bun run skills/my-skill/scripts/search.ts '{"query": "test query"}'
```
## Authentication
### Tier 1: No auth (public endpoints)
No options needed — the default:
```typescript
const tools = await mcpListTools('https://bun.com/docs/mcp')
```
### Tier 2: API key / Bearer token
Pass custom headers via options.
See [references/wrapper-template.ts](references/wrapper-template.ts).
### Tier 3: OAuth 2.1
OAuth requires a programmatic `OAuthClientProvider`.
See [references/oauth-provider-template.ts](references/oauth-provider-template.ts).
### Which tier to use
| Scenario | Tier | Example |
|----------|------|---------|
| Public doc search | No auth | modelcontextprotocol.io, agentskills.io |
| SaaS API with API key | Bearer token | You.com, OpenAI |
| Enterprise SSO / IdP | OAuth 2.1 | Internal services |
| Agent-to-agent (Modnet) | OAuth client credentials | Node MCP servers |
## References
- **`references/discovery-template.ts`** — Capability discovery and tool listing
- **`references/session-template.ts`** — Reusable remote session pattern
- **`references/prompt-template.ts`** — Prompt retrieval example
- **`references/resource-template.ts`** — Resource read example
- **`references/oauth-provider-template.ts`** — OAuth provider seam example
- **`references/wrapper-template.ts`** — Template for MCP wrapper scripts that import `plaited/mcp`
## Dependencies
- **`@modelcontextprotocol/sdk`** — MCP protocol client (Streamable HTTP transport)
## Protocol notes
- Discovery/list helpers accept both manifest URLs and live Streamable HTTP transport URLs
- Session-style APIs also work with manifest URLs when the same URL serves live MCP traffic
- Uses MCP Streamable HTTP transport (2025-03-26+) via `StreamableHTTPClientTransport`
- SDK handles Accept header negotiation (`application/json` and `text/event-stream`)
- Session API reuses a single connection; one-shot helpers create and dispose per call
- Not for stdio-based MCP servers — use `add-mcp` directly with an stdio transport
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.