Agent skill

Add Resource

by cyanheads in cyanheads/pubmed-mcp-server

Scaffold a new MCP resource definition. An agent skill from cyanheads/pubmed-mcp-server.

Apache-2.0Auto-check passedAgent Workflows

Install Add Resource

skills CLI
$ npx skills add cyanheads/pubmed-mcp-server --skill add-resource -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cyanheads/pubmed-mcp-server add-resource --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cyanheads/pubmed-mcp-server.git skills-src && mkdir -p .claude/skills && cp -r skills-src/framework-skills/add-resource .claude/skills/add-resource && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-resource
GitHub stars
156
Token cost
~3k tokens
SKILL.md length
940 words
Files
1
Skills in repo
30
Repo updated
First seen
Licence
Apache-2.0

At a glance

Scaffold a new MCP resource definition. An agent skill from cyanheads/pubmed-mcp-server.

  • Works in 6 steps: Gather the resource's URI template,… → Design the URI — use {paramName} for… → Create the file at… → …
  • The user asks to add a resource
  • SKILL.md covers Context, Steps, Template and Checklist
  • Calls bun

What it does

Add Resource is an agent skill from cyanheads/pubmed-mcp-server. Scaffold a new MCP resource definition. Use when the user asks to add a resource, expose data via URI, or create a readable endpoint.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering MCP servers. It works with Model Context Protocol. The repository describes itself as: Search PubMed/Europe PMC, fetch articles and full text (PMC/EPMC/Unpaywall), citations, MeSH terms via MCP. STDIO or Streamable HTTP. The licence is Apache-2.0.

When your agent uses it

  • The user asks to add a resource
  • Expose data via URI
  • Create a readable endpoint

Example prompts

  • “/add-resource”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Gather the resource's URI template, purpose, and data shape from the user's request — ask only if genuinely absent
  2. Design the URI — use {paramName} for path parameters (e.g., myscheme://{itemId}/data)
  3. Create the file at src/mcp-server/resources/definitions/{{resource-name}}.resource.ts
  4. Register the resource in the project's existing createApp() resource list (directly in src/index.ts for fresh scaffolds, or via a barrel…
  5. Run bun run devcheck to verify
  6. Smoke-test with bun run rebuild && bun run start:stdio < /dev/null (or start:http) — the Core services constructed log record must list…

What it can do on your machine

Read from SKILL.md and the folder at commit 5a417fb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Resource loads about 3k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 940 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from cyanheads/pubmed-mcp-server at commit 5a417fb, republished under its Apache-2.0 licence (© cyanheads). 940 words, ~2,979 tokens.

Download SKILL.mdSave it as .claude/skills/add-resource/SKILL.md (or your agent's skills folder).
name
add-resource
description
Scaffold a new MCP resource definition. Use when the user asks to add a resource, expose data via URI, or create a readable endpoint.
metadata.author
cyanheads
metadata.version
1.8
metadata.audience
external
metadata.type
reference

Context

Resources use the resource() builder from @cyanheads/mcp-ts-core. Each resource lives in src/mcp-server/resources/definitions/ with a .resource.ts suffix. The standard registration pattern uses a definitions/index.ts barrel that collects all resources into an allResourceDefinitions array for createApp(). Fresh scaffolds start with direct imports in src/index.ts — the barrel is introduced as definitions grow. Match the pattern already used by the project you're editing.

Tool coverage. Not all MCP clients expose resources — many are tool-only (Claude Code, Cursor, most chat UIs). Before adding a resource, verify the same data is reachable via the tool surface — either through a dedicated tool, included in another tool's output, or bundled into a broader tool. A resource whose data has no tool path is invisible to a large share of agents.

Steps

  1. Gather the resource's URI template, purpose, and data shape from the user's request — ask only if genuinely absent
  2. Design the URI — use {paramName} for path parameters (e.g., myscheme://{itemId}/data)
  3. Create the file at src/mcp-server/resources/definitions/{{resource-name}}.resource.ts
  4. Register the resource in the project's existing createApp() resource list (directly in src/index.ts for fresh scaffolds, or via a barrel if the repo already has one)
  5. Run bun run devcheck to verify
  6. Smoke-test with bun run rebuild && bun run start:stdio < /dev/null (or start:http) — the Core services constructed log record must list the new resource in its resources field (the message text shows only counts); if it doesn't, the resource never reached createApp()

Template

typescript
/**
 * @fileoverview {{RESOURCE_DESCRIPTION}}
 * @module mcp-server/resources/definitions/{{RESOURCE_NAME}}
 */

import { resource, z } from '@cyanheads/mcp-ts-core';

export const {{RESOURCE_EXPORT}} = resource('{{scheme}}://{{{paramName}}}/data', {
  description: '{{RESOURCE_DESCRIPTION}}',
  mimeType: 'application/json',
  // size: 1024,  // optional: content size in bytes, if known
  params: z.object({
    {{paramName}}: z.string().describe('{{PARAM_DESCRIPTION}}'),
  }),
  // auth: ['resource:{{resource_name}}:read'],

  async handler(params, ctx) {
    ctx.log.debug('Fetching resource', { {{paramName}}: params.{{paramName}} });
    // Pure logic — throw on failure, no try/catch
    return { /* resource data */ };
  },

  list: async (extra) => ({
    resources: [
      {
        uri: '{{scheme}}://all',
        name: '{{RESOURCE_LIST_NAME}}',
        mimeType: 'application/json',
      },
    ],
  }),
});
With pagination

For resources that return large result sets, use opaque cursor pagination in the handler. resources/read carries no cursor of its own, so the cursor must be a URI template variable — it arrives as a validated URI param. Make it a path segment: a {?cursor} query expansion is mandatory in the SDK's template matcher, so the bare URI (no ?cursor=) stops matching. Serve the first page from an unpaged sibling resource that returns nextCursor, or disclose truncation in the body and point callers at a tool that pages. paginateArray requires a RequestContext for logging — create one from requestContextService:

typescript
import { extractCursor, paginateArray, requestContextService } from '@cyanheads/mcp-ts-core/utils';

// URI template: '{{scheme}}://{{{paramName}}}/items/{cursor}'
params: z.object({
  {{paramName}}: z.string().describe('{{PARAM_DESCRIPTION}}'),
  cursor: z.string().optional().describe('Opaque pagination cursor'),
}),

async handler(params, ctx) {
  const allItems = await fetchAllItems(params.{{paramName}});
  const cursor = extractCursor({ cursor: params.cursor });
  const reqCtx = requestContextService.createRequestContext({
    operation: 'list-{{paramName}}',
    parentContext: { requestId: ctx.requestId, traceId: ctx.traceId },
  });
  const page = paginateArray(allItems, cursor, 20, 100, reqCtx);
  return {
    items: page.items,
    nextCursor: page.nextCursor,
  };
},
Registration
typescript
// src/index.ts (fresh scaffold default)
import { createApp } from '@cyanheads/mcp-ts-core';
import { {{RESOURCE_EXPORT}} } from './mcp-server/resources/definitions/{{resource-name}}.resource.js';

await createApp({
  tools: [/* existing tools */],
  resources: [{{RESOURCE_EXPORT}}],
  prompts: [/* existing prompts */],
});

If the repo already uses src/mcp-server/resources/definitions/index.ts, add the resource to that barrel the way it holds the existing ones — it must end up in the array passed to createApp(). A bare export … from line registers nothing on its own. The standard barrel shape:

typescript
import { {{RESOURCE_EXPORT}} } from './{{resource-name}}.resource.js';

export const allResourceDefinitions = [/* existing resources */, {{RESOURCE_EXPORT}}];
Optional: declarative errors[] contract

Resources can opt into the same typed error contract as tools — bound to a typed ctx.fail(reason, …) keyed by the declared reason union:

typescript
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';

export const articleResource = resource('article://{pmid}', {
  description: 'Read an article by PMID.',
  errors: [
    { reason: 'no_pmid_match', code: JsonRpcErrorCode.NotFound,
      when: 'PMID not found in the index.',
      recovery: 'Use pubmed_search_articles to discover valid PMIDs first.' },
    { reason: 'withdrawn', code: JsonRpcErrorCode.NotFound,
      when: 'Article was withdrawn upstream.',
      recovery: 'Check PubMed directly for retraction or withdrawal notices.' },
    { reason: 'upstream_throttled', code: JsonRpcErrorCode.RateLimited,
      when: 'Upstream PubMed quota hit.', retryable: true,
      recovery: 'Wait a few seconds and retry the request.' },
  ],
  params: z.object({ pmid: z.string().describe('PubMed ID') }),
  async handler(params, ctx) {
    const article = await fetchOne(params.pmid);
    if (!article) throw ctx.fail('no_pmid_match', `PMID ${params.pmid} not indexed`);
    if (article.withdrawn) throw ctx.fail('withdrawn');
    return article;
  },
});

Without errors[], the handler receives plain Context (no fail method) and throws via error factories (notFound, serviceUnavailable, …) directly. The contract is opt-in. See framework-skills/api-errors/SKILL.md for the full pattern, baseline codes, and conformance rules.

URI template variable completion

Add a complete map to enable autocompletion for URI template variables. The SDK auto-installs completion/complete handling and advertises the completions capability when a registered resource template has completion callbacks — no other changes needed.

typescript
import { resource, z } from '@cyanheads/mcp-ts-core';

const ITEM_IDS = ['item-001', 'item-002', 'item-abc'];

export const itemResource = resource('items://{itemId}', {
  description: 'Retrieve an item by ID.',
  params: z.object({ itemId: z.string().describe('Item identifier') }),
  handler: (params) => ({ id: params.itemId }),
  list: () => ({ resources: ITEM_IDS.map((id) => ({ uri: `items://${id}`, name: id })) }),
  // Per-variable completion callbacks — keys must match URI template variable names.
  complete: {
    itemId: async (partial) => ITEM_IDS.filter((id) => id.startsWith(partial)),
  },
});

Only applies to templated resources (URI templates with {variable} syntax). Static URIs don't support completion.

Other resource() options

Beyond description, params, handler, and list, the builder also supports:

FieldPurpose
nameShort human-readable name for resources/list. Defaults to a slug derived from the URI template if omitted.
outputOptional Zod schema for runtime validation of the handler return value (parity with tool()'s output).
formatOptional formatter mapping the handler's return to the ReadResourceResult.contents[] shape. Default: string passthrough; objects serialized to JSON. Override when you need to attach permissions, custom encodings, or split into multiple content items.
annotationsResource annotations (e.g., audience, priority) — see ResourceAnnotations.
titleHuman-readable display title (defaults to name).
examplesArray of { name, uri } example entries surfaced in resources/list for discoverability.
completePer-variable completion callbacks for URI template variables. Keys match template variable names. Enables completion/complete and the completions capability.
cacheHint{ ttlMs?, cacheScope? } — how long a client may cache this resource's resources/read result on protocol revision 2026-07-28. See below.
Show full SKILL.md (304 more words)Show less
Cache hints (2026-07-28)

A resource that serves slow-changing data can declare how long its resources/read result stays fresh. ttlMs is the lifetime in milliseconds (a non-negative safe integer); cacheScope is 'private' (only the requesting client may cache it) or 'public' (shared caches may too).

typescript
export const referenceTable = resource('reference://units', {
  description: 'Unit conversion reference table.',
  cacheHint: { ttlMs: 86_400_000, cacheScope: 'public' },
  handler: () => UNIT_TABLE,
});

Resolution is per field, most specific first: the resource's own cacheHint, then the resources/read entry of createApp({ cacheHints }), then the SDK defaults (ttlMs: 0, cacheScope: 'private'). So a resource that names only a scope still inherits the server-wide lifetime.

Set a server-wide policy for the list operations alongside it — those results the SDK builds itself, so a resource cannot speak for them:

typescript
await createApp({
  cacheHints: {
    'tools/list': { ttlMs: 3_600_000, cacheScope: 'public' },
    'resources/read': { ttlMs: 60_000 },
  },
  resources: [referenceTable],
});

Cacheable operations are tools/list, prompts/list, resources/list, resources/templates/list, resources/read, and server/discover. Responses to 2025-era clients are unaffected — the hint only fills fields the 2026-07-28 revision defines.

Checklist

  • File created at src/mcp-server/resources/definitions/{{resource-name}}.resource.ts
  • Resource name passed to resource() uses a valid URI template with {paramName} syntax
  • All Zod params fields have .describe() annotations
  • output schema added if the handler returns structured data that benefits from runtime validation
  • JSDoc @fileoverview and @module header present
  • handler(params, ctx) is pure — throws on failure, no try/catch
  • If errors[] contract declared: every entry has a recovery field (≥5 words, lint-enforced)
  • Data is reachable via the tool surface — confirm by checking src/mcp-server/tools/definitions/ for a tool that exposes this data, or document why this resource is resources-only
  • list() function provided if the resource is discoverable
  • cacheHint set if the data is slow-changing and worth caching (ttlMs a non-negative safe integer)
  • Pagination used for large result sets (extractCursor/paginateArray) — applies to both handler data and list() catalogs with many entries
  • Registered in the project's existing createApp() resource list (directly or via barrel)
  • bun run devcheck passes
  • Smoke-tested with bun run rebuild && bun run start:stdio < /dev/null (or start:http); the Core services constructed record lists the new resource in its resources field

© cyanheads, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in framework-skills/add-resource of cyanheads/pubmed-mcp-server.

Open the folder on GitHubat commit 5a417fb

Compare with similar skills

Add Resource next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Resource compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Resource this skillcyanheads/pubmed-mcp-server156—~3kAutomated safety check: PassApache-2.0
Setting Up Papergraphlotchuazzz-crypto/papergraph-mcp285—~3.3kAutomated safety check: PassMIT
Just PRs MCPClawBio/ClawBio1.2k—~3.5kAutomated safety check: PassMIT
Patsnap Current Awarenesspatsnap/mcp113—~671Automated safety check: PassApache-2.0
Patsnap Scientific Translational Evidencepatsnap/mcp113—~728Automated safety check: PassApache-2.0
Peer Review Loophashgraph-online/awesome-codex-plugins1.3k—~2.3kAutomated safety check: PassApache-2.0

Similar skills

  • Setting Up Papergraph

    lotchuazzz-crypto/papergraph-mcp

    A skill your agent uses when a user has cloned PaperGraph MCP and asks to install, initialize, configure, set up, or start using it with an agent or MCP client.

    285 GitHub stars~3.3k tokensUpdated 2 days ago
    Agent WorkflowsAuto-check passed
  • Just PRs MCP

    ClawBio/ClawBio

    Compute evidence-aware polygenic risk scores from a local VCF or WGS file through the validated just-prs engine and a pinned local just-prs MCP server.

    1.2k GitHub stars~3.5k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Patsnap Current Awareness MCP for AI agents. An agent skill from patsnap/mcp.

    113 GitHub stars~671 tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Peer Review Loop

    hashgraph-online/awesome-codex-plugins

    Peer Review Ralph Loop — combines Cavekit kits with a Ralph Loop and true cross-model peer review using Codex (OpenAI).

    1.3k GitHub stars~2.3k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 63 repos~2.3k tokens
    Agent WorkflowsAuto-check passed

More from cyanheads/pubmed-mcp-server

All 30 skills in this repo
  • Add App Tool

    cyanheads/pubmed-mcp-server

    Scaffold an MCP App tool + UI resource pair. An agent skill from cyanheads/pubmed-mcp-server.

    156 GitHub stars~3.2k tokensUpdated 5 days ago
    Auto-check passed
  • Add Prompt

    cyanheads/pubmed-mcp-server

    Scaffold a new MCP prompt template. An agent skill from cyanheads/pubmed-mcp-server.

    156 GitHub stars~1.6k tokensUpdated 5 days ago
    Auto-check passed
  • Add Service

    cyanheads/pubmed-mcp-server

    Scaffold a new service integration. An agent skill from cyanheads/pubmed-mcp-server.

    156 GitHub stars~3.6k tokensUpdated 5 days ago
    Auto-check passed
  • Add Test

    cyanheads/pubmed-mcp-server

    Scaffold a test file for an existing tool, resource, or service.

    156 GitHub stars~4.1k tokensUpdated 5 days ago
    Auto-check passed
  • API Auth

    cyanheads/pubmed-mcp-server

    Authentication, authorization, and multi-tenancy patterns for @cyanheads/mcp-ts-core.

    156 GitHub stars~2.7k tokensUpdated 5 days ago
    Auto-check passed
  • API Mirror

    cyanheads/pubmed-mcp-server

    Stand up a persistent, self-refreshing local mirror of a bulk upstream dataset with the MirrorService (@cyanheads/mcp-ts-core/mirror).

    156 GitHub stars~2.5k tokensUpdated 5 days ago
    Auto-check passed

Questions about Add Resource

What does Add Resource do?

Scaffold a new MCP resource definition. An agent skill from cyanheads/pubmed-mcp-server. Add Resource is an agent skill from cyanheads/pubmed-mcp-server. Scaffold a new MCP resource definition.

When should I use Add Resource?

Add Resource fits situations like: the user asks to add a resource; expose data via URI; create a readable endpoint.

How do I install Add Resource in Claude Code?

Run `npx skills add cyanheads/pubmed-mcp-server --skill add-resource -a claude-code`. Or copy the skill folder (framework-skills/add-resource in cyanheads/pubmed-mcp-server) into .claude/skills/add-resource in your project. Claude Code loads it when a task matches its description.

How do I install Add Resource in Codex?

Run `npx skills add cyanheads/pubmed-mcp-server --skill add-resource -a codex`. Or copy the skill folder (framework-skills/add-resource in cyanheads/pubmed-mcp-server) into .agents/skills/add-resource in your project. Codex loads it when a task matches its description.

Can I use Add Resource in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cyanheads/pubmed-mcp-server --skill add-resource -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-resource, .gemini/skills/add-resource, .github/skills/add-resource and .opencode/skills/add-resource in your project.

What does Add Resource need to run?

Going by SKILL.md and its folder, Add Resource needs the command-line tools its instructions call (bun).

Does Add Resource access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add Resource safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add Resource use?

Add Resource is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Resource use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Resource?

Skills that share tags, products or a category with Add Resource: Setting Up Papergraph (lotchuazzz-crypto/papergraph-mcp, 285 stars), Just PRs MCP (ClawBio/ClawBio, 1.2k stars), Patsnap Current Awareness (patsnap/mcp, 113 stars) and Patsnap Scientific Translational Evidence (patsnap/mcp, 113 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Resource?

cyanheads (a GitHub user) maintains it in cyanheads/pubmed-mcp-server, which has 156 GitHub stars. The repository holds 30 skills in this directory. The repository was last updated on October 4, 2026.

Source: cyanheads/pubmed-mcp-server on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.