Quick Start

1. Initialize the Project

mkdir my-trading-skill
cd my-trading-skill
npm init -y

2. Install Dependencies

package.json:

{
  "name": "my-trading-skill",
  "version": "1.0.0",
  "type": "module",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
    "dev": "node --watch server.js"
  },
  "dependencies": {
    "@modelcontextprotocol/sdk": "^1.0.0",
    "dotenv": "^16.6.1",
    "express": "^4.18.2"
  }
}

Install packages:


Core Implementation

Base Server Structure


Defining Trading Tools

The Skill exposes abilities to the AI Agent through Tools. Example: open position tool.


Tool Handler Implementation


Trading Operations Implementation

Open Position


HTTP Endpoints

The Skill must expose an HTTP endpoint for MCP communication:


Authorization Mechanism

Skill Token Workflow

Notes

  • skill_token is generated by WildMeta frontend via wallet signature

  • AI Agent automatically injects the token into tool calls

  • Skills must include this token when calling WildMeta DEX API


Security Best Practices

1. Token Validation

2. Risk Controls

3. Logging

4. Error Handling


Testing

Create a script: test.sh


Full Example

For a complete example, refer to:

mcp-wildmeat-trader/server.js

It includes:

  • Full Skill server setup

  • Multiple tools (open, close, cancel order)

  • WildMeta DEX API integration

  • Error handling

  • Logging

  • Security checks

Last updated