MCP TypeScript SDK (V2) / @modelcontextprotocol/client / ext/skills/skillsClient
ext/skills/skillsClient
Classes
SkillsClient
Defined in: packages/client/src/ext/skills/skillsClient.ts:151
Host side of the MCP Skills extension (SEP-2640): lists, gets and reads a server's skills, and verifies every file against the server's entry. Approval, origin tagging and loading policy stay with the host.
Example
const skills = new SkillsClient(client);
const { skills: entries } = await skills.list();
const manifest = await skills.read(entries[0]!);Constructors
Constructor
new SkillsClient(
client,options?):SkillsClient
Defined in: packages/client/src/ext/skills/skillsClient.ts:155
Parameters
client
options?
SkillsClientOptions = {}
Returns
Accessors
directoryRead
Get Signature
get directoryRead():
boolean
Defined in: packages/client/src/ext/skills/skillsClient.ts:168
The server serves resources/directory/read.
Returns
boolean
supported
Get Signature
get supported():
boolean
Defined in: packages/client/src/ext/skills/skillsClient.ts:161
The server declared the extension (and resources, under enforceStrictCapabilities). false before connect.
Returns
boolean
Methods
get()
get(
uri,options?):Promise<{cacheScope?:"public"|"private";skill: {[key:string]:unknown;_meta?:Record<string,unknown>;frontmatter: {[key:string]:unknown;description:string;name:string; };resources:"dynamic"|object[];uri:string; };ttlMs?:number; }>
Defined in: packages/client/src/ext/skills/skillsClient.ts:206
One skill by its SKILL.md URI, listed or not, with the result's caching fields on 2026-07-28. Throws if the server returns an invalid entry or another skill.
Parameters
uri
string
options?
Returns
Promise<{ cacheScope?: "public" | "private"; skill: {[key: string]: unknown; _meta?: Record<string, unknown>; frontmatter: {[key: string]: unknown; description: string; name: string; }; resources: "dynamic" | object[]; uri: string; }; ttlMs?: number; }>
list()
list(
params?,options?):Promise<SkillListing>
Defined in: packages/client/src/ext/skills/skillsClient.ts:180
Lists the server's skills, walking every page unless given a cursor (bounded by the client's listMaxPages). Throws an SdkError naming every invalid entry, and every copy of a repeated URI; with skipInvalid, returns them in invalid instead. A 2026-07-28 page without ttlMs and cacheScope throws either way. On a server without the extension: an empty listing.
Parameters
params?
cursor?
string
options?
Returns
Promise<SkillListing>
read()
read(
skill,ref?,options?):Promise<SkillFile>
Defined in: packages/client/src/ext/skills/skillsClient.ts:236
Reads one file of skill and verifies it. ref is a path relative to the skill's root (references/FORMS.md) or an absolute URI; the default is the skill's own SKILL.md; a fragment is ignored. The file must be listed in the entry (checked before any request, however either side percent-encodes the name) and is requested by the entry's URI; its size and digest must match; for the skill's own SKILL.md the frontmatter must also equal the entry's. A copy from the client's response cache that fails a check is fetched once more with cacheMode: 'refresh'. "dynamic" skills skip the listing, size and digest checks (verified: false) but not the frontmatter. Pass entries from SkillsClient.list or SkillsClient.get; an invalid entry throws a TypeError before any request.
Parameters
skill
_meta?
Record<string, unknown> = ...
frontmatter
{[key: string]: unknown; description: string; name: string; } = SkillFrontmatterSchema
The SKILL.md frontmatter, verbatim.
frontmatter.description
string = ...
frontmatter.name
string = ...
resources
"dynamic" | object[] = SkillResourcesSchema
Every file of the skill, or "dynamic".
uri
string = ...
Resource URI of the skill's SKILL.md.
ref?
string
options?
Returns
Promise<SkillFile>
Throws
when a check fails.
readDirectory()
readDirectory(
uri,options?):Promise<{cacheScope?:"public"|"private";resources:object[];ttlMs?:number; }>
Defined in: packages/client/src/ext/skills/skillsClient.ts:307
The direct children of a skill directory, every page walked, with the first page's caching fields on 2026-07-28. Needs directoryRead.
Parameters
uri
string
options?
Returns
Promise<{ cacheScope?: "public" | "private"; resources: object[]; ttlMs?: number; }>
Interfaces
SkillFile
Defined in: packages/client/src/ext/skills/skillsClient.ts:56
A skill file as read and checked by SkillsClient.read.
Properties
body?
optionalbody?:string
Defined in: packages/client/src/ext/skills/skillsClient.ts:69
The skill's own SKILL.md only: the markdown after the frontmatter.
bytes
bytes:
Uint8Array
Defined in: packages/client/src/ext/skills/skillsClient.ts:61
Exactly the bytes the entry's digest covers.
frontmatter?
optionalfrontmatter?:Record<string,unknown>
Defined in: packages/client/src/ext/skills/skillsClient.ts:67
The skill's own SKILL.md only: its parsed frontmatter, equal to the entry's.
mimeType?
optionalmimeType?:string
Defined in: packages/client/src/ext/skills/skillsClient.ts:59
text?
optionaltext?:string
Defined in: packages/client/src/ext/skills/skillsClient.ts:63
When the server sent text (always, for the skill's own SKILL.md).
uri
uri:
string
Defined in: packages/client/src/ext/skills/skillsClient.ts:58
The URI requested: the entry's spelling of the file; for "dynamic" skills, the resolved ref in its normalised form.
verified
verified:
boolean
Defined in: packages/client/src/ext/skills/skillsClient.ts:65
Size and digest were checked. false only for "dynamic" skills.
SkillListing
Defined in: packages/client/src/ext/skills/skillsClient.ts:46
What list() returns: the valid entries, the refused ones (only with skipInvalid), and the first page's caching fields.
Properties
cacheScope?
optionalcacheScope?:"public"|"private"
Defined in: packages/client/src/ext/skills/skillsClient.ts:52
invalid
invalid:
InvalidSkillEntry[]
Defined in: packages/client/src/ext/skills/skillsClient.ts:48
nextCursor?
optionalnextCursor?:string
Defined in: packages/client/src/ext/skills/skillsClient.ts:50
Only when list() was given a cursor (one page); a full walk has none.
skills
skills:
object[]
Defined in: packages/client/src/ext/skills/skillsClient.ts:47
Index Signature
[key: string]: unknown
_meta?
optional_meta?:Record<string,unknown>
frontmatter
frontmatter:
object=SkillFrontmatterSchema
The SKILL.md frontmatter, verbatim.
Index Signature
[key: string]: unknown
frontmatter.description
description:
string
frontmatter.name
name:
string
resources
resources:
"dynamic"|object[] =SkillResourcesSchema
Every file of the skill, or "dynamic".
uri
uri:
string
Resource URI of the skill's SKILL.md.
ttlMs?
optionalttlMs?:number
Defined in: packages/client/src/ext/skills/skillsClient.ts:51
SkillsClientOptions
Defined in: packages/client/src/ext/skills/skillsClient.ts:35
Properties
parseFrontmatter?
optionalparseFrontmatter?: (yaml) =>Record<string,unknown>
Defined in: packages/client/src/ext/skills/skillsClient.ts:40
Parses the YAML between a SKILL.md's --- lines (BOM and CRLF removed) for verification, instead of the built-in parser (YAML 1.2 core-schema typing).
Parameters
yaml
string
Returns
Record<string, unknown>
skipInvalid?
optionalskipInvalid?:boolean
Defined in: packages/client/src/ext/skills/skillsClient.ts:42
Return invalid skills/list entries in invalid instead of throwing. Default false: list() throws on any.