Files
agcanvas/crates/agcanvas-mcp/src/main.rs
David Ibia 1929023409 feat: add undo/redo (Cmd+Z/Cmd+Shift+Z) and SVG file drag-and-drop
- Undo walks to parent node in history tree, redo follows
  last-active-child for correct branch tracking after forks
- HistoryTree tracks branch recency via last_active_child field,
  updated on push() and checkout() path transitions
- SVG files can be dragged from Finder onto the canvas window
- Edit menu with Undo/Redo items, command palette entries
- 3 new tests: undo, redo, redo-after-fork branch behavior
- 29 tests passing, clippy clean
2026-02-10 00:23:41 +01:00

45 lines
1.1 KiB
Rust

mod bridge;
mod tools;
use anyhow::Result;
use clap::Parser;
use rmcp::ServiceExt;
use tools::AgCanvasServer;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
#[derive(Parser)]
#[command(
name = "agcanvas-mcp",
about = "MCP server bridge for Augmented Canvas"
)]
struct Cli {
#[arg(long, default_value = "9876")]
port: u16,
}
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::registry()
.with(tracing_subscriber::EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "agcanvas_mcp=info".into()),
))
.with(tracing_subscriber::fmt::layer().with_writer(std::io::stderr))
.init();
let cli = Cli::parse();
let ws_url = format!("ws://127.0.0.1:{}", cli.port);
tracing::info!(
"Starting Augmented Canvas MCP server, connecting to {}",
ws_url
);
let server = AgCanvasServer::new(ws_url);
let service = server.serve(rmcp::transport::stdio()).await?;
tracing::info!("MCP server running on stdio");
service.waiting().await?;
Ok(())
}