MCP-Artisan
A secure MCP server with a workspace sandbox for AI agents to manage prompts, save HTML, and render HTML to images.
README
MCP-Artisan v2.0.0
A secure Model Context Protocol (MCP) tool with workspace sandbox for AI Agents to find prompts, save HTML, and render HTML to images.
🚨 Breaking Changes in v2.0.0
This is a major version update with breaking changes. All API parameters have been redesigned for enhanced security and usability.
Key Changes:
- Workspace Sandbox: All operations are now restricted to a specified workspace directory
- Simplified APIs: Removed complex path parameters, added intelligent file discovery
- Enhanced Security: Built-in path validation prevents directory traversal attacks
- Smart Organization: Automatic file organization in
output/subdirectories
Installation & Usage
# Install and run with workspace
npx mcp-artisan /path/to/your/workspace
# Example
npx mcp-artisan ./my-project
Required: You must specify a workspace directory when starting the server.
Configuration for AI Environments (Cursor, etc.)
To use MCP-Artisan with AI development environments like Cursor, you need to configure the MCP server command.
-
Install MCP-Artisan globally or within your project:
# Global installation npm install -g mcp-artisan # Or local project installation npm install mcp-artisan -
In your environment's MCP server settings (e.g., in
.cursor-agent/mcp.jsonor a similar configuration file), set up the server command as follows:- Command:
npx - Arguments:
["mcp-artisan", "/path/to/your/project/workspace"]
Replace
/path/to/your/project/workspacewith the absolute path to the folder you want the AI to work in. This folder will be used to find prompts and save output files.Example Configuration (
.cursor-agent/mcp.json):{ "mcpServers": { "my-artisan-tool": { "command": "npx", "args": [ "-y", "mcp-artisan", "/Users/username/my-ai-project" ] } } } - Command:
New API Reference
listPrompts
Lists available prompt files automatically.
- Parameters: None
- Behavior: Searches in
workspace/prompts/first, falls back to workspace root - Returns: Array of prompt filenames
getPromptContent
Reads prompt file content by filename.
- Parameters:
promptFileName(string): Just the filename, no path needed
- Behavior: Automatically searches in prompts directory and workspace root
saveHtml
Saves HTML with automatic organization.
- Parameters:
htmlContent(string): Complete HTML contentsubfolderName(string, max 20 chars): Descriptive folder namefileName(string): Filename without .html extension
- Output: Saves to
workspace/output/{subfolderName}/{fileName}.html
renderImageFromHtml
Renders HTML to image using relative paths.
- Parameters:
htmlPath(string): Relative path from workspace (e.g., "output/my-card/index.html")imageType(optional): 'png' or 'jpeg'
- Output: Image saved alongside HTML file
Migration from v1.x
| v1.x Parameter | v2.x Parameter | Notes |
|---|---|---|
promptsPath |
(removed) | Auto-discovery in workspace |
promptPath |
promptFileName |
Just filename, no path |
outputPath |
subfolderName |
Auto-organized in output/ |
htmlPath (absolute) |
htmlPath (relative) |
Relative to workspace |
Security Features
- Workspace Sandbox: All file operations restricted to workspace
- Path Validation: Prevents directory traversal (../) attacks
- Input Sanitization: Validates filenames and folder names
- Symlink Protection: Resolves real paths to prevent escapes
Example Workflow
# Start server with workspace
npx mcp-artisan ./my-project
# Directory structure will be:
# my-project/
# ├── prompts/ # Your prompt files
# │ ├── card.txt
# │ └── banner.md
# └── output/ # Generated files
# └── my-cards/ # Organized by subfolder
# ├── card.html
# └── card.png
Development
# Clone and install
git clone <repo>
cd mcp-artisan
npm install
# Build
npm run build
# Development with workspace
npm run dev -- ./test-workspace
License
MIT
Contributing
Issues and pull requests are welcome. Please ensure all tests pass before submitting.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。