File size: 2,033 Bytes
9e2c10a
972c4ff
 
 
 
 
9e2c10a
88c90c5
9e2c10a
972c4ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Confusables MCP Server
emoji: "🕵️‍♂️"
colorFrom: indigo
colorTo: red
sdk: docker
pinned: false
license: apache-2.0
---

# Confusables MCP Server 💬

A FastMCP-based server exposing the main features of the `confusables` library as MCP tools. This project allows LLMs and other clients to detect visually confusable Unicode characters, generate regexes for confusables, and normalize strings, all via a standardized MCP interface.

## Features
- **is_confusable**: Check if two strings are visually confusable.
- **confusable_characters**: List all Unicode characters visually confusable with a given character.
- **confusable_regex**: Generate a regex matching all confusable variants of a string.
- **normalize**: Return all possible normalized forms of a string (ASCII/Latin-alphabet equivalents).

## Installation

Clone the repository and install dependencies:

```bash
pip install -r requirements.txt
```

## Usage

Start the FastMCP server:

```bash
python app.py
```

The server will run on `0.0.0.0:7860` by default.

## API (MCP Tools)

### is_confusable_tool
- **Description**: Check if two strings are visually confusable.
- **Arguments**:
  - `str1` (str): First string
  - `str2` (str): Second string
- **Returns**: `bool`

### confusable_characters_tool
- **Description**: List all Unicode characters visually confusable with a given character.
- **Arguments**:
  - `char` (str): Single character
- **Returns**: `list[str]`

### confusable_regex_tool
- **Description**: Generate a regex matching all confusable variants of a string.
- **Arguments**:
  - `string` (str): Reference string
  - `include_character_padding` (bool): Allow extra confusable characters between main ones
- **Returns**: `str` (regex pattern)

### normalize_tool
- **Description**: Return all possible normalized forms of a string.
- **Arguments**:
  - `string` (str): String to normalize
  - `prioritize_alpha` (bool): Prioritize conversion to Latin alphabet
- **Returns**: `list[str]`

## License

[Apache 2.0](LICENSE)