agentleFS
patonkikhpatonkikh/APES/skills/mcp/mcp-client-generator/skill.md

mcp-client-generator

Skill3 starsChanged 4 months agoMITView on GitHub

Generate MCP client integration: connection setup, capability discovery, tool invocation patterns, and error handling for agent applications. Use when working on MCP servers, MCP tools, MCP clients, or Model Context Protocol integrations.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Document server startup command (stdio) or endpoint URL (HTTP).

    line 30
  2. Distinctive:

    Document argument validation before send (client-side schema check).

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

MCP Client Generator

Purpose

Generate MCP client integration: connection setup, capability discovery, tool invocation patterns, and error handling for agent applications.

Input: Target MCP server(s), host application type (agent IDE, backend service, CLI), auth model, required capabilities
Output: MCP Client Integration Specification with connection config, invocation patterns, and test plan Examples: See examples.md for worked input/output.


Workflow

Step 1: Inventory MCP servers

ServerTransportCapabilities neededAuth method
stdio / HTTPtools, resourcesenv / OAuth

Document server startup command (stdio) or endpoint URL (HTTP).

Step 2: Design connection lifecycle

Init → Connect → Discover capabilities → Cache schema → Invoke → Disconnect/Reconnect
PhaseResponsibilityTimeout
ConnectSpawn process or HTTP handshake10s
Discoverlist_tools, list_resources5s
Invokecall_tool, read_resourcePer-tool SLA
ReconnectOn disconnect with backoffExponential

Step 3: Define client configuration

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "package-name"],
      "env": { "API_KEY": "${API_KEY}" }
    }
  }
}

For HTTP servers: base URL, headers, auth token injection.

Step 4: Design invocation patterns

PatternUse case
Direct callAgent selects tool with args
Wrapper functionApplication abstracts tool names
Resource prefetchLoad context before agent turn
Prompt templateServer-provided prompt with args

Document argument validation before send (client-side schema check).

Step 5: Plan error handling

ErrorClient action
Connection refusedRetry 3x with backoff; surface to user
Tool execution errorParse structured error; retry if retryable
TimeoutCancel; return partial result flag
Schema mismatchLog; do not retry; report to server maintainer

Step 6: Validate

Run Validation checklist.


Decision Rules

ConditionAction
Multiple servers with overlapping toolsNamespace tool names in wrapper layer
stdio server in production backendPrefer HTTP transport or sidecar pattern
User-specific OAuth per serverStore tokens securely; refresh before expiry
Tool args from LLM outputValidate against JSON Schema before invocation
Server not yet builtGenerate client against capability manifest from mcp-server-generator
High-frequency tool callsAdd client-side rate limiter and connection pool

Validation

  • All target servers documented with transport and auth
  • Connection lifecycle with timeouts defined
  • Configuration template provided (no real secrets)
  • Invocation patterns match application architecture
  • Error handling per error type
  • Capability discovery and schema caching planned
  • Test plan: connect, list tools, invoke, error cases
  • Logging excludes sensitive args and tokens

Anti-patterns

  • Hardcoded tool list — skipping discovery; breaks on server updates.
  • Unvalidated LLM args — passing raw model output directly to tools.
  • Secret in config file — committing tokens to version control.
  • No timeout — hanging client on unresponsive server.
  • Tight coupling — application logic embedded in MCP transport layer.

Best Practices

  • Cache discovered tool schemas with TTL; refresh on connect.
  • Wrap MCP calls in application service layer, not in UI code.
  • Log tool name and duration; redact arguments containing PII.
  • Support graceful degradation when server unavailable.
  • Pair with mcp-security-review for production auth patterns.

Output Structure

# MCP Client Integration: [Application Name]

## Server Inventory
| Server | Transport | Auth | Startup |
|--------|-----------|------|---------|

## Connection Lifecycle
[Phases, timeouts, reconnect policy]

## Configuration
[Template with placeholders]

## Invocation Patterns
| Pattern | Tool/Resource | Wrapper API |
|---------|---------------|-------------|

## Error Handling
| Error | Action | User message |
|-------|--------|--------------|

## Test Plan
| Case | Steps | Expected |
|------|-------|----------|

## Security Notes
[Token storage, log redaction]

Next Skills

OutcomeRecommended Skill
Build the MCP servermcp/mcp-server-generator
Design tools consumed by clientmcp/mcp-tool-generator
Security reviewmcp/mcp-security-review
Production patternsmcp/mcp-best-practices
Agent workflow using toolsai/ai-workflow-builder

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.