Interactive UI Tools for MCP Servers
Project description
Gdansk: React Frontends for Python MCP Servers
[!WARNING] This project is currently in beta. The APIs are subject to change leading up to v1.0. The v1.0 release will coincide with the v2.0 release of the python mcp sdk
The name "Gdansk" (pronounced "guh-DANSK") is a nod to the Polish port city's historical role as a bridge between cultures and trade routes—much like this framework bridges Python backends and React frontends.
Gdansk bridges Python backend logic with React/TypeScript UIs, letting you create rich, interactive tools for Model Context Protocol (MCP) servers without leaving the Python ecosystem.
Gdansk combines FastMCP for server-side Python logic with React for client-side interfaces, and uses Rolldown (a Rust-based bundler) to handle all the JavaScript/TypeScript bundling automatically. Whether you're building data visualization tools, form-based interfaces, or interactive dashboards for Claude Desktop and other MCP clients, Gdansk provides a straightforward path from Python functions to polished UIs.
Installation
uv add gdansk
Examples
- FastAPI: FastAPI-based MCP server integration with mounted app routes.
- get-time: Feature-rich MCP app covering tool calls, messaging, logging, and links.
- ssr: Minimal SSR example using
Amber(ssr=True)with a single tool UI. - shadcn: Todo app example using
shadcn/uicomponents with Gdansk.
Quick Start
Here's a complete example showing how to build a simple greeting tool with a React UI:
Project Structure:
my-mcp-server/
├── server.py
└── views/
├── package.json
└── apps/
└── hello/
└── page.tsx
server.py:
from pathlib import Path
from mcp.server.fastmcp import FastMCP
from mcp.types import TextContent
from gdansk import Amber
import uvicorn
mcp = FastMCP("Hello World Server")
amber = Amber(mcp=mcp, views=Path(__file__).parent / "views")
@amber.tool(name="greet", page=Path("hello"))
def greet(name: str) -> list[TextContent]:
"""Greet someone by name."""
return [TextContent(type="text", text=f"Hello, {name}!")]
if __name__ == "__main__":
app = amber(dev=True) # Enable hot-reload for development
uvicorn.run(app, port=3000)
views/apps/hello/page.tsx:
import { useApp } from "@modelcontextprotocol/ext-apps/react";
import { useState } from "react";
export default function App() {
const [name, setName] = useState("");
const [greeting, setGreeting] = useState("");
const { app, error } = useApp({
appInfo: { name: "Greeter", version: "1.0.0" },
capabilities: {},
});
if (error) return <div>Error: {error.message}</div>;
if (!app) return <div>Connecting...</div>;
return (
<main>
<h2>Say Hello</h2>
<input
value={name}
onChange={(e) => setName(e.target.value)}
placeholder="Enter your name..."
/>
<button
onClick={async () => {
const result = await app.callServerTool({
name: "greet",
arguments: { name }
});
const text = result.content?.find(c => c.type === "text");
if (text && "text" in text) setGreeting(text.text);
}}
>
Greet Me
</button>
{greeting && <p>{greeting}</p>}
</main>
);
}
Gdansk mounts your default export into #root automatically and wraps it with React.StrictMode.
Run the server with python server.py, configure it in your MCP client (like Claude Desktop), and you'll have an
interactive greeting tool ready to use.
Why Use Gdansk?
-
Python Backend, React Frontend — Use familiar technologies you already know. Write your logic in Python with type hints, build your UI in React/TypeScript. No need to learn a new framework-specific language.
-
Built for MCP — First-class support for FastMCP servers. Automatic resource registration, MCP app protocol handling, and seamless integration with Claude Desktop and other MCP clients.
-
Rust-Powered Bundling — Lightning-fast Rolldown bundler processes your TypeScript/JSX automatically. Hot-reload in development mode means you see changes instantly without manual rebuilds.
-
Type-Safe — Full type safety across the stack. Python type hints on the backend, TypeScript on the frontend, with automatic type checking via ruff and TypeScript compiler.
-
Developer-Friendly — Simple decorator API (
@amber.tool()), automatic resource registration, hot-reload dev mode, and comprehensive error messages. Get started in minutes, not hours. -
Production Ready — Comprehensive test suite covering Python 3.11-3.14 across Linux, macOS, and Windows. Used in production MCP servers with proven reliability.
Resources
- Model Context Protocol — Official MCP documentation
- mcp/python-sdk — Python SDK for building MCP servers
- @modelcontextprotocol/ext-apps — React hooks for MCP apps
- Rolldown — Rust-powered JavaScript bundler
- Deno Core — JavaScript runtime foundation used in Gdansk's Rust runtime layer
Credits
Gdansk builds on the shoulders of giants:
- Rolldown — Fast Rust-based JavaScript bundler
- PyO3 — Rust bindings for Python
- mcp/python-sdk — Python SDK for MCP server development
- Deno Core — JavaScript runtime that powers Gdansk's Rust runtime
Special thanks to the Model Context Protocol team at Anthropic for creating the MCP standard and the
@modelcontextprotocol/ext-apps package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gdansk-0.1.0.tar.gz.
File metadata
- Download URL: gdansk-0.1.0.tar.gz
- Upload date:
- Size: 434.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc68beaa486a490fade50f2bef9a4dd1d0cc3c75c7be8d552cb5bd2ef21ab300
|
|
| MD5 |
0be270965a4ffd33ef46b2b1edb1994d
|
|
| BLAKE2b-256 |
561a80b9931252aef12176f061303878b8d0a6e5868397732f7313934289651d
|
File details
Details for the file gdansk-0.1.0-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: gdansk-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 25.3 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf321fb15d9ce3659287ece8f272b68ea415975546c038101c8d8071acd6e70b
|
|
| MD5 |
ccdda6c26b6efe2d6ac7fd22dd23528b
|
|
| BLAKE2b-256 |
d0072ed750d790da431149f3c899cf0a4d551b466b179740546f36be21a7efbc
|