mcp-adapter
Summary
TL;DR: MCP Adapter lets your AI agent connect to any MCP (Model Context Protocol) server, giving it access to tools and data sources without custom integration work.
mcp-adapter is an OpenClaw skill that use Model Context Protocol servers to access external tools and data sources. Enable AI agents to discover and execute tools from configured MCP servers (legal databases, APIs, database connectors, weather services, etc.).
Created by lunarpulse, this skill has been downloaded 4k+ times on ClawHub. Install it with one command and your AI agent gains these capabilities right away.
Use cases
- Connect your agent to a company's internal MCP server exposing proprietary tools
- Chain multiple MCP servers together so your agent can use tools from different providers in one workflow
- Test and debug MCP server implementations by routing agent requests through the adapter
- Add MCP-based tools to an existing agent setup without rewriting your integration layer
Installation
Run this command to install the skill on your OpenClaw agent:
npx clawhub@latest install mcp-adapterSecurity scan
The plugin's code, docs, and runtime instructions are coherent with its stated purpose of discovering and calling Model Context Protocol (MCP) servers, but it grants the normal network privileges required to call arbitrary configured serversβso you should only point it at servers you trust and review configuration for secrets.
SKILL.md
---
name: mcp-integration
description: Use Model Context Protocol servers to access external tools and data sources. Enable AI agents to discover and execute tools from configured MCP servers (legal databases, APIs, database connectors, weather services, etc.).
license: MIT
---
# MCP Integration Usage Guide
## Overview
Use the MCP integration plugin to discover and execute tools provided by external MCP servers. This skill enables you to access legal databases, query APIs, search databases, and integrate with any service that provides an MCP interface.
The plugin provides a unified `mcp` tool with two actions:
- `list` - Discover available tools from all connected servers
- `call` - Execute a specific tool with parameters
---
# Process
## π Phase 1: Tool Discovery
### 1.1 Check Available Tools
**Always start by listing available tools** to see what MCP servers are connected and what capabilities they provide.
**Action:**
```
{
tool: "mcp",
args: {
action: "list"
}
}
```
**Response structure:**
```json
[
{
"id": "server:toolname",
"server": "server-name",
"name": "tool-name",
"description": "What this tool does",
"inputSchema": {
"type": "object",
"properties": {...},
"required": [...]
}
}
]
```
### 1.2 Understand Tool Schemas
For each tool, examine:
- **id**: Format is `"server:toolname"` - split on `:` to get server and tool names
- **description**: Understand what the tool does
- **inputSchema**: JSON Schema defining parameters
- `properties`: Available parameters with types and descriptions
- `required`: Array of mandatory parameter names
### 1.3 Match Tools to User Requests
Common tool naming patterns:
- `search_*` - Find or search operations (e.g., `search_statute`, `search_users`)
- `get_*` - Retrieve specific data (e.g., `get_statute_full_text`, `get_weather`)
- `query` - Execute queries (e.g., `database:query`)
- `analyze_*` - Analysis operations (e.g., `analyze_law`)
- `resolve_*` - Resolve references (e.g., `resolve_citation`)
---
## π― Phase 2: Tool Execution
### 2.1 Validate Parameters
Before calling a tool:
1. Identify all required parameters from `inputSchema.required`
2. Verify parameter types match schema (string, number, boolean, array, object)
3. Check for constraints (minimum, maximum, enum values, patterns)
4. Ensure you have necessary information from the user
### 2.2 Construct Tool Call
**Action:**
```
{
tool: "mcp",
args: {
action: "call",
server: "<server-name>",
tool: "<tool-name>",
args: {
// Tool-specific parameters from inputSchema
}
}
}
```
**Example - Korean legal search:**
```
{
tool: "mcp",
args: {
action: "call",
server: "kr-legal",
tool: "search_statute",
args: {
query: "μ°μ₯κ·Όλ‘ μλΉ",
limit: 5
}
}
}
```
### 2.3 Parse Response
Tool responses follow this structure:
```json
{
"content": [
{
"type": "text",
"text": "JSON string or text result"
}
],
"isError": false
}
```
For JSON responses:
```javascript
const data = JSON.parse(response.content[0].text);
// Access data.result, data.results, or direct properties
```
---
## π Phase 3: Multi-Step Workflows
### 3.1 Chain Tool Calls
For complex requests, execute multiple tools in sequence:
**Example - Legal research workflow:**
1. **Search** - `search_statute` to find relevant laws
2. **Retrieve** - `get_statute_full_text` for complete text
3. **Analyze** - `analyze_law` for interpretation
4. **Precedents** - `search_case_law` for related cases
Each step uses output from the previous step to inform the next call.
### 3.2 Maintain Context
Between tool calls:
- Extract relevant information from each response
- Use extracted data as parameters for subsequent calls
- Build up understanding progressively
- Present synthesized results to user
---
## β Phase 4: Error Handling
### 4.1 Common Errors
**"Tool not found: server:toolname"**
- Cause: Server not connected or tool doesn't exist
- Solution: Run `action: "list"` to verify available tools
- Check spelling of server and tool names
**"Invalid arguments for tool"**
- Cause: Missing required parameter or wrong type
- Solution: Review `inputSchema` from list response
- Ensure all required parameters provided with correct types
**"Server connection failed"**
- Cause: MCP server not running or unreachable
- Solution: Inform user service is temporarily unavailable
- Suggest alternatives if possible
### 4.2 Error Response Format
Errors return:
```json
{
"content": [{"type": "text", "text": "Error: message"}],
"isError": true
}
```
**Handle gracefully:**
- Explain what went wrong clearly
- Don't expose technical implementation details
- Suggest next steps or alternatives
- Don't retry excessively
---
# Complete Example
## User Request: "Find Korean laws about overtime pay"
### Step 1: Discover tools
```
{tool: "mcp", args: {action: "list"}}
```
Response shows `kr-legal:search_statute` with:
- Required: `query` (string)
- Optional: `limit` (number), `category` (string)
### Step 2: Execute search
```
{
tool: "mcp",
args: {
action: "call",
server: "kr-legal",
tool: "search_statute",
args: {
query: "μ°μ₯κ·Όλ‘ μλΉ",
category: "λ
Έλλ²",
limit: 5
}
}
}
```
### Step 3: Parse and present
```javascript
const data = JSON.parse(response.content[0].text);
// Present data.results to user
```
**User-facing response:**
```
Found 5 Korean statutes about overtime pay:
1. κ·Όλ‘κΈ°μ€λ² μ 56μ‘° (μ°μ₯Β·μΌκ° λ° ν΄μΌ κ·Όλ‘)
- Overtime work requires 50% premium
2. κ·Όλ‘κΈ°μ€λ² μ 50μ‘° (κ·Όλ‘μκ°)
- Standard working hours: 40 hours per week
Would you like me to retrieve the full text of any statute?
```
---
# Quick Reference
## List Tools
```
{tool: "mcp", args: {action: "list"}}
```
## Call Tool
```
{
tool: "mcp",
args: {
action: "call",
server: "server-name",
tool: "tool-name",
args: {param1: "value1"}
}
}
```
## Essential Patterns
**Tool ID parsing:** `"server:toolname"` β split on `:` for server and tool names
**Parameter validation:** Check `inputSchema.required` and `inputSchema.properties[param].type`
**Response parsing:** `JSON.parse(response.content[0].text)` for JSON responses
**Error detection:** Check `response.isError === true`
---
# Reference Documentation
## Core Documentation
- **Plugin README**: [README.md](README.md) - Installation and configuration
- **Real Example**: [REAL_EXAMPLE_KR_LEGAL.md](docs/REAL_EXAMPLE_KR_LEGAL.md) - Working kr-legal setup
- **API Reference**: [API.md](docs/API.md) - Technical API details
- **Configuration**: [CONFIGURATION.md](docs/CONFIGURATION.md) - Server configuration guide
- **Troubleshooting**: [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) - Common issues and solutions
## Usage Examples
- **Examples Collection**: [EXAMPLES.md](docs/EXAMPLES.md) - 13 real-world examples including:
- Legal research workflows
- Database queries
- Weather service integration
- Multi-step complex workflows
- Error handling patterns
---
**Remember:** Always start with `action: "list"` when uncertain about available tools.
Version history
- Initial release as "mcp-integration" for accessing external data and tool APIs via the Model Context Protocol. - Provides unified `mcp` tool with `list` and `call` actions for tool discovery and execution. - Includes detailed usage guide covering tool discovery, parameter validation, tool execution, response parsing, error handling, and multi-step workflows. - Added real-world examples, error handling patterns, and reference links for setup and troubleshooting. - Designed to enable AI agents to integrate external services such as legal databases, APIs, and weather data through MCP servers.
Frequently asked questions
MCP Adapter works with any server that implements the Model Context Protocol specification. This includes both stdio-based and HTTP-based MCP servers, regardless of who built them.
Installation method
Send this prompt to your agent to install the skill
npx clawhub@latest install mcp-adapterSkill info
Files
Skill data sourced from ClawHub