# MCP Server

SkillLane includes a Model Context Protocol (MCP) server that exposes its functionality as tools for MCP-compatible clients.

---

## Starting the Server

```bash
skilllane mcp
```

The server communicates via JSON-RPC over stdio (stdin/stdout).

---

## Protocol

Uses MCP protocol version `2024-11-05`.

### Server info

```json
{
  "name": "skilllane",
  "version": "0.1.0"
}
```

### Capabilities

```json
{
  "tools": {
    "listChanged": false
  }
}
```

---

## Tools

### skilllane_init

Initialize the local SkillLane registry and storage directory.

**Input:** (none)

**Output:**

```json
{"initialized": true}
```

---

### skilllane_create

Create a new skill with the specified configuration.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Skill name (kebab-case) |
| `description` | string | Yes | Skill description |
| `title` | string | No | Display title |
| `category` | string | No | Skill category |
| `tags` | string[] | No | Tags |
| `outDir` | string | No | Output directory |

**Output:** SkillDefinition object

---

### skilllane_validate

Validate a skill directory for correctness and completeness.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `path` | string | Yes | Path to skill directory |
| `strict` | boolean | No | Enable strict validation |

**Output:** SkillValidationResult with score, errors, warnings

---

### skilllane_install

Install a skill from a local path into the registry.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `source` | string | Yes | Source path to skill directory |
| `name` | string | No | Override skill name |
| `force` | boolean | No | Force overwrite existing |

**Output:** RegistryEntry object

---

### skilllane_list

List all installed skills.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tag` | string | No | Filter by tag |
| `category` | string | No | Filter by category |

**Output:** Array of RegistryEntry objects

---

### skilllane_search

Search installed skills by query.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | Search query |

**Output:** Array of matching RegistryEntry objects

---

### skilllane_show

Show detailed information about an installed skill.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Skill name |

**Output:** RegistryEntry object

---

### skilllane_run

Run an installed skill with the given task.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Skill name |
| `task` | string | Yes | Task to execute |
| `context` | object | No | Context for the task |
| `target` | string | No | Output target |

**Output:** SkillRunResult with prompt, tools, outputMode

---

### skilllane_remove

Remove an installed skill from the registry.

**Input:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Skill name |

**Output:**

```json
{"removed": "my-skill"}
```

---

### skilllane_doctor

Run system health checks.

**Input:** (none)

**Output:**

```json
{
  "healthy": true,
  "checks": [
    {"name": "storage", "status": "ok", "message": "Storage initialized"},
    {"name": "registry", "status": "ok", "message": "3 skills installed"},
    {"name": "node", "status": "ok", "message": "Node.js v22.0.0"}
  ]
}
```

---

### skilllane_demo

Run the SkillLane demo.

**Input:** (none)

**Output:**

```json
{
  "success": true,
  "output": "SkillLane v0.1.0 Demo\nStorage: initialized\nRegistry: ready"
}
```

---

### skilllane_registry_stats

Get registry statistics.

**Input:** (none)

**Output:**

```json
{
  "totalSkills": 3,
  "categories": {"engineering": 2, "marketing": 1},
  "tags": {"debugging": 1}
}
```

---

## Client Configuration

### Claude Desktop

```json
{
  "mcpServers": {
    "skilllane": {
      "command": "skilllane",
      "args": ["mcp"]
    }
  }
}
```

### OpenCode

```json
{
  "mcp": {
    "servers": {
      "skilllane": {
        "command": "skilllane",
        "args": ["mcp"]
      }
    }
  }
}
```

---

## Error Handling

Tool errors return an error response:

```json
{
  "content": [{"type": "text", "text": "Error: Skill not found: nonexistent"}],
  "isError": true
}
```

Unknown tool names return:

```json
{
  "content": [{"type": "text", "text": "Error: Unknown tool: unknown_tool"}],
  "isError": true
}
```
