| name | mcp-client |
| domain | agent-tools |
| skill_type | skill |
| description | Universal MCP client for connecting to any MCP server directly from a skill. This replaces the old multi-agent pattern where the parent agent held all MCP tools — instead, each skill spawns its own MCP connection with only the tools it needs. |
| license | MIT |
| tags | ["mcp","client","fastmcp","tools","stdio","http","config"] |
| metadata | {"version":"1.2.1","author":"Genius"} |
MCP Client Skill
Universal MCP client for connecting to any MCP server directly from a skill. This replaces the old multi-agent pattern where the parent agent held all MCP tools — instead, each skill spawns its own MCP connection with only the tools it needs.
Usage
The mcp_client.py script is a robust, universal client. It separates informative logs (stderr) from machine-readable results (stdout), making it ideal for agent consumption.
General Options
| Flag | Description | Default |
|---|
--timeout | Timeout in seconds for connection and tool calls | 60 |
--debug | Enable verbose debugging logs to stderr | False |
--quiet | Suppress non-essential informative messages | False |
List Available Tools
python -m universal_skills.skills.mcp-client.scripts.mcp_client \
--command servicenow-mcp \
--args "--transport stdio" \
--env INCIDENTSTOOL=True \
--env CMDBTOOL=False \
--action list-mcp-tools
python -m universal_skills.skills.mcp-client.scripts.mcp_client \
--url http://github-mcp:8787/mcp \
--action list-mcp-tools
python -m universal_skills.skills.mcp-client.scripts.mcp_client \
--config mcp_config.json \
--server my-server \
--action list-mcp-tools
Call a Specific Tool
You can pass arguments as a JSON string or as a path to a JSON file.
Option A: JSON String
python -m universal_skills.skills.mcp-client.scripts.mcp_client \
--command servicenow-mcp \
--args "--transport stdio" \
--env INCIDENTSTOOL=True \
--dotenv .env \
--action call-mcp-tool \
--tool-name get_incidents \
--tool-args '{"sysparm_limit": "5"}'
Option B: JSON File
echo '{"sysparm_limit": "10", "sysparm_query": "active=true"}' > args.json
python -m universal_skills.skills.mcp-client.scripts.mcp_client \
--command servicenow-mcp \
--args "--transport stdio" \
--dotenv .env \
--action call-mcp-tool \
--tool-name get_incidents \
--tool-args args.json
Advanced: ServiceNow Flow to Mermaid
Generate full relationship diagrams for ServiceNow Flow Designer flows:
python -m universal_skills.skills.mcp-client.scripts.mcp_client \
--command servicenow-mcp \
--dotenv .env \
--action call-mcp-tool \
--tool-name workflow_to_mermaid \
--tool-args '{"flow_identifiers": ["sys_id_1", "sys_id_2"], "save_to_file": true, "output_dir": "."}'
The tool will generate a Markdown file containing the Mermaid diagrams, which you can then view in any Mermaid-compatible viewer.
Generate an mcp_config.json
Generate a config that enables only one tool tag and disables all others:
python -m universal_skills.skills.mcp-client.scripts.mcp_client \
--action generate-mcp-config \
--mcp-command servicenow-mcp \
--enable-tag INCIDENTSTOOL \
--all-tags "MISCTOOL,FLOWSTOOL,APPLICATIONTOOL,CMDBTOOL,CICDTOOL,PLUGINSTOOL,INCIDENTSTOOL,TABLE_APITOOL" \
-o mcp_config.json
List Resources and Prompts
python -m universal_skills.skills.mcp-client.scripts.mcp_client --config mcp_config.json --action list-mcp-resources
python -m universal_skills.skills.mcp-client.scripts.mcp_client --config mcp_config.json --action list-mcp-prompts
Programmatic Usage
The script exposes two key functions for import:
from universal_skills.skills.mcp_client.scripts.mcp_client import (
create_mcp_client,
generate_mcp_config,
)
config = generate_mcp_config(
mcp_command="servicenow-mcp",
enable_tag="INCIDENTSTOOL",
all_tags=["MISCTOOL", "INCIDENTSTOOL", "CMDBTOOL"],
)
import asyncio, json, tempfile
from pathlib import Path
async def main():
cfg_path = Path(tempfile.mktemp(suffix=".json"))
cfg_path.write_text(json.dumps(config))
client = await create_mcp_client(cfg_path)
async with client:
tools = await client.list_tools()
result = await client.call_tool("get_incidents", {"sysparm_limit": "5"})
print(result)
asyncio.run(main())
Arguments Reference
| Argument | Description |
|---|
--config | Path to mcp_config.json file |
--url | Remote MCP server URL (HTTP/HTTPS) |
--command | Local MCP server command (stdio) |
--server | Server name if config has multiple servers |
--args | Space-separated args for the MCP command |
--env | Environment variable KEY=VALUE (repeatable) |
--headers | HTTP header KEY=VALUE for remote (repeatable) |
--action | list-mcp-tools, call-mcp-tool, list-mcp-resources, list-mcp-prompts, generate-mcp-config |
--tool-name | Tool name for call-mcp-tool |
--tool-args | JSON arguments for call-mcp-tool (string OR path to .json file) |
--mcp-command | MCP command for generate-mcp-config |
--enable-tag | Env var to enable for generate-mcp-config |
--all-tags | Comma-separated list of all tool tag env vars |
-o, --output | Output file for generate-mcp-config |
Troubleshooting
- Timeout Errors: If you see "Operation timed out", increase the
--timeout value (e.g., --timeout 120).
- Connection Refused: Ensure the MCP server is running and the
--url or --command is correct.
- Dependency Issues: Run with
--debug to see detailed import or protocol errors.
- No Result on stdout: Check
stderr for errors. If using call-tool, the script should always output a JSON response even on failure.
References
The references/ directory contains ready-to-use documentation and mcp_config.json files for each MCP server. Each .md has stdio (default) + HTTP connection examples, available tool tags, and single-tag config examples.
Dependencies