一键导入
using-mcp
Discover, connect to, and invoke tools on MCP (Model Context Protocol) servers. CRITICAL - When the user message contains [@mcp:...] mention, you MUST load this skill first to use MCP tools correctly.
菜单
Discover, connect to, and invoke tools on MCP (Model Context Protocol) servers. CRITICAL - When the user message contains [@mcp:...] mention, you MUST load this skill first to use MCP tools correctly.
Use for reading, analyzing, summarizing, and converting complex documents into Markdown artifacts or other supported document formats.
Use when the user provides API keys, tokens, or other configuration values that should persist across sessions, or when the user asks to query, list, or delete saved environment variables. Manages personal env by default and workspace env only when explicitly requested.
Create, modify, evaluate, package, and upload skills. Use when users want to create a skill from scratch, edit or optimize an existing skill, run evals to test a skill, benchmark skill performance, optimize a skill's description for better triggering accuracy, package a skill into a zip, or upload a skill to their skill library. Also use when user asks to "capture this workflow as a skill", "make a skill for X", "turn this into a reusable skill", "package this skill", or "upload to my skill library".
Use when the user wants to interact with DingTalk/钉钉 in any way — including but not limited to: reading, querying, searching, sending, replying to, forwarding, or recalling DingTalk/钉钉 chat messages and chat history; managing group chats and conversations; sending DING alerts; querying contacts, org structure, AI search, or coworkers; reading, searching, creating, or editing DingTalk/钉钉 docs, drive files, sheets, AI tables, wiki, mail, calendar events, meeting rooms, AI meeting minutes, attendance, OA approvals, todos, reports/logs, live sessions, AI apps, permissions, or open-platform docs.
Use when the user wants to interact with Lark/Feishu/飞书 in any way — including but not limited to: reading, querying, searching, sending, replying to, forwarding, or downloading Lark/Feishu/飞书 IM messages and chat history; managing group chats; listing, viewing, searching, creating, or editing cloud docs/files, Drive, Markdown, spreadsheets, Base tables, wiki, whiteboards, slides, apps, calendars/events/meeting rooms, contacts/org structure, tasks/todos, approvals, attendance, mail, minutes, VC notes, OKRs, real-time events, or custom Lark CLI skills. Load this skill first to find the right sub-skill.
Complete API reference for window.Magic.* in SuperMagic HTML micro-apps (HTML 微应用). Read this skill when you need exact method signatures, parameters, return types, or usage examples for: fs (readFile/writeFile/listFiles/deleteFile/deleteDir/moveFile/renameFile/watchFile), llm (chat/stream/getModels), agent (getAgents/selectAgent), project (createTopicAndSend/sendMessage/uploadFiles/downloadFiles), user (getInfo with app.json userInfo scopes), getAppBasePath, setInputMessage, reload. Also covers tiptap JSON message format, @file and @skill mention structures, model selector UI rules, user info authorization, error handling patterns, and backward compatibility table. Trigger phrases: 'window.Magic API', 'readFile writeFile', 'deleteFile deleteDir', 'moveFile renameFile', 'watchFile callback', 'llm.stream', 'llm.chat', 'createTopicAndSend format', 'tiptap JSON mention', '@file mention structure', '@skill mention', 'getAppBasePath usage', 'model selector UI', 'user.getInfo', 'get user info', 'user avatar', 'user
| name | using-mcp |
| description | Discover, connect to, and invoke tools on MCP (Model Context Protocol) servers. CRITICAL - When the user message contains [@mcp:...] mention, you MUST load this skill first to use MCP tools correctly. |
| name-cn | MCP 工具调用技能 |
| description-cn | 发现并调用 MCP(Model Context Protocol)服务器上的工具。关键规则:当用户消息包含 [@mcp:...] 引用时,必须首先加载此技能。 |
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.
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:
run_sdk_snippet(python_code="""
from sdk.tool import tool
result = tool.call('mcp_list_servers', {})
print(result.content)
""")
tool.call(name, params) returns a Result with:
result.ok — boolean, check this firstresult.content — complete information for reasoning and next-step decisions| 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. |
Follow this order. Skipping steps will cause failures because tool names and parameters cannot be guessed.
1. mcp_list_servers → pick the server, read its `status`
├── status == 'connected' → go to step 3
└── status == 'disconnected' → go to step 2
2. mcp_connect_server → connect; receive the real tool list
3. mcp_get_tool_schema → fetch input schema(s)
4. mcp_call_tool → invoke with parameters that match the schema
When the user wants to register a brand-new MCP server, run mcp_add_server first, then proceed from step 1.
result.content.mcp_get_tool_schema before mcp_call_tool unless you already saw the schema in this conversation.mcp_* tools as standalone tool calls. They only work inside run_sdk_snippet via sdk.tool.call.result.ok before proceeding. Errors should be surfaced to the user, not silently retried.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}headers values: {"x-api-key": "${EXAMPLE_API_KEY}"}tokenenv values: {"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.
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.
run_sdk_snippet(python_code="""
from sdk.tool import tool
# 1. Discover servers
servers = tool.call('mcp_list_servers', {})
print(servers.content)
# Parse the server name from content, e.g. "<server_name> (status=connected, N tool(s))"
# 2. Connect if needed
connect = tool.call('mcp_connect_server', {'server_name': '<server_name>'})
if not connect.ok:
raise SystemExit(f'Connect failed: {connect.content}')
print(connect.content)
# 3. Inspect schema
schema = tool.call('mcp_get_tool_schema', {
'server_name': '<server_name>',
'tool_name': '<tool_name>',
})
print(schema.content)
# 4. Call the tool (tool_params is a JSON string matching the schema)
result = tool.call('mcp_call_tool', {
'server_name': '<server_name>',
'tool_name': '<tool_name>',
'tool_params': '{"key": "value"}',
})
print(result.content)
""")
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:
When to leave it empty:
Rules:
<workspace_dir>/data/<server>/<tool>.json. Do not rebuild it from
os.getcwd() or hard-code a path from another machine.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:
run_sdk_snippet(python_code="""
from sdk.tool import tool
result = tool.call('mcp_call_tool', {
'server_name': '<server_name>',
'tool_name': '<tool_name>',
'tool_params': '{"key": "value"}',
'output_file_path': '<workspace_dir>/data/<server_name>/<tool_name>.json',
})
print(result.content)
""")
run_sdk_snippet(python_code="""
from sdk.tool import tool
# stdio server (npx-based MCP).
# `args` MUST be a real list, not a space-separated string.
add = tool.call('mcp_add_server', {
'name': 'my-fs-server',
'server_type': 'stdio',
'command': 'npx',
'args': ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
'label_name': 'Filesystem',
})
print(add.content)
# stdio server with an API key injected into the subprocess environment.
# First save EXAMPLE_API_KEY with set_env, then register this template.
add = tool.call('mcp_add_server', {
'name': 'example-stdio-auth',
'server_type': 'stdio',
'command': 'npx',
'args': ['-y', '@example/mcp-server'],
'env': {'EXAMPLE_API_KEY': '${EXAMPLE_API_KEY}'},
'label_name': 'Example Stdio Auth',
})
print(add.content)
# http server example
add = tool.call('mcp_add_server', {
'name': 'my-api-server',
'server_type': 'http',
'url': 'http://localhost:3000/mcp',
'label_name': 'Custom API',
})
print(add.content)
# http server with an API key stored through env-manager.
# First save EXAMPLE_API_KEY with set_env, then register this template.
add = tool.call('mcp_add_server', {
'name': 'example-header-auth',
'server_type': 'http',
'url': 'https://mcp.example.com/http',
'headers': {'x-api-key': '${EXAMPLE_API_KEY}'},
'label_name': 'Example Header Auth',
})
print(add.content)
# URL query auth example for a reusable skill template.
add = tool.call('mcp_add_server', {
'name': 'example-query-auth',
'server_type': 'http',
'url': 'https://mcp.example.com/sse?key=${EXAMPLE_API_KEY}',
'label_name': 'Example Query Auth',
})
print(add.content)
""")
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.
tool_params to mcp_call_tool as a Python dict. It MUST be a JSON object string (e.g. '{"key": "value"}'); pass '{}' when no parameters are needed.mcp_call_tool without first checking mcp_get_tool_schema and supplying random parameter names. Always look at the schema first.args to mcp_add_server as a single string like '-y @pkg /tmp'. It MUST be a list of strings.mcp_list_tools without server_name as a way to "discover" tools on disconnected servers. It only returns tools from already-connected servers; use mcp_list_servers + mcp_connect_server to see disconnected ones.mcp_call_tool directly as a tool call (without run_sdk_snippet). It will be rejected because these tools are Code Mode only.output_file_path as 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.