Skip to main content
Glama
faraztools-mcp

faraztools-mcp

Official
by farazmazhar

faraztools-mcp

A personal MCP server — the small utilities I reach for on a regular basis, exposed as tools any MCP-capable AI client can call.

Python uv MCP Python SDK protocol Ruff License

It runs locally over stdio: the host application launches it as a subprocess and speaks MCP over the process's stdin/stdout. No port, no daemon, no network surface.


Table of contents


Related MCP server: toolbox-mcp

What this is

A home for the one-off scripts and helpers that keep getting rewritten. Instead of copying a snippet around, each utility becomes a tool with a name, a description, and a typed input schema — all of which the SDK derives from a plain, type-hinted Python function.

Written against v2 of the official MCP Python SDK. Two notes for anyone reading the code:

  • The high-level server class is MCPServer — v1's FastMCP, renamed. The import is from mcp.server import MCPServer.

  • Transport options (host, port, …) belong on mcp.run(), never on the constructor.

Tools

Documents

Tool

Description

markdown_to_pdf

Convert Markdown into a styled PDF: headings, emphasis, links, lists, blockquotes, syntax-highlighted code, tables, rules and local images. Takes markdown text or an input_path, writes to output_path, and accepts a theme preset (default, compact, academic) or a JSON theme file overriding keys such as margin_cm, accent, font_size_pt and heading_numbering.

PDF rendering is done by Typst via the typst wheel — no system binaries, no headless browser, no LaTeX.

Data & text

Everything here is standard library except json_query, which uses JMESPath (pure Python, MIT, no transitive dependencies).

Tool

Description

query_sqlite

Run a read-only SQL query against a SQLite file; rows come back as a table.

sqlite_schema

Describe the tables, columns and indexes of a SQLite database.

text_diff

Unified diff between two blocks of text.

regex_search

Find regular-expression matches with their capture groups and offsets.

regex_replace

Regular-expression substitution, reporting how many replacements were made.

json_format

Pretty-print JSON, or compact it with indent=0.

json_validate

Check JSON syntax, and optionally validate against a JSON Schema.

json_query

Extract part of a JSON document with a JMESPath expression.

csv_to_markdown

Render CSV data as a Markdown table.

csv_to_json

Convert CSV into a JSON array of objects.

csv_profile

Profile CSV columns: inferred type, blanks, distinct values, numeric range.

Data files (DuckDB)

DuckDB reads CSV, Parquet and JSON directly, so these tools query and convert data files with plain SQL. The duckdb wheel bundles its own engine — no system libraries — and extension auto-install is switched off, so nothing is fetched from the network.

Tool

Description

duckdb_query

Run a read-only SQL query, reading CSV/Parquet/JSON files or a .duckdb database.

duckdb_describe

Columns, types, row count and a sample of a data file or database table.

duckdb_write_file

Run a query and write the result to .csv, .tsv, .parquet or .json/.ndjson.

Database files are always opened read-only and only a single read-only statement is accepted, so the only thing these tools can write is an explicit output_path — and never over an existing file unless overwrite=True is passed.

echo is a deliberately minimal example tool — see Adding a tool.

Requirements

  • uv — dependency and environment management

  • Python 3.12+

Quick start

git clone <this-repo> faraztools-mcp
cd faraztools-mcp
uv sync

That's it — uv sync creates .venv and installs everything from uv.lock.

Run

uv run faraztools-mcp
# or, equivalently
uv run python -m faraztools_mcp

Under stdio the server prints nothing and waits on stdin for a host to connect. A silent terminal means it is working, not hung.

Development

uv run pytest                 # tests (in-memory, no subprocess)
uv run ruff format .          # format
uv run ruff check . --fix     # lint
uv run pyright                # type check

uv run mcp dev src/faraztools_mcp/server.py --with-editable .   # MCP Inspector (needs npx)

--with-editable . is required for mcp dev: the Inspector runs the server in its own isolated environment and needs this package importable there.

Conventions and the full tool-adding recipe live in AGENTS.md.


Connect an AI client

The launch command

Every client below launches the same command. Clone this repo somewhere permanent and replace /path/to/faraztools-mcp with that location:

uv run --directory /path/to/faraztools-mcp faraztools-mcp

So the pieces to translate into each client's config format are always:

Field

Value

command

uv

args

run, --directory, /path/to/faraztools-mcp, faraztools-mcp

Tip: uv run re-syncs the environment on each launch (it's a no-op once in sync), so you never manage a virtualenv by hand. Use an absolute path — hosts don't launch the server from this repo.

Command Code

CLI:

cmd mcp add faraztools -- uv run --directory /path/to/faraztools-mcp faraztools-mcp

Or drop this in .mcp.json at your project root (cmd mcp add-json accepts the same object):

{
  "mcpServers": {
    "faraztools": {
      "transport": "stdio",
      "command": "uv",
      "args": ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]
    }
  }
}

Verify with /mcp in a session. Tools appear as mcp__faraztools__<tool>.

Claude Code

CLI (one line, -- separates the server command):

claude mcp add faraztools -- uv run --directory /path/to/faraztools-mcp faraztools-mcp

Or commit .mcp.json at your project root to share it:

{
  "mcpServers": {
    "faraztools": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]
    }
  }
}

Add --scope user to make it available across all projects. Check it with claude mcp list, or /mcp inside a session.

Claude Desktop

Edit claude_desktop_config.json:

OS

Path

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

Linux

~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "faraztools": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]
    }
  }
}

Restart Claude Desktop afterwards. The uv binary must be resolvable — if not, use its full path (which uv).

Cursor

Project config at .cursor/mcp.json, or global at ~/.cursor/mcp.json:

{
  "mcpServers": {
    "faraztools": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]
    }
  }
}

Enable it under Settings → MCP, then check the MCP Logs output channel if it doesn't connect.

VS Code (GitHub Copilot)

Workspace config at .vscode/mcp.json — note VS Code uses a servers key, not mcpServers:

{
  "servers": {
    "faraztools": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]
    }
  }
}

Approve the trust prompt on first start. For a machine-wide setup, run MCP: Open User Configuration instead.

Codex

Add to ~/.codex/config.toml (or .codex/config.toml for a single trusted project):

[mcp_servers.faraztools]
command = "uv"
args = ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]

Or via the CLI:

codex mcp add faraztools -- uv run --directory /path/to/faraztools-mcp faraztools-mcp

codex mcp list shows configured servers; /mcp lists them in the TUI.

OpenCode

Add to opencode.json (project) or ~/.config/opencode/opencode.json (global). OpenCode's command is a single array holding the command and its arguments:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "faraztools": {
      "type": "local",
      "command": ["uv", "run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"],
      "enabled": true
    }
  }
}

Windsurf

Edit mcp_config.json (open it from the Cascade panel's ... → Open MCP config file):

OS

Path

macOS / Linux

~/.config/devin/mcp_config.json

Windows

%APPDATA%\devin\mcp_config.json

{
  "mcpServers": {
    "faraztools": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]
    }
  }
}

Zed

Add to your Zed settings.json — Zed's key is context_servers:

{
  "context_servers": {
    "faraztools": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/faraztools-mcp", "faraztools-mcp"]
    }
  }
}

Or use Settings → AI → MCP Servers → Add Server → Add Local Server.

Any other MCP client

If a client supports stdio MCP servers, it needs only the command and args from the launch command. Most use an mcpServers object with command + args; a few differ (VS Code uses servers, Zed uses context_servers, OpenCode uses mcp with an array command). Point the client at the launch command and it works.


Adding a tool

  1. Create src/faraztools_mcp/tools/<name>.py exposing a register(mcp) function:

    from mcp.server import MCPServer
    
    
    def register(mcp: MCPServer) -> None:
        @mcp.tool()
        def my_tool(arg: str) -> str:
            """One sentence describing what the model should use this for."""
            return arg
  2. Register the module in src/faraztools_mcp/tools/__init__.py (import it, add it to _MODULES).

  3. Add tests/test_<name>.py using the in-memory client pattern.

The docstring is the description the model sees and the type hints are the input schema — write both deliberately. Full details in AGENTS.md.

Layout

src/faraztools_mcp/
├── __init__.py        # re-exports `mcp`
├── server.py          # builds MCPServer, registers tools, `main()`
├── __main__.py        # `python -m faraztools_mcp`
├── md_to_pdf/         # Markdown -> PDF (Typst): theme, converter, renderer, template
└── tools/
    ├── __init__.py    # `_MODULES` registry + `register_all(mcp)`
    ├── _support.py    # shared helpers (bounded output, Markdown tables, SQL quoting)
    ├── duckdb.py      # duckdb_query, duckdb_describe, duckdb_write_file
    ├── echo.py        # example tool module
    ├── json_tools.py  # json_format, json_validate, json_query
    ├── md_to_pdf.py   # the markdown_to_pdf tool
    ├── sqlite.py      # query_sqlite, sqlite_schema
    ├── tabular.py     # csv_to_markdown, csv_to_json, csv_profile
    └── text.py        # text_diff, regex_search, regex_replace
tests/
├── conftest.py        # anyio_backend fixture
├── test_duckdb.py
├── test_echo.py
├── test_json_tools.py
├── test_md_to_pdf.py
├── test_sqlite.py
├── test_tabular.py
└── test_text.py

License

MIT © Faraz Mazhar

Available Tools

2 tools
echoA

Echo the given text back to the caller.

Inputs: text (required). Returns: result

markdown_to_pdfA

Convert Markdown into a styled PDF file and return the path written.

Pass the document either as markdown text or as input_path pointing at a .md file (exactly one of the two). output_path is where the PDF is written.

theme is a preset name ("default", "compact", "academic") or a path to a JSON file overriding theme keys such as margin_cm, accent, font_size_pt or heading_numbering. title adds a centred title block above the content.

Supports headings, emphasis, links, lists, blockquotes, fenced code, tables, rules and local images (resolved relative to the input file). Remote image URLs are not fetched.

Inputs: output_path (required), theme, title, markdown, +1 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have completely different purposes: one echoes text, the other converts Markdown to PDF. There is no overlap or ambiguity between them.

    Naming Consistency4/5

    Both names are lowercase and readable, and 'markdown_to_pdf' uses snake_case while 'echo' is a simple verb. Though the pattern is not perfectly uniform, the names are clear and conventional.

    Tool Count3/5

    With only two tools, the server is on the thin side. The 'faraztools' name suggests a broader toolkit, but for such a minimal set, the count is borderline acceptable.

    Completeness2/5

    The tools are unrelated and the domain is unclear—there is no cohesive surface to assess. Beyond echo and Markdown-to-PDF conversion, many common utilities are missing relative to the generic server name.

    Related MCP Connectors

    Related MCP Servers