dtyq/magic/using-mcp
Claude Code and agent skill by dtyq/magic
- community
Checking that the SKILL.md file is still in the repository.
Discover, connect to, and invoke tools on referenced MCP servers. Load this skill when an MCP server is referenced through an mcp:// typed link or MCP mention.
Install
npx vskill@latest install dtyq/magic/using-mcpSKILL.md
The same SKILL.md was published earlier as dtyq/magic/using-mcp.
MCP Tools Calling Skill
Use this skill whenever you need to talk to an MCP server: list servers, connect to one, inspect a tool's schema, or invoke a tool.
How it works
The six MCP capabilities are exposed as Code Mode tools (mcp_*). They are NOT directly callable as standalone tool calls. You must invoke them through run_sdk_snippet and sdk.tool.call:
tool.call(name, params) returns a Result with:
result.ok— boolean, check this firstresult.content— complete information for reasoning and next-step decisions
Available MCP tools
| Tool name | Purpose | |
|---|---|---|
mcp_list_servers | List all MCP servers in the current chat with their connection status. Always start here. | |
mcp_connect_server | Connect a server whose status is disconnected. Returns the real tool list. | |
mcp_list_tools | List tools across connected servers, optionally filtered by server_name. | |
mcp_get_tool_schema | Fetch the JSON input schema of one or more tools before calling them. | |
mcp_call_tool | Invoke a specific tool on a server. The actual remote call. | |
mcp_add_server | Register a new MCP server config (stdio or http). Does NOT connect immediately. | |
mcp_remove_server | Remove an MCP server: disconnect, unregister tools, and delete persisted config. |
Standard workflow
Follow this order. Skipping steps will cause failures because tool names and parameters cannot be guessed.
When the user wants to register a brand-new MCP server, run mcp_add_server first, then proceed from step 1.
Rules
- NEVER fabricate server names, tool names, or parameter names. Always derive them from the previous step's
result.content. - ALWAYS call
mcp_get_tool_schemabeforemcp_call_toolunless you already saw the schema in this conversation. - NEVER call
mcp_*tools as standalone tool calls. They only work insiderun_sdk_snippetviasdk.tool.call. - ALWAYS check
result.okbefore proceeding. Errors should be surfaced to the user, not silently retried.
Authentication and MCP configuration errors
When an MCP tool returns an error that indicates authentication or a missing credential — for example 未登录, 密钥错误, invalid key, unauthorized, or HTTP 401/403 — tell the user that the MCP key or another MCP configuration value may be incorrect and ask them to check the MCP configuration. Do not silently retry the same request or claim that the key is definitely wrong unless the server explicitly confirms it.
Environment variables in reusable MCP configs
MCP configs can be written as reusable templates in skills. Put sensitive values behind ${VAR_NAME} placeholders, and ask the user to save their own value with env-manager before registering or connecting the MCP server.
Supported placeholder locations:
url, including query parameters:https://mcp.example.com/sse?key=${EXAMPLE_API_KEY}headersvalues:{"x-api-key": "${EXAMPLE_API_KEY}"}token- stdio
envvalues:{"EXAMPLE_API_KEY": "${EXAMPLE_API_KEY}"}
Do not put personal API keys directly in skill docs or MCP config templates. If a referenced env variable is missing or unusable, connecting the MCP server fails with the missing variable name. The secret value is not written into the persisted MCP config.
Only the fields above are resolved. Do not use ${VAR_NAME} in name, description, command, or args.
End-to-end example
User asks to call a tool on some MCP server. The flow below uses angle- bracket placeholders (<server_name>, <tool_name>, <workspace_dir>, etc.); replace every <...> with the real value from your context or from the previous step before running the snippet.
Saving the call result to a file (output_file_path)
mcp_call_tool accepts an optional output_file_path to persist the result as a JSON file in the workspace, instead of consuming it only in your reasoning context.
When to set it:
- The result is likely to be large (for example a SQL query without WHERE or
LIMIT that may return thousands of rows, fetching a full article body, or exporting a long list).
- The user expects a concrete file deliverable (a report, dataset dump,
attachment-like artifact).
- A downstream step needs a stable on-disk path to open later.
When to leave it empty:
- You only need the data for your own reasoning. Small results are returned
inline; oversized results are auto-persisted in the background to avoid flooding the context, so you do not need to manage that yourself.
Rules:
- The path MUST be absolute. Relative paths are rejected and the call
silently falls back to the runtime directory.
- Prefer a location inside the current workspace so the file is easy for
the user to inspect and accept as a deliverable. The workspace path is already available in your context — just prepend it directly, e.g. <workspace_dir>/data/<server>/<tool>.json. Do not rebuild it from os.getcwd() or hard-code a path from another machine.
- The file MUST be JSON. Pick a meaningful filename and a tidy directory
layout, for example reports/<topic>/<name>.json or data/<server>/<tool>.json.
Example — deliver the call result as a workspace file. Replace every <...> with real values: <workspace_dir> is the workspace path already visible in your context, and <server_name> / <tool_name> come from the previous discovery steps:
Adding a new server
After mcp_add_server, the server status is disconnected. Run mcp_connect_server (or just call any tool on it — connection happens on demand) before invoking its tools.
Common pitfalls
- Passing
tool_paramstomcp_call_toolas a Python dict. It MUST be a JSON object string (e.g.'{"key": "value"}'); pass'{}'when no parameters are needed. - Calling
mcp_call_toolwithout first checkingmcp_get_tool_schemaand supplying random parameter names. Always look at the schema first. - Passing
argstomcp_add_serveras a single string like'-y @pkg /tmp'. It MUST be a list of strings. - Treating
mcp_list_toolswithoutserver_nameas a way to "discover" tools on disconnected servers. It only returns tools from already-connected servers; usemcp_list_servers+mcp_connect_serverto see disconnected ones. - Trying to call
mcp_call_tooldirectly as a tool call (withoutrun_sdk_snippet). It will be rejected because these tools are Code Mode only. - Passing
output_file_pathas a relative path like'reports/data.json'. It is rejected and the call silently falls back to the runtime directory, so the user never sees the file. Always build an absolute path, and prefer placing it under the current workspace.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingbackend/super-magic/agents/skills/using-mcp/SKILL.md
Popularity
- Repository stars
- 5,089
- Repository forks
- 570
- 7-day trend score
- 42
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 15 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dtyq/magic/using-mcp)