Spaces:
Running
Running
Update README: new emoji and color scheme for project frontmatter
Browse files- Dockerfile +21 -0
- README.md +66 -7
- requirements.txt +2 -1
Dockerfile
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# syntax=docker/dockerfile:1
|
2 |
+
FROM python:3.12-slim
|
3 |
+
|
4 |
+
# Set workdir
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Upgrade pip
|
8 |
+
RUN pip install --upgrade pip
|
9 |
+
|
10 |
+
# Install dependencies
|
11 |
+
COPY requirements.txt ./
|
12 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
13 |
+
|
14 |
+
# Copy app code
|
15 |
+
COPY app.py ./
|
16 |
+
|
17 |
+
# Expose MCP server port
|
18 |
+
EXPOSE 7860
|
19 |
+
|
20 |
+
# Command to run the server with python directly
|
21 |
+
CMD ["python", "app.py"]
|
README.md
CHANGED
@@ -1,11 +1,70 @@
|
|
1 |
---
|
2 |
-
title: Confusables
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk:
|
7 |
-
sdk_version: 5.35.0
|
8 |
-
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Confusables MCP Server
|
3 |
+
emoji: "🕵️♂️"
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: red
|
6 |
+
sdk: docker
|
|
|
|
|
7 |
pinned: false
|
8 |
license: apache-2.0
|
9 |
---
|
10 |
+
|
11 |
+
# Confusables MCP Server 💬
|
12 |
+
|
13 |
+
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.
|
14 |
+
|
15 |
+
## Features
|
16 |
+
- **is_confusable**: Check if two strings are visually confusable.
|
17 |
+
- **confusable_characters**: List all Unicode characters visually confusable with a given character.
|
18 |
+
- **confusable_regex**: Generate a regex matching all confusable variants of a string.
|
19 |
+
- **normalize**: Return all possible normalized forms of a string (ASCII/Latin-alphabet equivalents).
|
20 |
+
|
21 |
+
## Installation
|
22 |
+
|
23 |
+
Clone the repository and install dependencies:
|
24 |
+
|
25 |
+
```bash
|
26 |
+
pip install -r requirements.txt
|
27 |
+
```
|
28 |
+
|
29 |
+
## Usage
|
30 |
+
|
31 |
+
Start the FastMCP server:
|
32 |
+
|
33 |
+
```bash
|
34 |
+
python app.py
|
35 |
+
```
|
36 |
+
|
37 |
+
The server will run on `0.0.0.0:7860` by default.
|
38 |
+
|
39 |
+
## API (MCP Tools)
|
40 |
+
|
41 |
+
### is_confusable_tool
|
42 |
+
- **Description**: Check if two strings are visually confusable.
|
43 |
+
- **Arguments**:
|
44 |
+
- `str1` (str): First string
|
45 |
+
- `str2` (str): Second string
|
46 |
+
- **Returns**: `bool`
|
47 |
+
|
48 |
+
### confusable_characters_tool
|
49 |
+
- **Description**: List all Unicode characters visually confusable with a given character.
|
50 |
+
- **Arguments**:
|
51 |
+
- `char` (str): Single character
|
52 |
+
- **Returns**: `list[str]`
|
53 |
+
|
54 |
+
### confusable_regex_tool
|
55 |
+
- **Description**: Generate a regex matching all confusable variants of a string.
|
56 |
+
- **Arguments**:
|
57 |
+
- `string` (str): Reference string
|
58 |
+
- `include_character_padding` (bool): Allow extra confusable characters between main ones
|
59 |
+
- **Returns**: `str` (regex pattern)
|
60 |
+
|
61 |
+
### normalize_tool
|
62 |
+
- **Description**: Return all possible normalized forms of a string.
|
63 |
+
- **Arguments**:
|
64 |
+
- `string` (str): String to normalize
|
65 |
+
- `prioritize_alpha` (bool): Prioritize conversion to Latin alphabet
|
66 |
+
- **Returns**: `list[str]`
|
67 |
+
|
68 |
+
## License
|
69 |
+
|
70 |
+
[Apache 2.0](LICENSE)
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
-
|
|
|
2 |
confusables
|
|
|
1 |
+
fastmcp>=2.10.1
|
2 |
+
mcp>=1.10.1
|
3 |
confusables
|