Content
# UYAP UDF MCP
MCP server for generating UYAP Doküman Editörü `.udf` files. Lets Claude (or any
MCP client) produce Turkish legal petitions in the `.udf` format directly,
instead of `.docx`.
## What is UDF?
UDF is the document format used by Turkey's national judicial system (UYAP).
A `.udf` file is a ZIP archive containing a single `content.xml`, where the
plain text lives in a CDATA block and formatting (bold, italic, underline,
alignment, indentation) is applied via offset/length annotations in `<paragraph>`
and `<content>` elements.
## Tools
| Tool | Purpose |
|---|---|
| `create_udf_from_markdown` | Markdown-like syntax → `.udf` (recommended) |
| `create_udf` | Structured paragraph list → `.udf` (fine control) |
| `read_udf_from_base64` | Parse a `.udf` provided as base64 |
| `read_udf` | Parse a local `.udf` file (stdio mode only) |
### Markdown syntax for `create_udf_from_markdown`
- Each line is a new paragraph; blank lines stay blank.
- Inline: `**bold**`, `*italic*`, `__underline__`, `***bold italic***`.
- Line prefix `|` → centered (court name, headings).
- Line prefix `>>>` → quote (italic + left indent — for case-law citations).
- Line prefix `:::` → demand-list item (left indent — numbered demands).
Example:
```
|**[COURT NAME]**
**FILE NO** : [case number]
|**EXPLANATIONS**
We submit our **statements** in response to this case.
>>>"[Case-law quotation]" ([Court / Chamber reference])
::: 1. [Demand line]
```
## Output
All tools return JSON containing the `.udf` as base64 (`content_base64`),
along with `filename`, `size_bytes`, and `paragraph_count`. The MCP client
decodes and saves the file.
When running locally (stdio), pass `output_path` to also write to disk.
## Running
### Local (stdio) — Claude Code, Claude Desktop
```bash
uv run python server.py
```
Register with Claude Code:
```bash
claude mcp add uyap-udf --scope user -- \
uv --directory /path/to/this/repo run python server.py
```
### Cloud (HTTP) — claude.ai connectors
```bash
uv run python server.py --http
# or set MCP_TRANSPORT=http
# PORT defaults to 8000
```
Endpoint: `POST /mcp` (Streamable HTTP transport).
## Deploy to FastMCP Cloud
1. Push this repo to GitHub.
2. Go to <https://fastmcp.cloud> → New Server → Connect GitHub repo.
3. Entrypoint: `server.py:mcp`.
4. Once deployed, you get a `https://<name>.fastmcp.app/mcp` URL.
5. In claude.ai → Settings → Connectors → Add custom connector → paste URL.
## License
MIT