ππΌββοΈ The blackboard for coding agents - agentic development environment for claude code, codex, cursor, opencode, grok and more.
Rust adeai-agentsclaudeclaude-codecodexcursorgeminigrokopencodespec-driven-developmentvibe-codingvim
feat: add global mcp for sweep skill (#84)
Fynn Fluegge5f5b550b040c
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex 7c442b4..75960d2 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -18,7 +18,7 @@"agtx": {"type": "stdio","command": "agtx",- "args": ["mcp-serve", "."]+ "args": ["mcp-serve"]}}}diff --git a/AGENTS.md b/AGENTS.mdnew file mode 100644index 0000000..ea29f3f--- /dev/null+++ b/AGENTS.md@@ -0,0 +1,60 @@+# AGENTS.md++This file provides guidance to AI coding agents (Claude Code, Codex, Gemini, Copilot, OpenCode, Cursor, etc.) when working with the agtx codebase.++## What is agtx?++A terminal-native kanban board for managing multiple coding agent sessions in parallel. Each task gets its own git worktree, tmux window, and agent session. Written in Rust.++## Build & Test++```bash+cargo build --release+cargo test --features test-mocks+```++## Key Architecture++```+src/+βββ main.rs # CLI entry point, AppMode routing+βββ lib.rs # Module exports+βββ tui/app.rs # Main TUI app (largest file β board, popups, key handling)+βββ db/schema.rs # SQLite operations (tasks, projects, notifications)+βββ db/models.rs # Task, Project, TaskStatus structs+βββ mcp/server.rs # MCP server (JSON-RPC over stdio)+βββ tmux/ # Tmux session/window management+βββ git/ # Worktree creation, conflict detection+βββ agent/ # Agent detection, spawn commands+βββ config/ # GlobalConfig, ProjectConfig, WorkflowPlugin+βββ skills.rs # Skill deployment to agent-native paths+```++See [CLAUDE.md](CLAUDE.md) for the full architecture reference including common task patterns, code conventions, and testing approach.++## Core Concepts++- **Tasks** move through: `Backlog β Planning β Running β Review β Done`+- **Each task** gets a git worktree + tmux window + agent session+- **Plugins** (TOML) customize the task lifecycle per phase+- **MCP server** (`agtx mcp-serve`) exposes the board as tools over stdio+- **Global MCP** (`agtx mcp-serve`, no args) serves all projects via `~/.config/agtx/index.db`+- **Project MCP** (`agtx mcp-serve <path>`) serves a single project (used by the orchestrator)++## Sweep Skill++If you want to sweep this conversation into agtx tasks, use the sweep skill:++```+@skills/agtx/sweep/SKILL.md+```++Follow the Sweep workflow in that file.++## Rules++- Edit `src/` for behavior changes β never edit generated or compiled artifacts+- Run `cargo test --features test-mocks` before considering any change done+- Database migrations use `ALTER TABLE ... ADD COLUMN` (errors ignored if column exists)+- Mock-dependent tests use `#[cfg(feature = "test-mocks")]`+- See [CLAUDE.md](CLAUDE.md) for adding new fields, agents, plugins, shortcutsdiff --git a/CLAUDE.md b/CLAUDE.mdindex 2c91c72..f9124ab 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -49,7 +49,7 @@ src/β βββ operations.rs # AgentOperations/CodingAgent traits (mockable)βββ mcp/β βββ mod.rs # Re-exports-β βββ server.rs # MCP server (JSON-RPC over stdio) for orchestrator+β βββ server.rs # MCP server (JSON-RPC over stdio) β global and project-scoped modesβββ config/βββ mod.rs # GlobalConfig, ProjectConfig, ThemeConfig, WorkflowPlugin@@ -57,7 +57,8 @@ skills/ # Built-in skill files (embedded at compile time)βββ plan.md # Planning phase instructionsβββ execute.md # Execution phase instructionsβββ review.md # Review phase instructions-βββ research.md # Research phase instructions+βββ research.md # Research phase instructions+βββ agtx/sweep/SKILL.md # Sweep skill β push any conversation to the agtx board (/agtx:sweep)plugins/ # Bundled plugin configs (embedded at compile time)βββ agtx/@@ -202,6 +203,19 @@ A dedicated Claude Code agent that autonomously manages the kanban board. Enable**MCP tools**: `list_tasks`, `get_task` (includes `allowed_actions`), `move_task`, `get_transition_status`, `check_conflicts`, `get_notifications`+### MCP Server Modes++Two modes, selected by whether a path argument is passed to `agtx mcp-serve`:++| Mode | Command | Used by |+|------|---------|---------|+| **Project-scoped** | `agtx mcp-serve <path>` | Orchestrator (bound to one project) |+| **Global** | `agtx mcp-serve` | Sweep skill, any ad-hoc session |++In global mode all CRUD tools (`list_tasks`, `create_task`, etc.) require a `project_id` parameter. The agent calls `list_projects` first to resolve it. In project-scoped mode `project_id` is ignored β the path is fixed at startup.++`ServerMode` enum in `src/mcp/server.rs`. Path resolution via `resolve_project_path(project_id)` helper.+### General ConfigurationConfigurable via `~/.config/agtx/config.toml`:```toml@@ -421,3 +435,4 @@ Detected automatically via `known_agents()` in order of preference:- Reopen Done tasks (recreate worktree from preserved branch)- Orchestrator: support non-Claude agents as orchestrator- Orchestrator: task deletion notifications+- Orchestrator: multi-project support (see `docs/planning/multi-project-orchestrator.md`)diff --git a/README.md b/README.mdindex 57e1734..f4e5d60 100644--- a/README.md+++ b/README.md@@ -497,6 +497,118 @@ The orchestrator communicates with agtx through the [Model Context Protocol (MCP6. Escalated tasks show a `β ` badge on the kanban board; opening the task popup shows the reason and dismisses the flag7. MCP registration is cleaned up when the orchestrator is stopped+## Sweep β Push Any Conversation to the Board++Running a brainstorm or research session in any coding agent? Sweep the conversation into agtx tasks with a single command β `/agtx:sweep`.++The agent extracts every actionable work item from the conversation, presents a proposed task list for your confirmation, and pushes confirmed tasks directly to the agtx board.++### Install++<details>+<summary><b>Claude Code (recommended)</b></summary>++**Marketplace install:**+```+/plugin install fynnfluegge/agtx+```++**Manual install:**+```bash+claude mcp add agtx -- agtx mcp-serve+```++Then in any Claude Code session:+```+/agtx:sweep+```++</details>++<details>+<summary><b>Gemini CLI</b></summary>++Add the skill to your `GEMINI.md` for persistent context:+```bash+echo "@~/skills/agtx/sweep/SKILL.md" >> ~/GEMINI.md+```++Register the global MCP server in your Gemini config:+```bash+gemini mcp add agtx -- agtx mcp-serve+```++Then in any Gemini session:+```+/agtx-sweep+```++</details>++<details>+<summary><b>Cursor</b></summary>++Copy the skill into your Cursor rules:+```bash+cp skills/agtx/sweep/SKILL.md ~/.cursor/rules/agtx-sweep.md+```++Register the MCP server in Cursor's MCP settings (`~/.cursor/mcp.json`):+```json+{+ "mcpServers": {+ "agtx": {+ "command": "agtx",+ "args": ["mcp-serve"]+ }+ }+}+```++</details>++<details>+<summary><b>Codex</b></summary>++Copy the skill to Codex's skill discovery path:+```bash+mkdir -p .codex/skills/agtx-sweep+cp skills/agtx/sweep/SKILL.md .codex/skills/agtx-sweep/SKILL.md+```++Register the MCP server in `.codex/config.json`:+```json+{+ "mcp": {+ "agtx": {+ "command": "agtx",+ "args": ["mcp-serve"]+ }+ }+}+```++Then in any Codex session:+```+$agtx-sweep+```++</details>++<details>+<summary><b>Other agents</b></summary>++Skills are plain Markdown β they work with any agent that accepts instruction files. Copy `skills/agtx/sweep/SKILL.md` into your agent's context and register the MCP server:++```bash+agtx mcp-serve # global mode β works from any directory+```++</details>++> [!NOTE]+> The project must have been opened in agtx at least once to appear in `list_projects`. Run `agtx` in your project directory first.+## ContributingContributions are welcome! Whether it's a bug fix, new plugin, agent integration, or documentation improvement.diff --git a/commands/agtx-sweep.toml b/commands/agtx-sweep.tomldeleted file mode 100644index 90b187e..0000000--- a/commands/agtx-sweep.toml+++ /dev/null@@ -1,2 +0,0 @@-description = "Sweep this conversation into agtx tasks and push them to the kanban board"-prompt = "Sweep the conversation so far into agtx kanban tasks. Call list_tasks first to check for duplicates. Extract every actionable work item, determine dependencies, present the proposed task list for confirmation, then use create_tasks_batch to push them to the board. Sweeping only β do not implement anything."diff --git a/commands/sweep.md b/commands/sweep.mddeleted file mode 100644index 944d4b9..0000000--- a/commands/sweep.md+++ /dev/null@@ -1,14 +0,0 @@-----description: Sweep this conversation into agtx tasks and push them to the kanban board-argument-hint: Optional focus area (e.g. "backend tasks only")-allowed-tools: ["mcp__plugin_agtx_agtx__list_tasks", "mcp__plugin_agtx_agtx__create_task", "mcp__plugin_agtx_agtx__create_tasks_batch", "mcp__plugin_agtx_agtx__get_task"]------Sweep the conversation into agtx kanban tasks. $ARGUMENTS--Use the agtx skill for guidance. Follow the Sweep workflow:-1. Call list_tasks to check for duplicates-2. Extract actionable work items from the conversation-3. Present proposed task list for user confirmation-4. Push to board with create_tasks_batch (or create_task for a single task)-5. Report created task IDsdiff --git a/skills/agtx/SKILL.md b/skills/agtx/sweep/SKILL.mdsimilarity index 86%rename from skills/agtx/SKILL.mdrename to skills/agtx/sweep/SKILL.mdindex e079b92..74af856 100644--- a/skills/agtx/SKILL.md+++ b/skills/agtx/sweep/SKILL.md@@ -1,6 +1,6 @@----name: agtx-description: "Use when planning features, decomposing work into tasks, creating or managing tasks on a kanban board, coordinating parallel coding agent sessions across git worktrees, or when the user wants to sweep/push conversation results to the agtx board. Also use when asked about agtx setup, MCP configuration, or task workflow."+name: sweep+description: "Sweep this conversation into agtx tasks and push them to the kanban board. Use when the user wants to capture, decompose, or hand off conversation results to the agtx board."---# agtx β Terminal Kanban for Coding Agents@@ -102,9 +102,11 @@ Tasks 1 and 2 run in parallel (both depend on 0). Task 3 waits for both.When the user asks to sweep, push, or hand off the conversation to the board:-1. Call `list_tasks` β check for duplicates-2. Extract every actionable work item from the conversation-3. Present proposed task list for confirmation:+1. Call `list_projects` β get the project ID for the target project (ask the user if ambiguous)+2. Call `list_tasks` with `project_id` β check for duplicates+3. Extract every actionable work item from the conversation+4. **Stop and present the proposed task list to the user. Do NOT call any MCP write tools yet.**+ Show title, description, and dependencies for each task:```[0] Add streaming CSV export endpointImplement GET /export/csv with streaming response@@ -113,8 +115,9 @@ When the user asks to sweep, push, or hand off the conversation to the board:Query params ?from=&to= applied before streamingdepends on: [0]```-4. After confirmation: use `create_tasks_batch` for multiple tasks, `create_task` for one-5. Report created IDs:+ Then ask: "Send these N tasks to agtx? (yes / edit / cancel)"+5. **Only after explicit user confirmation:** use `create_tasks_batch` (with `project_id`) for multiple tasks, `create_task` for one+6. Report created IDs:```β a1b2c3 Add streaming CSV export endpointβ d4e5f6 Add date range filter to export@@ -124,10 +127,10 @@ When the user asks to sweep, push, or hand off the conversation to the board:Before creating tasks, verify the MCP connection:-1. Call `list_tasks` β if it works, you're connected+1. Call `list_projects` β if it works, you're connected2. If it fails, the user needs to install agtx and register the MCP server:```bash- claude mcp add agtx -- agtx mcp-serve .+ claude mcp add agtx -- agtx mcp-serve```See the [agtx README](https://github.com/fynnfluegge/agtx) for full installation instructions.diff --git a/src/db/schema.rs b/src/db/schema.rsindex 0299874..1206275 100644--- a/src/db/schema.rs+++ b/src/db/schema.rs@@ -409,6 +409,31 @@ impl Database {Ok(())}+ pub fn get_project_by_id(&self, id: &str) -> Result<Option<Project>> {+ let mut stmt = self+ .conn+ .prepare("SELECT * FROM projects WHERE id = ?1")?;++ let project = stmt+ .query_row(params![id], |row| {+ Ok(Project {+ id: row.get("id")?,+ name: row.get("name")?,+ path: row.get("path")?,+ github_url: row.get("github_url")?,+ default_agent: row.get("default_agent")?,+ last_opened: chrono::DateTime::parse_from_rfc3339(+ &row.get::<_, String>("last_opened")?,+ )+ .map(|dt| dt.with_timezone(&chrono::Utc))+ .unwrap_or_else(|_| chrono::Utc::now()),+ })+ })+ .ok();++ Ok(project)+ }+pub fn get_all_projects(&self) -> Result<Vec<Project>> {let mut stmt = self.conndiff --git a/src/main.rs b/src/main.rsindex 3e1b5b4..9ade9c9 100644--- a/src/main.rs+++ b/src/main.rs@@ -31,12 +31,17 @@ async fn main() -> Result<()> {Some("mcp-serve") => {let project_path = positional_args.get(1)- .map(PathBuf::from)- .unwrap_or(std::env::current_dir()?);- let project_path = project_path.canonicalize()?;- if !git::is_git_repo(&project_path) {- anyhow::bail!("mcp-serve requires a git project directory");- }+ .map(PathBuf::from);+ let project_path = match project_path {+ Some(p) => {+ let p = p.canonicalize()?;+ if !git::is_git_repo(&p) {+ anyhow::bail!("mcp-serve requires a git project directory");+ }+ Some(p)+ }+ None => None, // global mode+ };return agtx::mcp::serve(project_path).await;}Some("-g") => AppMode::Dashboard,diff --git a/src/mcp/mod.rs b/src/mcp/mod.rsindex 06234c7..12ce948 100644--- a/src/mcp/mod.rs+++ b/src/mcp/mod.rs@@ -1,3 +1,4 @@mod server;pub use server::serve;+pub use server::ServerMode;diff --git a/src/mcp/server.rs b/src/mcp/server.rsindex 06ecf29..57b50e0 100644--- a/src/mcp/server.rs+++ b/src/mcp/server.rs@@ -13,6 +13,16 @@ use serde::{Deserialize, Serialize};use crate::config::{GlobalConfig, ProjectConfig};use crate::db::{Database, Task, TaskStatus, TransitionRequest};+/// Whether the MCP server is bound to a specific project or serves all projects globally.+#[derive(Debug, Clone)]+pub enum ServerMode {+ /// Serve a single project (legacy / orchestrator mode β path is fixed at startup).+ Project(PathBuf),+ /// Serve all projects indexed in the global DB.+ /// CRUD tools require a `project_id` parameter.+ Global,+}+// === Parameter types ===#[derive(Debug, Deserialize, schemars::JsonSchema)]@@ -23,6 +33,11 @@ pub struct ListTasksParams {/// Filter by status: "backlog", "planning", "running", "review", "done". Omit for all tasks.#[schemars(description = "Filter by status: backlog, planning, running, review, done")]pub status: Option<String>,+ /// Project ID (required in global mode β call list_projects first to get IDs).+ #[schemars(+ description = "Project ID. Required in global mode. Call list_projects first to get project IDs."+ )]+ pub project_id: Option<String>,}#[derive(Debug, Deserialize, schemars::JsonSchema)]@@ -30,6 +45,11 @@ pub struct GetTaskParams {/// The task ID (UUID)#[schemars(description = "The task ID (UUID)")]pub task_id: String,+ /// Project ID (required in global mode β call list_projects first to get IDs).+ #[schemars(+ description = "Project ID. Required in global mode. Call list_projects first to get project IDs."+ )]+ pub project_id: Option<String>,}#[derive(Debug, Deserialize, schemars::JsonSchema)]@@ -105,6 +125,11 @@ pub struct CreateTaskParams {description = "Base branch to create the worktree from (e.g. another task's branch for stacked PRs). Defaults to project's main branch.")]pub base_branch: Option<String>,+ /// Project ID (required in global mode β call list_projects first to get IDs).+ #[schemars(+ description = "Project ID. Required in global mode. Call list_projects first to get project IDs."+ )]+ pub project_id: Option<String>,}#[derive(Debug, Deserialize, schemars::JsonSchema)]@@ -135,6 +160,11 @@ pub struct CreateTasksBatchParams {/// Array of tasks to create, with index-based dependency wiring#[schemars(description = "Array of tasks to create. Use depends_on with 0-based indices to wire dependencies between them.")]pub tasks: Vec<BatchTask>,+ /// Project ID (required in global mode β call list_projects first to get IDs).+ #[schemars(+ description = "Project ID. Required in global mode. Call list_projects first to get project IDs."+ )]+ pub project_id: Option<String>,}#[derive(Debug, Deserialize, schemars::JsonSchema)]@@ -161,6 +191,11 @@ pub struct UpdateTaskParams {description = "Base branch to create the worktree from (e.g. another task's branch for stacked PRs)")]pub base_branch: Option<String>,+ /// Project ID (required in global mode β call list_projects first to get IDs).+ #[schemars(+ description = "Project ID. Required in global mode. Call list_projects first to get project IDs."+ )]+ pub project_id: Option<String>,}#[derive(Debug, Deserialize, schemars::JsonSchema)]@@ -168,6 +203,11 @@ pub struct DeleteTaskParams {/// The task ID (UUID) to delete#[schemars(description = "The task ID (UUID) to delete. Only backlog tasks can be deleted.")]pub task_id: String,+ /// Project ID (required in global mode β call list_projects first to get IDs).+ #[schemars(+ description = "Project ID. Required in global mode. Call list_projects first to get project IDs."+ )]+ pub project_id: Option<String>,}// === Response types ===@@ -323,54 +363,94 @@ struct DeleteTaskResponse {#[derive(Debug, Clone)]pub struct AgtxMcpServer {- project_path: PathBuf,+ mode: ServerMode,tool_router: ToolRouter<Self>,}impl AgtxMcpServer {- fn new(project_path: PathBuf) -> Self {+ fn new(mode: ServerMode) -> Self {Self {- project_path,+ mode,tool_router: Self::tool_router(),}}- fn open_project_db(&self) -> Result<Database, String> {- Database::open_project(&self.project_path)+ /// Resolve a project path from an optional `project_id`.+ ///+ /// - In `Project` mode the fixed path is always returned; `project_id` is ignored.+ /// - In `Global` mode `project_id` is required and looked up in the global DB.+ fn resolve_project_path(&self, project_id: Option<&str>) -> Result<PathBuf, String> {+ match &self.mode {+ ServerMode::Project(path) => Ok(path.clone()),+ ServerMode::Global => {+ let pid = project_id.ok_or_else(|| {+ "project_id is required in global mode. Call list_projects first to get project IDs.".to_string()+ })?;+ let global_db = Database::open_global()+ .map_err(|e| format!("Failed to open global database: {}", e))?;+ match global_db.get_project_by_id(pid) {+ Ok(Some(p)) => Ok(PathBuf::from(p.path)),+ Ok(None) => Err(format!("Project not found: {}", pid)),+ Err(e) => Err(format!("Failed to look up project: {}", e)),+ }+ }+ }+ }++ /// Open a project DB, resolving the path via `resolve_project_path`.+ fn open_project_db_for(&self, project_id: Option<&str>) -> Result<Database, String> {+ let path = self.resolve_project_path(project_id)?;+ Database::open_project(&path).map_err(|e| format!("Failed to open project database: {}", e))}+ fn open_project_db(&self) -> Result<Database, String> {+ self.open_project_db_for(None)+ }+fn open_global_db(&self) -> Result<Database, String> {Database::open_global().map_err(|e| format!("Failed to open global database: {}", e))}/// Get the project name from the project path.- fn project_name(&self) -> String {- self.project_path- .file_name()- .map(|n| n.to_string_lossy().to_string())- .unwrap_or_else(|| "unknown".to_string())+ fn project_name_for(&self, project_id: Option<&str>) -> String {+ match self.resolve_project_path(project_id) {+ Ok(path) => path+ .file_name()+ .map(|n| n.to_string_lossy().to_string())+ .unwrap_or_else(|| "unknown".to_string()),+ Err(_) => "unknown".to_string(),+ }}/// Get the default agent and plugin from merged config.- fn config_defaults(&self) -> (String, Option<String>) {+ fn config_defaults_for(&self, project_id: Option<&str>) -> (String, Option<String>) {let global = GlobalConfig::load().unwrap_or_default();- let project = ProjectConfig::load(&self.project_path).unwrap_or_default();- let agent = project- .default_agent- .unwrap_or_else(|| global.default_agent.clone());- let plugin = project.workflow_plugin.clone();- (agent, plugin)+ match self.resolve_project_path(project_id) {+ Ok(path) => {+ let project = ProjectConfig::load(&path).unwrap_or_default();+ let agent = project+ .default_agent+ .unwrap_or_else(|| global.default_agent.clone());+ let plugin = project.workflow_plugin.clone();+ (agent, plugin)+ }+ Err(_) => (global.default_agent.clone(), None),+ }}/// Compute which move_task actions are valid for a task given its status and plugin rules.fn allowed_actions(&self, task: &Task, deps_satisfied: bool) -> Vec<String> {+ let project_path = self.resolve_project_path(None).ok();let mut actions = Vec::new();let _plugin = match &task.plugin {- Some(name) => crate::config::WorkflowPlugin::load(name, Some(&self.project_path))- .ok()- .or_else(|| crate::skills::load_bundled_plugin(name)),+ Some(name) => crate::config::WorkflowPlugin::load(+ name,+ project_path.as_deref(),+ )+ .ok()+ .or_else(|| crate::skills::load_bundled_plugin(name)),None => crate::skills::load_bundled_plugin("agtx"),};@@ -432,10 +512,10 @@ impl AgtxMcpServer {}#[tool(- description = "List tasks for the current project, optionally filtered by status (backlog, planning, running, review, done)"+ description = "List tasks for a project, optionally filtered by status (backlog, planning, running, review, done). In global mode, project_id is required β call list_projects first.")]fn list_tasks(&self, Parameters(params): Parameters<ListTasksParams>) -> String {- match self.open_project_db() {+ match self.open_project_db_for(params.project_id.as_deref()) {Ok(db) => {let tasks_result = if let Some(status_str) = ¶ms.status {match TaskStatus::from_str(status_str) {@@ -477,10 +557,10 @@ impl AgtxMcpServer {}#[tool(- description = "Get full details of a specific task by its ID. Includes allowed_actions based on the task's current status and plugin rules."+ description = "Get full details of a specific task by its ID. Includes allowed_actions based on the task's current status and plugin rules. In global mode, project_id is required β call list_projects first.")]fn get_task(&self, Parameters(params): Parameters<GetTaskParams>) -> String {- match self.open_project_db() {+ match self.open_project_db_for(params.project_id.as_deref()) {Ok(db) => match db.get_task(¶ms.task_id) {Ok(Some(t)) => {let deps_ok = db.deps_satisfied(&t);@@ -647,7 +727,11 @@ impl AgtxMcpServer {description = "Check if task branches have merge conflicts with the main branch. Pass a task_id to check one task, or omit it to check all Review tasks. Uses a read-only git check β no files are modified.")]fn check_conflicts(&self, Parameters(params): Parameters<CheckConflictsParams>) -> String {- let main_branch = match crate::git::detect_main_branch(&self.project_path) {+ let project_path = match self.resolve_project_path(None) {+ Ok(p) => p,+ Err(e) => return e,+ };+ let main_branch = match crate::git::detect_main_branch(&project_path) {Ok(b) => b,Err(e) => return format!("Failed to detect main branch: {}", e),};@@ -687,7 +771,7 @@ impl AgtxMcpServer {}};- match crate::git::check_merge_conflicts(&self.project_path, &main_branch, &branch) {+ match crate::git::check_merge_conflicts(&project_path, &main_branch, &branch) {Ok((has_conflicts, files)) => ConflictCheckResult {task_id: t.id,title: t.title,@@ -859,16 +943,17 @@ impl AgtxMcpServer {}#[tool(- description = "Create a new task in the Backlog column. Returns the created task's ID. Use create_tasks_batch for multiple tasks with dependencies."+ description = "Create a new task in the Backlog column. Returns the created task's ID. Use create_tasks_batch for multiple tasks with dependencies. In global mode, project_id is required β call list_projects first.")]fn create_task(&self, Parameters(params): Parameters<CreateTaskParams>) -> String {- let db = match self.open_project_db() {+ let db = match self.open_project_db_for(params.project_id.as_deref()) {Ok(db) => db,Err(e) => return e,};- let (default_agent, default_plugin) = self.config_defaults();- let project_name = self.project_name();+ let (default_agent, default_plugin) =+ self.config_defaults_for(params.project_id.as_deref());+ let project_name = self.project_name_for(params.project_id.as_deref());// Validate referenced task IDs existif let Some(ref refs) = params.referenced_tasks {@@ -902,7 +987,7 @@ impl AgtxMcpServer {}#[tool(- description = "Create multiple tasks at once with index-based dependency wiring. Each task's depends_on field uses 0-based indices into the tasks array (no forward references). Returns all created task IDs."+ description = "Create multiple tasks at once with index-based dependency wiring. Each task's depends_on field uses 0-based indices into the tasks array (no forward references). Returns all created task IDs. In global mode, project_id is required β call list_projects first.")]fn create_tasks_batch(&self,@@ -936,13 +1021,14 @@ impl AgtxMcpServer {}}- let mut db = match self.open_project_db() {+ let mut db = match self.open_project_db_for(params.project_id.as_deref()) {Ok(db) => db,Err(e) => return e,};- let (default_agent, default_plugin) = self.config_defaults();- let project_name = self.project_name();+ let (default_agent, default_plugin) =+ self.config_defaults_for(params.project_id.as_deref());+ let project_name = self.project_name_for(params.project_id.as_deref());// Pass 2: Create all tasks, collect IDslet mut created_tasks: Vec<Task> = Vec::with_capacity(params.tasks.len());@@ -989,10 +1075,10 @@ impl AgtxMcpServer {}#[tool(- description = "Update a backlog task's fields. Only tasks in Backlog status can be updated. All fields are optional β only provided fields are changed."+ description = "Update a backlog task's fields. Only tasks in Backlog status can be updated. All fields are optional β only provided fields are changed. In global mode, project_id is required β call list_projects first.")]fn update_task(&self, Parameters(params): Parameters<UpdateTaskParams>) -> String {- let db = match self.open_project_db() {+ let db = match self.open_project_db_for(params.project_id.as_deref()) {Ok(db) => db,Err(e) => return e,};@@ -1061,10 +1147,10 @@ impl AgtxMcpServer {}#[tool(- description = "Delete a task. Only tasks in Backlog status can be deleted."+ description = "Delete a task. Only tasks in Backlog status can be deleted. In global mode, project_id is required β call list_projects first.")]fn delete_task(&self, Parameters(params): Parameters<DeleteTaskParams>) -> String {- let db = match self.open_project_db() {+ let db = match self.open_project_db_for(params.project_id.as_deref()) {Ok(db) => db,Err(e) => return e,};@@ -1101,26 +1187,45 @@ impl AgtxMcpServer {#[tool_handler]impl ServerHandler for AgtxMcpServer {fn get_info(&self) -> ServerInfo {- ServerInfo {- instructions: Some(+ let instructions = match &self.mode {+ ServerMode::Global =>+ "agtx MCP server (global mode) β control the terminal kanban board for coding agents. \+ IMPORTANT: always call list_projects first to get the project_id for your target project, \+ then pass it to every other tool call. \+ Use list_tasks to see tasks, create_task or create_tasks_batch to add new tasks \+ (with optional dependency wiring via referenced_tasks), update_task to modify backlog \+ task fields, move_task to transition tasks between phases, get_transition_status to \+ check if a transition completed, and delete_task to remove backlog tasks.",+ ServerMode::Project(_) =>"agtx MCP server β control the terminal kanban board for coding agents. \Use list_tasks to see current tasks, create_task or create_tasks_batch to add new tasks \(with optional dependency wiring via referenced_tasks), update_task to modify backlog \task fields, move_task to transition tasks between phases, get_transition_status to \- check if a transition completed, and delete_task to remove backlog tasks."- .into(),- ),+ check if a transition completed, and delete_task to remove backlog tasks.",+ };+ ServerInfo {+ instructions: Some(instructions.into()),capabilities: ServerCapabilities::builder().enable_tools().build(),..Default::default()}}}-pub async fn serve(project_path: PathBuf) -> anyhow::Result<()> {- // Validate project DB can be opened- Database::open_project(&project_path)?;+pub async fn serve(project_path: Option<PathBuf>) -> anyhow::Result<()> {+ let mode = match project_path {+ Some(path) => {+ // Validate project DB can be opened+ Database::open_project(&path)?;+ ServerMode::Project(path)+ }+ None => {+ // Global mode β validate global DB can be opened+ Database::open_global()?;+ ServerMode::Global+ }+ };- let server = AgtxMcpServer::new(project_path);+ let server = AgtxMcpServer::new(mode);let service = server.serve(stdio()).await?;service.waiting().await?;Ok(())