Summary
Create a TypeScript MCP server that provides task dispatch functionality for Claude Code, replacing the bash-based plugin approach.
User Story
As a Claude Code user, I want task dispatch functionality via MCP tools, so that Claude can fetch pending tasks and report completion without bash scripts.
Context
Current State (to be removed)
Claude Code → bash hooks → psql → PostgreSQL ❌
Target Architecture
┌─────────────┐ ┌──────────────────┐ ┌─────────────────────┐ ┌────────────┐
│ Claude Code │ ←→ │ TypeScript │ ←→ │ VirtualAssistant │ ←→ │ PostgreSQL │
│ │ │ MCP Server │ │ (C# .NET API) │ │ │
└─────────────┘ └──────────────────┘ └─────────────────────┘ └────────────┘
HTTP calls Entity Framework
Technology Stack (simplified)
C# .NET - VirtualAssistant API + database access (existing)
TypeScript - MCP server for Claude Code (new)
No bash scripts
Why MCP Server instead of Hooks?
Cleaner architecture - MCP is the standard way for Claude to interact with external services
No bash - Pure TypeScript, type-safe, testable
Flexible - Claude can call tools anytime, not just on SessionStart/Stop
Reusable - Same MCP server can be used by multiple Claude instances
Requirements
Must Have
Should Have
Technical Specification
MCP Server Location
~/mcp-servers/task-dispatch/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── tools/
│ │ ├── get-pending-task.ts
│ │ └── complete-task.ts
│ ├── api-client.ts # HTTP client for VirtualAssistant
│ └── types.ts # TypeScript interfaces
├── package.json
├── tsconfig.json
└── README.md
MCP Tools
get_pending_task
Fetches the oldest pending task for Claude agent.
Input: None
Output:
interface PendingTaskResult {
found : boolean ;
task ?: {
id : number ;
githubIssueUrl : string ;
githubIssueNumber : number ;
summary : string ;
createdAt : string ;
} ;
message : string ;
}
Implementation:
// Calls GET http://localhost:5055/api/claude/tasks/pending
// Returns task data or "No pending tasks" message
complete_task
Marks a task as completed with result summary.
Input:
interface CompleteTaskInput {
taskId : number ;
result : string ;
sessionId ?: string ;
}
Output:
interface CompleteTaskResult {
success : boolean ;
taskId : number ;
status : string ;
completedAt : string ;
message : string ;
}
Implementation:
// Calls POST http://localhost:5055/api/claude/tasks/{id}/complete
// Body: { sessionId, result }
Claude Code Configuration
Add to ~/.claude/settings.json:
{
"mcpServers" : {
"task-dispatch" : {
"command" : " node" ,
"args" : [" ~/mcp-servers/task-dispatch/dist/index.js" ],
"env" : {
"API_URL" : " http://localhost:5055"
}
}
}
}
VirtualAssistant API (already implemented)
Endpoints in VirtualAssistant repo (issue #214):
✅ GET /api/claude/tasks/pending
✅ POST /api/claude/tasks/{id}/complete
Acceptance Criteria
Given MCP server is running, when Claude uses get_pending_task tool, then it returns pending task or "no tasks" message
Given a pending task exists, when get_pending_task is called, then task is marked as sent in database
Given valid task ID and result, when complete_task is called, then task is marked as completed
Given API is unreachable, when tools are called, then appropriate error is returned
Given old bash plugin exists, when this is implemented, then bash scripts are removed
Out of Scope
Auto-dispatch on session start (Claude will call tools manually or via prompts)
WebSocket real-time notifications
Authentication/authorization
Related
References
Summary
Create a TypeScript MCP server that provides task dispatch functionality for Claude Code, replacing the bash-based plugin approach.
User Story
As a Claude Code user, I want task dispatch functionality via MCP tools, so that Claude can fetch pending tasks and report completion without bash scripts.
Context
Current State (to be removed)
Target Architecture
Technology Stack (simplified)
Why MCP Server instead of Hooks?
Requirements
Must Have
get_pending_tasktoolcomplete_tasktoolplugins/task-dispatch/scripts/)Should Have
Technical Specification
MCP Server Location
MCP Tools
get_pending_taskFetches the oldest pending task for Claude agent.
Input: None
Output:
Implementation:
complete_taskMarks a task as completed with result summary.
Input:
Output:
Implementation:
Claude Code Configuration
Add to
~/.claude/settings.json:{ "mcpServers": { "task-dispatch": { "command": "node", "args": ["~/mcp-servers/task-dispatch/dist/index.js"], "env": { "API_URL": "http://localhost:5055" } } } }VirtualAssistant API (already implemented)
Endpoints in VirtualAssistant repo (issue #214):
GET /api/claude/tasks/pendingPOST /api/claude/tasks/{id}/completeAcceptance Criteria
get_pending_tasktool, then it returns pending task or "no tasks" messageget_pending_taskis called, then task is marked assentin databasecomplete_taskis called, then task is marked ascompletedOut of Scope
Related
References