feat: Add task-mcp server for task management via MCP
Implements 10 MCP tools for task management: - CRUD: task_add, task_list, task_show, task_close, task_update - Search: task_similar (pgvector), task_context - Relations: task_link, task_checklist_add, task_checklist_toggle Uses PostgreSQL with pgvector for semantic search via LiteLLM embeddings. Connects via SSH tunnel to docker-host:5435. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
138
src/tools/index.ts
Normal file
138
src/tools/index.ts
Normal file
@@ -0,0 +1,138 @@
|
||||
// Tool definitions for task-mcp
|
||||
|
||||
export const toolDefinitions = [
|
||||
// CRUD Tools
|
||||
{
|
||||
name: 'task_add',
|
||||
description: 'Create a new task with auto-generated ID and semantic embedding',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
title: { type: 'string', description: 'Task title (required)' },
|
||||
project: { type: 'string', description: 'Project key (e.g., ST, VPN). Auto-detected from CWD if not provided.' },
|
||||
type: { type: 'string', enum: ['task', 'bug', 'feature', 'debt'], description: 'Task type (default: task)' },
|
||||
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'], description: 'Priority level (default: P2)' },
|
||||
description: { type: 'string', description: 'Optional description' },
|
||||
},
|
||||
required: ['title'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'task_list',
|
||||
description: 'List tasks with optional filters',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
project: { type: 'string', description: 'Filter by project key' },
|
||||
status: { type: 'string', enum: ['open', 'in_progress', 'blocked', 'completed'], description: 'Filter by status' },
|
||||
type: { type: 'string', enum: ['task', 'bug', 'feature', 'debt'], description: 'Filter by type' },
|
||||
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'], description: 'Filter by priority' },
|
||||
limit: { type: 'number', description: 'Max results (default: 20)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'task_show',
|
||||
description: 'Show task details including checklist and dependencies',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Task ID (e.g., ST-1, VPN-45)' },
|
||||
},
|
||||
required: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'task_close',
|
||||
description: 'Mark a task as completed',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Task ID to close' },
|
||||
},
|
||||
required: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'task_update',
|
||||
description: 'Update task fields (status, priority, type, title)',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Task ID to update' },
|
||||
status: { type: 'string', enum: ['open', 'in_progress', 'blocked', 'completed'], description: 'New status' },
|
||||
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'], description: 'New priority' },
|
||||
type: { type: 'string', enum: ['task', 'bug', 'feature', 'debt'], description: 'New type' },
|
||||
title: { type: 'string', description: 'New title' },
|
||||
},
|
||||
required: ['id'],
|
||||
},
|
||||
},
|
||||
|
||||
// Semantic Search Tools
|
||||
{
|
||||
name: 'task_similar',
|
||||
description: 'Find semantically similar tasks using pgvector',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
query: { type: 'string', description: 'Search query' },
|
||||
project: { type: 'string', description: 'Filter by project (optional)' },
|
||||
limit: { type: 'number', description: 'Max results (default: 5)' },
|
||||
},
|
||||
required: ['query'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'task_context',
|
||||
description: 'Get related tasks for current work context (useful for delegations)',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
description: { type: 'string', description: 'Description of current work' },
|
||||
project: { type: 'string', description: 'Current project' },
|
||||
limit: { type: 'number', description: 'Max related tasks (default: 3)' },
|
||||
},
|
||||
required: ['description'],
|
||||
},
|
||||
},
|
||||
|
||||
// Relation Tools
|
||||
{
|
||||
name: 'task_link',
|
||||
description: 'Create dependency between tasks',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
from_id: { type: 'string', description: 'Source task ID' },
|
||||
to_id: { type: 'string', description: 'Target task ID' },
|
||||
link_type: { type: 'string', enum: ['blocks', 'relates_to', 'duplicates'], description: 'Relationship type' },
|
||||
},
|
||||
required: ['from_id', 'to_id', 'link_type'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'task_checklist_add',
|
||||
description: 'Add a checklist item to a task',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
task_id: { type: 'string', description: 'Task ID' },
|
||||
item: { type: 'string', description: 'Checklist item text' },
|
||||
},
|
||||
required: ['task_id', 'item'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'task_checklist_toggle',
|
||||
description: 'Toggle a checklist item (check/uncheck)',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
item_id: { type: 'number', description: 'Checklist item ID' },
|
||||
checked: { type: 'boolean', description: 'New checked state' },
|
||||
},
|
||||
required: ['item_id', 'checked'],
|
||||
},
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user