Metadata-Version: 2.4
Name: mcp-d3-server
Version: 1.0.0
Summary: A Python MCP server for D3.js visualization information and chart generation
Author-email: MCP D3 Server <noreply@example.com>
License: MIT
License-File: LICENSE
Keywords: d3,dataviz,mcp,python,visualization
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.10
Requires-Dist: mcp>=1.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# MCP D3 Server (Python)

A Python-based MCP (Model Context Protocol) server that provides D3.js visualization information, chart generation, and documentation resources. This is a Python port of the original Node.js MCP D3 server with STDIO support for use with `uv` and other Python package managers.

## Features

- **D3.js Documentation Resources**: Access to curated D3.js documentation and examples
- **Chart Generation Tools**: Generate D3.js chart code for various chart types (bar, line, etc.)
- **AI-Powered Chart Creation**: Use AI to generate custom D3 visualizations based on descriptions
- **Data Analysis**: Analyze data and get visualization recommendations
- **STDIO Transport**: Compatible with MCP clients using stdio transport

## Installation

### Using uv (recommended)

```bash
cd mcp-d3-server-python
uv sync
```

### Using pip

```bash
cd mcp-d3-server-python
pip install -e .
```

## Usage

### Running as STDIO MCP Server

```bash
# Using uv
uv run mcp-d3-server

# Using pip-installed package
mcp-d3-server
```

### Configuration for MCP Clients

Add to your MCP client configuration:

```json
{
  "mcpServers": {
    "d3-visualization": {
      "command": "uv",
      "args": ["run", "mcp-d3-server"],
      "cwd": "/path/to/mcp-d3-server-python"
    }
  }
}
```

## Available Resources

- `d3-docs://d3-gallery` - D3.js gallery and examples
- `d3-docs://d3-indepth` - In-depth D3.js guide and documentation  
- `d3-docs://d3-org` - Official D3.js documentation
- `d3-search://query` - Search across all D3 documentation
- `d3-topic://topic[/section]` - Get information about specific D3 topics

## Available Tools

### generate-d3-chart
Generate D3.js chart code based on chart type and data format.

**Parameters:**
- `chartType` (string): Type of chart (bar, line, pie, etc.)
- `dataFormat` (string): Description of your data format
- `features` (array, optional): Additional features to include

### recommend-chart  
Get chart type recommendations based on your data and visualization goals.

**Parameters:**
- `dataDescription` (string): Description of your data
- `purpose` (string): What insights you want to gain

### ai-generate-d3
Use AI to generate custom D3.js visualizations.

**Parameters:**
- `description` (string): Describe the chart you want
- `dataExample` (string): Example of your data structure

### analyze-data
Analyze data and get visualization suggestions.

**Parameters:**
- `data` (string): Your data in JSON or CSV format
- `goal` (string): What you want to learn from the data

## Development

### Setup Development Environment

```bash
cd mcp-d3-server-python
uv sync --extra dev
```

### Running Tests

```bash
uv run pytest
```

### Code Formatting

```bash
uv run black src/
uv run ruff check src/
```

### Type Checking

```bash  
uv run mypy src/
```

## Project Structure

```
mcp-d3-server-python/
├── src/
│   └── mcp_d3_server/
│       ├── __init__.py
│       ├── server.py          # Main MCP server with STDIO support
│       ├── services.py        # Service implementations
│       └── types.py           # Type definitions
├── assets/
│   └── llm-full/             # D3 documentation files
├── pyproject.toml            # Python package configuration
└── README.md
```

## License

MIT