@brianbuildz/draw-agent v0.2.0
Draw Agent MCP Server
An agent that creates graphs, charts, flow charts, and diagrams following the Model Context Protocol (MCP). This agent is designed to help visualize data and concepts through appropriate charts and diagrams.
Overview
This package provides an MCP server that can analyze data, determine the most appropriate visualization type, and generate visual representations including charts, graphs, flow charts, and diagrams.
Key Features
- Data Visualization: Create various charts and graphs based on provided data
- Flow Charts & Diagrams: Generate visual representations of processes and relationships
- Intelligent Format Selection: Automatically determine the most appropriate visualization type
- Markdown/Image Outputs: Returns visualizations in suitable formats
Logging in MCP Servers
This agent follows the MCP protocol requirements for logging. Instead of using direct console.log
or console.error calls (which would break the JSON-based protocol), it uses safe logging utilities
from utils/logger.js.
When developing MCP servers:
- Never use direct console.log/console.error - These break the JSON protocol
Always use the safe logging utilities:
import { log, logError } from './utils/logger.js'; // Instead of console.log log('Your message here', optionalData); // Instead of console.error logError('Error message', errorObject);These utilities ensure all output is valid JSON sent to stderr, maintaining protocol integrity
Installation
npm install -g @brianbuildz/draw-agentUsage
As a Command Line Tool
Run the MCP server:
draw-agentThis will start the MCP server. The server communicates using the MCP protocol via standard input/output.
Integration with Cursor
To use the draw-agent with Cursor:
Install the agent globally:
npm install -g @brianbuildz/draw-agentIn Cursor, click the "+" button in the Agents panel to add a new agent.
Set the following:
- Name: Draw Agent
- Command:
npx -y draw-agent
Click "Add" to register the agent.
You can now use the Draw Agent by sending commands to it in Cursor. For example:
@Draw Agent Please create a pie chart showing market share for products A (35%), B (45%), and C (20%)The agent will respond with a Mermaid diagram that you can view directly in Cursor.
Verification
To verify the agent is working correctly, run:
node verify-cursor.jsThis will start the agent and test it with different chart types.
In an MCP Client
When provided with data or descriptions, the agent will analyze the input and generate appropriate visualizations.
Data Formats
The draw-agent accepts the following data formats:
Pie Charts
{
"labels": ["Item 1", "Item 2", "Item 3"],
"values": [30, 40, 30]
}Flowcharts
{
"nodes": [
{ "id": "A", "label": "Start" },
{ "id": "B", "label": "Process", "shape": "rectangle" }
],
"edges": [
{ "from": "A", "to": "B", "label": "Begin" }
]
}Development
This agent was built using the hello-agent template as a starting point. It implements the MCP protocol and provides visualization capabilities using Mermaid.js.
License
MIT