File size: 1,626 Bytes
6cf94e6
 
 
 
 
 
 
 
 
 
c6d3e78
6cf94e6
 
c6d3e78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
title: Xkcd Mcp Server
emoji: πŸ“Š
colorFrom: purple
colorTo: blue
sdk: gradio
sdk_version: 5.34.2
app_file: app.py
pinned: false
license: mit
short_description: XKCD Remote MCP Server
---

# XKCD MCP Server

A Model Context Protocol (MCP) server for fetching and searching XKCD comics, built with Gradio.

## Features

- **Get XKCD Comic**: Fetch specific comics by ID or get the latest comic
- **Search Comics**: Search through recent comics by title, alt text, and transcript

## Installation

1. Install dependencies:
```bash
pip install -r requirements.txt
```

2. Run the server:
```bash
python app.py
```

## MCP Tools Available

### `get_xkcd_comic`
Fetch XKCD comic information by ID or get the latest comic.

**Parameters:**
- `comic_id` (str): Comic ID number (leave empty for latest comic)

**Returns:** JSON string with comic data including title, alt text, image URL, and metadata.

### `search_xkcd_transcript`
Search for XKCD comics by searching their transcripts and titles.

**Parameters:**
- `search_term` (str): Term to search for in comic transcripts and titles

**Returns:** JSON string with matching comics information.

## Deployment to Hugging Face Spaces

1. Create a new Space on Hugging Face
2. Upload `app.py` and `requirements.txt`
3. Set the Space to use Gradio SDK
4. Configure your MCP client to connect to the Space URL

## Usage with MCP Clients

Configure your MCP client (e.g., Claude Desktop) to connect to this server:

```json
{
  "servers": {
    "xkcd": {
      "command": "python",
      "args": ["app.py"]
    }
  }
}
```

Or use the Hugging Face Spaces URL if deployed online.