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.
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsnpx agentmods add commands/matt-dionis/claude-code-configs/add-resourceWrote 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.
[](https://agentmods.dev/commands/matt-dionis/claude-code-configs/add-resource)<a href="https://agentmods.dev/commands/matt-dionis/claude-code-configs/add-resource"><img src="https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/add-resource/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.
<a href="https://agentmods.dev/commands/matt-dionis/claude-code-configs/add-resource"><img src="https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/add-resource.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01680 |
| Opus 5.5 | $0.00000 | $0.00672 |
| Sonnet 5.5 | $0.00000 | $0.00336 |
| Haiku 4.5 | $0.00000 | $0.00168 |
Grade A, and why
add-resource 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 3mo ago.
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.
How it starts
The opening of the file, as written. The whole thing — 243 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Add Resource to MCP Server
Adds a new resource endpoint to your MCP server with proper URI handling.
Usage
/add-resource <name> <description> [uri-pattern] [mime-type]
Examples
/add-resource config "Server configuration" config://settings application/json
/add-resource users "User database" data://users/{id} application/json
/add-resource files "File system access" file:///{path} text/plain
Implementation
import * as fs from 'fs/promises';
import * as path from 'path';
async function addResource(
name: string,
description: string,
uriPattern?: string,
mimeType: string = 'application/json'
) {
// Generate URI pattern if not provided
const uri = uriPattern || `${name}://default`;
// Generate resource file
const resourceContent = generateResourceFile(name, description, uri, mimeType);
// Write resource file
const resourcePath = path.join('src/resources', `${name}.ts`);
await fs.writeFile(resourcePath, resourceContent);
// Update resource index
await updateResourceIndex(name);
// Generate test file
const testContent = generateResourceTest(name, uri);
const testPath = path.join('tests/unit/resources', `${name}.test.ts`);
await fs.writeFile(testPath, testContent);
console.log(`✅ Resource "${name}" added successfully!`);
console.log(` - Implementation: ${resourcePath}`);
console.log(` - Test file: ${testPath}`);
console.log(` - URI pattern: ${uri}`);
console.log(` - MIME type: ${mimeType}`);
console.log(`\nNext steps:`);
console.log(` 1. Implement the resource provider in ${resourcePath}`);
console.log(` 2. Test with MCP Inspector`);
}
function generateResourceFile(
name: string,
description: string,
uri: string,
mimeType: string
): string {
const hasDynamicParams = uri.includes('{');
return `
import type { Resource, ResourceContent } from '../types/resources.js';
export const ${name}Resource: Resource = {
uri: '${uri}',
name: '${name}',
description: '${description}',
mimeType: '${mimeType}',
};
export async function read${capitalize(name)}Resource(
uri: string
): Promise<ResourceContent[]> {
${hasDynamicParams ? generateDynamicResourceHandler(uri) : generateStaticResourceHandler()}
return [
{
uri,
mimeType: '${mimeType}',
text: ${mimeType === 'application/json' ? 'JSON.stringify(data, null, 2)' : 'data'},
},
];
}
${generateResourceDataFunction(name, mimeType)}
`;
}
function generateDynamicResourceHandler(uriPattern: string): string {
return `
// Parse dynamic parameters from URI
const params = parseUriParams('${uriPattern}', uri);
// Fetch data based on parameters
const data = await fetch${capitalize(name)}Data(params);
if (!data) {
throw new Error(\`Resource not found: \${uri}\`);
}
`;
}
function generateStaticResourceHandler(): string {
return `
// Fetch static resource data
const data = await fetch${capitalize(name)}Data();
`;
}
function generateResourceDataFunction(name: string, mimeType: string): string {
if (mimeType === 'application/json') {
return `
async function fetch${capitalize(name)}Data(params?: Record<string, string>) {
// TODO: Implement data fetching logic
// This is a placeholder implementation
if (params?.id) {
// Return specific item
return {
id: params.id,
name: 'Example Item',
timestamp: new Date().toISOString(),
};
}
// Return collection
return {
items: [
{ id: '1', name: 'Item 1' },
{ id: '2', name: 'Item 2' },
],
total: 2,
};
}
function parseUriParams(pattern: string, uri: string): Record<string, string> {
// Convert pattern to regex
const regexPattern = pattern
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/\{(\w+)\}/g, '(?<$1>[^/]+)');
const regex = new RegExp(\`^\${regexPattern}$\`);
const match = uri.match(regex);
return match?.groups || {};
}
`;
} else {
return `
async function fetch${capitalize(name)}Data(params?: Record<string, string>) {
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.
- 3mo ago First seen · 243 lines · 0 tokens per session scan A 226e1eae561f
add-resource is a command published in the GitHub repository Matt-Dionis/claude-code-configs (619 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,680 tokens. 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-30.
add-resource compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| add-resourceMatt-Dionis/claude-code-configs | Command | 619 | 1y ago | MIT | A | 0 | Claude Code |
| initfcakyon/claude-codex-settings | Command | 1.2k | today | Apache-2.0 | A | 0 | Claude Code |
| http-serviceMadAppGang/magus | Command | 16 | today | MIT | A | 27 | Claude Code |
| api-contract-reviewMozurok/fhorja.dev | Command | 10 | 1mo ago | MIT | A | 64 | Claude Code |
| buildAzure/ai-gateway | Command | 5 | 1mo ago | MIT | A | 0 | Claude Code |
| start-10-1minicoohei/ai-agent-camp | Command | 346 | 1mo ago | none | A | 2 | Claude Code |
| fastapimfmezger/ai_agent_dotfiles | Command | 7 | 4mo ago | MIT | A | 84 | Claude Code, Gemini CLI |