mcp-client-ts

mcp-client-ts is a skill for Claude Code, Codex from olaservo/mcp-agent-skills. It costs 50 tokens per session (4,418 once invoked), scanned A, original, Apache-2.0.

A TypeScript guide for building clients that connect to MCP servers. MCP, or Model Context Protocol, is a standard way for applications to access tools, data, and prompts from another program.

In plain words
What is it for?
Connecting to local or remote MCP servers, calling their tools and resources, building agent applications with an LLM, and handling server requests such as sampling or user input.
Why use it?
It provides ready-made code patterns so developers do not have to work out client connections and server communication from scratch.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is node dist/index.js path/to/server.js.

Good fit Connecting to local or remote MCP servers, calling their tools and resources, building agent applications with an LLM, and handling server requests such as sampling or user input.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/olaservo/mcp-agent-skills
agentmods
npx agentmods add skills/olaservo/mcp-agent-skills/mcp-client-ts

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mcp-client-ts

README.md
[![agentmods](https://agentmods.dev/badge/skills/olaservo/mcp-agent-skills/mcp-client-ts/github.svg)](https://agentmods.dev/skills/olaservo/mcp-agent-skills/mcp-client-ts)
Your own site
<a href="https://agentmods.dev/skills/olaservo/mcp-agent-skills/mcp-client-ts"><img src="https://agentmods.dev/badge/skills/olaservo/mcp-agent-skills/mcp-client-ts/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mcp-client-ts

Your own site · 80×15
<a href="https://agentmods.dev/skills/olaservo/mcp-agent-skills/mcp-client-ts"><img src="https://agentmods.dev/badge/skills/olaservo/mcp-agent-skills/mcp-client-ts.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,418 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.04418
Opus 5 $0.00025 $0.02209
Sonnet 5 $0.00010 $0.00884
Haiku 4.5 $0.00005 $0.00442

Measured 10d ago against content hash 8684371247cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

mcp-client-ts scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

The scan reads SKILL.md. This mod also ships 17 executable files (snippets/capabilities/tasks-receiver.ts, snippets/capabilities/tasks.ts, snippets/client/index.ts, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mcp-client-ts/SKILL.md · 641 lines

How it starts

The opening of the file, as written. The whole thing — 641 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TypeScript MCP Client Builder

Build MCP (Model Context Protocol) clients in TypeScript using code snippets and patterns from the official SDK.

Now includes advanced capability support: sampling handlers, elicitation, roots, dynamic discovery, resource subscriptions, and task support with persistence.

How It Works

  1. Browse the snippet catalog below or in snippets/
  2. Copy the snippets you need into your project
  3. Customize the copied code for your use case
  4. Connect to your MCP server and use tools/resources/prompts

Quick Start Decision Tree

Which Snippet Should I Start With?

Building an agentic app where an LLM decides when to use tools?
  └─> Use client-with-llm snippet
      Includes Claude integration, tool calling loop, interactive chat

Just need direct MCP server access (no LLM)?
  └─> Use client-setup snippet
      Basic connection, manual tool/resource/prompt calls

Which Transport Should I Use?

Connecting to a local process (CLI tool, desktop app)?
  └─> Use StdioClientTransport
      Examples: Claude Desktop, CLI applications, local dev servers

Connecting to a remote HTTP server?
  └─> Use StreamableHTTPClientTransport
      Examples: Cloud-hosted MCP servers, web services

Need to support legacy SSE-only servers?
  └─> Use StreamableHTTP with SSE fallback pattern
      See transport-http snippet for fallback example

Phase 1: Research

1.1 Identify Your Server

Before writing code, understand:

  • What MCP server are you connecting to?
  • How is the server started? (local process vs remote URL)
  • Does the server require authentication?
  • What tools/resources/prompts does it expose?

1.2 Browse Available Snippets

Snippet Description Best For
client-setup Basic Client with connection pattern Direct MCP access without LLM
client-with-llm Agentic client with Claude (API/Bedrock/Vertex/Azure) LLM-powered tool calling apps
transport-stdio StdioClientTransport examples Local/subprocess servers
transport-http StreamableHTTPClientTransport examples Remote HTTP servers
sampling-handler Handle sampling requests with tool support (MCP 2025-11-25) Servers that need Claude completions
elicitation-handler Handle user input requests (form/URL) OAuth, confirmations, data collection
roots-handler Expose filesystem directories IDE integrations, file tools
list-changed React to dynamic capability changes Real-time tool/resource updates
subscriptions Subscribe to resource updates Live data feeds, monitoring
logging Receive server log messages with level filtering Debugging, monitoring
completions Argument autocomplete with interactive picker IDE-like experiences
tasks Task support for long-running operations with streaming Servers with async/long-running tools
persistent-task-store File-based task persistence with TTL Resumable task tracking

Read the full file on GitHub · 641 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 641 lines · 50 tokens per session scan A 8684371247cb

Subscribe to this mod's changes

mcp-client-ts is a skill published in the GitHub repository olaservo/mcp-agent-skills (2 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 50 tokens to every session and 4,418 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

no-bare-casts

Writing as in TypeScript or TSX production code, modifying a file that contains a bare as cast, silencing a type error with a cast, encountering as unknown as, or reviewing a cast site.

prisma/orm · 52 tokens

aws-sst-development

SST v4 (Ion) expert for managing AWS resources as code with the Pulumi-backed framework.

sickn33/agentic-awesome-skills · 26 tokens

league-akari-shard-development

Use when creating, extending, refactoring, splitting, or reviewing League Akari main or renderer shards, including shard file organization, controller/loader/executor/handler boundaries, naming conventions, renderer TSX usage, platform guards, and public contract compatibility.

LeagueAkari/LeagueAkari · 58 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

fast-typescript-check

Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…

internet-development/www-sacred · 84 tokens

migrate-better-result-3

Migrate a TypeScript codebase from better-result 2.x to 3.0. Use when upgrading better-result across the TaggedError syntax, removed Result serialization helpers, recovery inference, matching, or retry APIs.

dmmulroy/better-result · 52 tokens