Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mcp-client

БесплатноБез исполняемых скриптовНе проверен

Connect to and consume MCP servers from applications. Use when: integrating MCP servers into your app, building AI agents that use MCP tools, testing MCP…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

MCP Client

Overview

An MCP client connects your program to an MCP server, discovers its tools, resources and prompts, and calls them. Use it to give an AI agent a set of tools, to test a server you wrote, or to read server resources into a pipeline.

Both official SDKs shipped a stable v2 in July 2026 (protocol revision 2026-07-28), and the examples below use it:

  • TypeScript: @modelcontextprotocol/client (v2). The old @modelcontextprotocol/sdk (v1.x) still gets fixes and works, but its import paths and the Client constructor differ.
  • Python: pip install mcp installs 2.x. The new Client replaces v1's stdio_client + ClientSession + initialize() stack.

Instructions

Step 1: Install

npm install @modelcontextprotocol/client     # TypeScript, Node 18+
pip install mcp                              # Python 3.10+ (v2 docs recommend 3.11+)

Step 2: Connect to a local (stdio) server

The client starts the server as a child process and owns it until close().

import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";

const client = new Client({ name: "docs-agent", version: "1.0.0" });

const transport = new StdioClientTransport({
  command: "node",
  args: ["./weather-server/dist/index.js"],
  env: { WEATHER_API_KEY: process.env.WEATHER_API_KEY ?? "" },
});

await client.connect(transport);
console.log(client.getServerVersion(), client.getServerCapabilities());
import asyncio
import os
from mcp import Client, StdioServerParameters

server = StdioServerParameters(
    command="python",
    args=["weather_server.py"],
    env={"WEATHER_API_KEY": os.environ.get("WEATHER_API_KEY", "")},
)

async def main():
    async with Client(server) as client:          # connects on enter, closes on exit
        print(client.server_info, client.protocol_version)

asyncio.run(main())

The child process does not inherit your whole environment, only a short allow-list (PATH, HOME and similar). Pass API keys through env.

Step 3: Connect to a remote server

Use Streamable HTTP. It is the transport servers deploy today.

import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";

const client = new Client({ name: "docs-agent", version: "1.0.0" });
const transport = new StreamableHTTPClientTransport(new URL("https://mcp.internal.acme.dev/mcp"), {
  requestInit: { headers: { Authorization: `Bearer ${process.env.MCP_TOKEN}` } },
});
await client.connect(transport);
// ...
await transport.terminateSession(); // ends the server-side session, then:
await client.close();
async with Client("http://127.0.0.1:8000/mcp") as client:
    print(client.protocol_version)   # '2026-07-28'

In Python a URL string means Streamable HTTP. For headers, auth or proxies build an httpx2.AsyncClient and pass Client(streamable_http_client(url, http_client=your_client)); there is no headers= argument.

For a legacy SSE-only server, retry on a fresh Client with SSEClientTransport (TypeScript) or Client(sse_client(url)) (Python, from mcp.client.sse). Build nothing new on SSE.

Step 4: Discover tools

const { tools } = await client.listTools();   // follows pagination for you
for (const tool of tools) {
  console.log(`- ${tool.name}: ${tool.description}`);   // tool.inputSchema is JSON Schema
}
tools = await client.list_tools()
for tool in tools.tools:
    print(f"- {tool.name}: {tool.description}")      # tool.input_schema is JSON Schema

Check client.getServerCapabilities() (TypeScript) or client.server_capabilities (Python) first: a missing tools, resources or prompts entry means the server lacks that verb.

Step 5: Call a tool

const result = await client.callTool({
  name: "get_weather",
  arguments: { city: "Berlin", units: "celsius" },
});

if (result.isError) {
  console.error("Tool failed:", result.content);
} else {
  for (const block of result.content) {
    if (block.type === "text") console.log(block.text);
  }
}
result = await client.call_tool("get_weather", {"city": "Berlin", "units": "celsius"})
if result.is_error:
    print("Tool failed:", result.content)
else:
    for block in result.content:
        if block.type == "text":
            print(block.text)
    print(result.structured_content)   # typed data when the tool declares an output schema

A tool that throws, and arguments the input schema rejects, come back as an ordinary result with isError / is_error set, so a model can read the message and retry. Only protocol failures throw: an unknown tool name raises in TypeScript (Tool nope not found) but returns is_error=True in Python.

Step 6: Resources and prompts

const { resources } = await client.listResources();
const { contents } = await client.readResource({ uri: "config://app" });
for (const item of
Полный SKILL.md на GitHub

Установить mcp-client в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл mcp-client?

Connect to and consume MCP servers from applications. Use when: integrating MCP servers into your app, building AI agents that use MCP tools, testing MCP server implementations, or programmatically calling MCP tools and reading resources.

Как установить скилл mcp-client?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mcp-client запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mcp-client с