home / skills / coleam00 / second-brain-skills / mcp-client

mcp-client skill

/.claude/skills/mcp-client

This skill connects to any MCP server on demand, loading tool schemas only when needed to keep context lean.

npx playbooks add skill coleam00/second-brain-skills --skill mcp-client

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
4.0 KB
---
name: mcp-client
description: Universal MCP client for connecting to any MCP server with progressive disclosure. Wraps MCP servers as skills to avoid context window bloat from tool definitions. Use when interacting with external MCP servers (Zapier, Sequential Thinking, GitHub, filesystem, etc.), listing available tools, or executing MCP tool calls. Triggers on requests like "connect to Zapier", "use MCP server", "list MCP tools", "call Zapier action", "use sequential thinking", or any MCP server interaction.
---

# Universal MCP Client

Connect to any MCP server with progressive disclosure - load tool schemas on-demand instead of dumping thousands of tokens into context upfront.

## Skill Location

This skill is located at: `.claude/skills/mcp-client/`

**Script path:** `.claude/skills/mcp-client/scripts/mcp_client.py`

## Configuration

The script looks for config in this order:
1. `MCP_CONFIG_PATH` env var (custom path)
2. **`references/mcp-config.json`** (this skill's config - recommended)
3. `.mcp.json` in project root
4. `~/.claude.json`

**Your config file:** `.claude/skills/mcp-client/references/mcp-config.json`

Edit this file to add your API keys. The example file (`example-mcp-config.json`) is kept as a reference template.

**If the user hasn't provided their Zapier API key yet, ask them for it.**

## Running Commands

All commands use the script at `.claude/skills/mcp-client/scripts/mcp_client.py`:

```bash
# List configured servers
python .claude/skills/mcp-client/scripts/mcp_client.py servers

# List tools from a server
python .claude/skills/mcp-client/scripts/mcp_client.py tools <server_name>

# Call a tool
python .claude/skills/mcp-client/scripts/mcp_client.py call <server> <tool> '{"arg": "value"}'
```

## Workflow

1. **Check config exists** - Run `servers` command. If error, create `.mcp.json`
2. **List servers** - See what MCP servers are configured
3. **List tools** - Get tool schemas from a specific server
4. **Call tool** - Execute a tool with arguments

## Commands Reference

| Command | Description |
|---------|-------------|
| `servers` | List all configured MCP servers |
| `tools <server>` | List tools with full parameter schemas |
| `call <server> <tool> '<json>'` | Execute a tool with arguments |

## Example: Zapier

```bash
# 1. List servers to confirm Zapier is configured
python .claude/skills/mcp-client/scripts/mcp_client.py servers

# 2. List Zapier tools
python .claude/skills/mcp-client/scripts/mcp_client.py tools zapier

# 3. Call a Zapier tool
python .claude/skills/mcp-client/scripts/mcp_client.py call zapier <tool_name> '{"param": "value"}'
```

## Example: Sequential Thinking

```bash
# 1. List tools
python .claude/skills/mcp-client/scripts/mcp_client.py tools sequential-thinking

# 2. Use sequential thinking
python .claude/skills/mcp-client/scripts/mcp_client.py call sequential-thinking sequentialthinking '{"thought": "Breaking down the problem...", "thoughtNumber": 1, "totalThoughts": 5, "nextThoughtNeeded": true}'
```

## Config Format

Config file format (`references/mcp-config.json`):

```json
{
  "mcpServers": {
    "zapier": {
      "url": "https://mcp.zapier.com/api/v1/connect",
      "api_key": "your-api-key"
    },
    "sequential-thinking": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
    }
  }
}
```

**Transport detection:**
- `url` + `api_key` → FastMCP with Bearer auth (Zapier)
- `command` + `args` → stdio (local servers like sequential-thinking)
- `url` ending in `/sse` → SSE transport
- `url` ending in `/mcp` → Streamable HTTP

## Error Handling

Errors return JSON:
```json
{"error": "message", "type": "configuration|validation|connection"}
```

- `configuration` - Config file not found. Create `.mcp.json`
- `validation` - Invalid server or tool name
- `connection` - Failed to connect to server

## Dependencies

```bash
pip install mcp fastmcp
```

## References

- `references/example-mcp-config.json` - Template config file
- `references/mcp-servers.md` - Common server configurations
- `references/python-mcp-sdk.md` - Python SDK documentation

Overview

This skill is a universal MCP client that connects to any MCP server with progressive disclosure. It loads tool schemas on-demand to avoid bloating the conversation context. Use it to list available MCP servers, inspect tool schemas, and execute remote MCP tool calls safely from a single Python script.

How this skill works

The skill reads configuration from several locations (MCP_CONFIG_PATH, a local reference config, .mcp.json, or ~/.claude.json) to discover servers and transport types. It supports HTTP (FastMCP with Bearer auth), stdio command transports, SSE, and streamable HTTP endpoints, and fetches tool schemas only when you request them. If a required credential (for example, a Zapier API key) is missing, the script will surface that and you should provide it in the config.

When to use it

  • Connect to an external MCP server such as Zapier, Sequential Thinking, GitHub, or a filesystem adapter.
  • Inspect available tools and their full parameter schemas without loading everything into your chat context.
  • Execute a specific MCP tool call with validated JSON arguments.
  • Confirm which MCP servers are configured in your environment before calling tools.
  • Debug connection or configuration issues with clear error types.

Best practices

  • Keep credentials in the recommended config file (references/mcp-config.json) or set MCP_CONFIG_PATH to a secure path.
  • List servers first to confirm configuration before calling tools (python ... mcp_client.py servers).
  • List tool schemas on-demand to avoid context bloat (python ... mcp_client.py tools <server>).
  • Validate JSON arguments against the displayed schema before calling tools to reduce runtime errors.
  • Install dependencies in a virtualenv: pip install mcp fastmcp.

Example use cases

  • Connect to Zapier, list available Zapier actions, then call a specific Zapier action with JSON params.
  • Run sequential-thinking via stdio transport to break a problem into numbered thoughts.
  • Query a GitHub-backed MCP server to list repository automation tools and trigger a workflow.
  • Use an SSE MCP endpoint for streaming tool responses while keeping tool schemas out of the chat context.
  • Use the servers command to audit what MCP backends are available in your environment.

FAQ

What config files are checked and in what order?

The skill checks MCP_CONFIG_PATH, then references/mcp-config.json, then .mcp.json in the project root, then ~/.claude.json.

What error types will I see?

Errors return JSON with an error message and type: configuration, validation, or connection.

How do I call a tool from the command line?

Use: python .claude/skills/mcp-client/scripts/mcp_client.py call <server> <tool> '<json>'.