# Build MCP Resource Servers

MCP server authors need repeatable patterns for exposing files, records, and API data as resources. This skill guides URI design, listing, fetching, MIME handling, caching, streaming, and testing for Claude, Codex, and Claude Code.

## Install

```bash
npx skillstore add emillindfors/mcp-resources-guide
```

## Metadata

- Status: approved
- Slug: emillindfors-mcp-resources-guide
- Skillstore revision: r1
- Version status: missing
- Tree hash: 203052be4ba9183ec50099e75ce24a12a9ad189b5b22d5648851a1c0fbdf7c4c
- Author: EmilLindfors
- GitHub username: EmilLindfors
- License: MIT
- Repository: https://github.com/EmilLindfors/claude-marketplace/tree/main/plugins/rust-mcp-server/skills/mcp-resources-guide
- Ref: 30c73eac2afe762f6aa9c4553158769369d47351
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: confirmation\_required
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, filesystem, env\_access
- Quality score: 38
- Quality tier: warning
- Public page: https://skillstore.pages.dev/skills/emillindfors-mcp-resources-guide
- Manifest: https://skillstore.pages.dev/api/skills/emillindfors-mcp-resources-guide/manifest

## Capabilities

- Explains URI schemes and templates for file, database, API, and metrics resources.
- Shows Rust rmcp examples for listing resources and fetching resource content.
- Covers MIME type selection for text, markdown, JSON, Rust, TOML, and binary data.
- Describes in-memory caching, lazy loading, and TTL-based cache checks.
- Outlines tests for valid URIs, invalid URIs, edge cases, and performance.

## Use Cases

- Expose Project Files as Resources: Design URI schemes, metadata, MIME types, and fetch behavior for project documentation or source files.
- Model Database Records as Resources: Plan how database records should be addressed, listed, fetched, cached, and represented for assistant context.
- Optimize Large Resource Delivery: Apply caching, lazy loading, binary handling, and streaming patterns for large or expensive resource sources.

## Prompt Templates

### Design a Basic Resource

```
Help me design an MCP resource for [data source]. Include the URI scheme, listed metadata, MIME type, and expected fetch result.
```

### Plan Resource Templates

```
Create resource URI templates for [entities]. Explain list behavior, fetch behavior, invalid URI handling, and example resource names.
```

### Review Resource Security

```
Review my MCP resource design for path traversal, SQL injection, credential exposure, authorization gaps, cache leakage, and unsafe URI parsing.
```

### Design Caching and Streaming

```
Design a caching, invalidation, and streaming strategy for MCP resources backed by [large or expensive source]. Include limits, errors, and tests.
```

## Limitations

- Examples are instructional and need security hardening before production use.
- It does not provide a complete runnable MCP server scaffold.
- It does not cover authentication, authorization, or tenant isolation in detail.
- It focuses on Rust rmcp patterns rather than other MCP SDKs.

## Best Practices

- Validate every URI component before using it in filesystem paths, database queries, or API URLs.
- Document resource schemes, MIME types, cache lifetimes, and invalidation rules.
- Keep resource fetching read-only, observable, and covered by success and failure tests.

## Anti Patterns

- Joining URI paths directly to filesystem roots without canonicalization.
- Building SQL identifiers or queries from URI text without an allowlist.
- Caching sensitive or tenant-specific resources without scoped keys and expiry.

## Security Audit

- Audited at: 2026-07-05T14:46:36.797\+00:00
- Summary: Most static findings are false positives caused by markdown code fences or illustrative Rust examples, not active command execution, secret access, or obfuscation. The audit found real insecure guidance in the examples: file URI parsing can escape a configured root, symlink following can expose unintended files, and a database example builds SQL from URI-derived table text.

## Stats

- Views: 216
- Downloads: 8
- Favorites: 0
- Popularity score: 0
