handoff-mcp-server 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -4
- package/bin/handoff-mcp.js +56 -13
- package/bin/resolve-binary.js +122 -0
- package/package.json +14 -9
- package/Cargo.lock +0 -686
- package/Cargo.toml +0 -30
- package/scripts/cargo-env.sh +0 -29
- package/scripts/handoff-memory-hook.py +0 -208
- package/scripts/install-local.sh +0 -109
- package/scripts/postinstall.js +0 -50
- package/scripts/sync-plugin-skills.sh +0 -35
- package/scripts/sync-plugin-version.sh +0 -85
- package/scripts/sync-workflow-inline.sh +0 -138
- package/src/cli.rs +0 -551
- package/src/context/injection.rs +0 -276
- package/src/context/mod.rs +0 -129
- package/src/lib.rs +0 -5
- package/src/main.rs +0 -157
- package/src/mcp/handlers/assignees.rs +0 -254
- package/src/mcp/handlers/auto_schedule.rs +0 -489
- package/src/mcp/handlers/bulk_update.rs +0 -155
- package/src/mcp/handlers/calendar.rs +0 -196
- package/src/mcp/handlers/capacity.rs +0 -318
- package/src/mcp/handlers/check_criterion.rs +0 -70
- package/src/mcp/handlers/config.rs +0 -402
- package/src/mcp/handlers/config_crud.rs +0 -183
- package/src/mcp/handlers/dashboard.rs +0 -214
- package/src/mcp/handlers/docs.rs +0 -2288
- package/src/mcp/handlers/docs_query.rs +0 -1335
- package/src/mcp/handlers/fork_session.rs +0 -91
- package/src/mcp/handlers/get_session.rs +0 -48
- package/src/mcp/handlers/get_task.rs +0 -53
- package/src/mcp/handlers/import_context.rs +0 -470
- package/src/mcp/handlers/init.rs +0 -28
- package/src/mcp/handlers/list_sessions.rs +0 -187
- package/src/mcp/handlers/list_tasks.rs +0 -308
- package/src/mcp/handlers/load_context.rs +0 -361
- package/src/mcp/handlers/log_time.rs +0 -67
- package/src/mcp/handlers/memory.rs +0 -961
- package/src/mcp/handlers/merge_sessions.rs +0 -103
- package/src/mcp/handlers/metrics.rs +0 -196
- package/src/mcp/handlers/milestones.rs +0 -102
- package/src/mcp/handlers/mod.rs +0 -140
- package/src/mcp/handlers/refer.rs +0 -307
- package/src/mcp/handlers/referrals.rs +0 -74
- package/src/mcp/handlers/save_context.rs +0 -354
- package/src/mcp/handlers/task_checklist.rs +0 -507
- package/src/mcp/handlers/timer.rs +0 -529
- package/src/mcp/handlers/update_session.rs +0 -197
- package/src/mcp/handlers/update_task.rs +0 -452
- package/src/mcp/mod.rs +0 -6
- package/src/mcp/protocol.rs +0 -41
- package/src/mcp/resources.rs +0 -57
- package/src/mcp/router.rs +0 -154
- package/src/mcp/tools.rs +0 -1522
- package/src/mcp/types.rs +0 -108
- package/src/setup.rs +0 -1212
- package/src/storage/config.rs +0 -578
- package/src/storage/docs/frontmatter.rs +0 -509
- package/src/storage/docs/mod.rs +0 -835
- package/src/storage/docs/model.rs +0 -708
- package/src/storage/docs/reassemble.rs +0 -167
- package/src/storage/docs/split.rs +0 -377
- package/src/storage/git.rs +0 -47
- package/src/storage/memory/injected.rs +0 -340
- package/src/storage/memory/mod.rs +0 -236
- package/src/storage/memory/model.rs +0 -127
- package/src/storage/mod.rs +0 -96
- package/src/storage/referrals.rs +0 -248
- package/src/storage/sessions.rs +0 -859
- package/src/storage/tasks.rs +0 -957
- package/templates/claude-md-section.md +0 -12
package/src/mcp/resources.rs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
use anyhow::{Context, Result};
|
|
2
|
-
use serde_json::{json, Value};
|
|
3
|
-
|
|
4
|
-
use crate::storage::config::read_config;
|
|
5
|
-
use crate::storage::sessions::{read_active_sessions, read_open_sessions, read_paused_sessions};
|
|
6
|
-
use crate::storage::{ensure_handoff_exists, handoff_dir};
|
|
7
|
-
|
|
8
|
-
pub fn handle_resource_read(uri: &str) -> Result<Value> {
|
|
9
|
-
let project_dir = std::env::current_dir().context("Failed to get current directory")?;
|
|
10
|
-
let hdir = handoff_dir(&project_dir);
|
|
11
|
-
|
|
12
|
-
if !hdir.exists() {
|
|
13
|
-
anyhow::bail!("No .handoff/ directory found. Run handoff_init first.");
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let handoff = ensure_handoff_exists(&project_dir)?;
|
|
17
|
-
|
|
18
|
-
match uri {
|
|
19
|
-
"handoff://sessions" => read_sessions_resource(&handoff),
|
|
20
|
-
"handoff://config" => read_config_resource(&handoff),
|
|
21
|
-
_ => anyhow::bail!("Unknown resource URI: {uri}"),
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
fn read_sessions_resource(handoff: &std::path::Path) -> Result<Value> {
|
|
26
|
-
let sessions_dir = handoff.join("sessions");
|
|
27
|
-
let mut sessions = read_open_sessions(&sessions_dir)?;
|
|
28
|
-
sessions.extend(read_active_sessions(&sessions_dir)?);
|
|
29
|
-
sessions.extend(read_paused_sessions(&sessions_dir)?);
|
|
30
|
-
|
|
31
|
-
let contents: Vec<Value> = sessions
|
|
32
|
-
.iter()
|
|
33
|
-
.map(|s| serde_json::to_value(s).unwrap_or_default())
|
|
34
|
-
.collect();
|
|
35
|
-
|
|
36
|
-
Ok(json!({
|
|
37
|
-
"contents": [{
|
|
38
|
-
"uri": "handoff://sessions",
|
|
39
|
-
"mimeType": "application/json",
|
|
40
|
-
"text": serde_json::to_string_pretty(&contents)?
|
|
41
|
-
}]
|
|
42
|
-
}))
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
fn read_config_resource(handoff: &std::path::Path) -> Result<Value> {
|
|
46
|
-
let config_path = handoff.join("config.toml");
|
|
47
|
-
let config = read_config(&config_path)?;
|
|
48
|
-
let toml_str = toml::to_string_pretty(&config).context("Failed to serialize config")?;
|
|
49
|
-
|
|
50
|
-
Ok(json!({
|
|
51
|
-
"contents": [{
|
|
52
|
-
"uri": "handoff://config",
|
|
53
|
-
"mimeType": "application/toml",
|
|
54
|
-
"text": toml_str
|
|
55
|
-
}]
|
|
56
|
-
}))
|
|
57
|
-
}
|
package/src/mcp/router.rs
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
use serde_json::{json, Value};
|
|
2
|
-
|
|
3
|
-
use super::handlers::handle_tool_call;
|
|
4
|
-
use super::tools::{all_resource_definitions, all_tool_definitions};
|
|
5
|
-
use super::types::{
|
|
6
|
-
InitializeResult, JsonRpcResponse, ResourcesCapability, ServerCapabilities, ServerInfo,
|
|
7
|
-
ToolsCapability, ToolsListResult, INTERNAL_ERROR, METHOD_NOT_FOUND, PROTOCOL_VERSION,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
pub fn handle_request(method: &str, params: Option<&Value>) -> JsonRpcResponse {
|
|
11
|
-
match method {
|
|
12
|
-
"initialize" => handle_initialize(),
|
|
13
|
-
"notifications/initialized" => JsonRpcResponse {
|
|
14
|
-
jsonrpc: "2.0".to_string(),
|
|
15
|
-
id: None,
|
|
16
|
-
result: None,
|
|
17
|
-
error: None,
|
|
18
|
-
},
|
|
19
|
-
"tools/list" => handle_tools_list(),
|
|
20
|
-
"tools/call" => handle_tools_call(params),
|
|
21
|
-
"resources/list" => handle_resources_list(),
|
|
22
|
-
"resources/read" => handle_resources_read(params),
|
|
23
|
-
_ => JsonRpcResponse::error(
|
|
24
|
-
None,
|
|
25
|
-
METHOD_NOT_FOUND,
|
|
26
|
-
format!("Method not found: {method}"),
|
|
27
|
-
),
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
fn handle_initialize() -> JsonRpcResponse {
|
|
32
|
-
let result = InitializeResult {
|
|
33
|
-
protocol_version: PROTOCOL_VERSION.to_string(),
|
|
34
|
-
capabilities: ServerCapabilities {
|
|
35
|
-
tools: Some(ToolsCapability {
|
|
36
|
-
list_changed: false,
|
|
37
|
-
}),
|
|
38
|
-
resources: Some(ResourcesCapability {}),
|
|
39
|
-
},
|
|
40
|
-
server_info: ServerInfo {
|
|
41
|
-
name: "handoff-mcp".to_string(),
|
|
42
|
-
version: env!("CARGO_PKG_VERSION").to_string(),
|
|
43
|
-
},
|
|
44
|
-
instructions: Some(
|
|
45
|
-
"Handoff MCP server for AI session context persistence. \
|
|
46
|
-
Call handoff_load_context at session start, \
|
|
47
|
-
handoff_save_context at session end.\n\n\
|
|
48
|
-
## Session Start\n\
|
|
49
|
-
1. Call handoff_load_context (no args needed — uses cwd)\n\
|
|
50
|
-
2. If it returns \"not initialized\", call handoff_init with the project name\n\
|
|
51
|
-
3. If session_guidance is present, call handoff_save_context with session_status='active' to establish a persistent session before starting work\n\
|
|
52
|
-
4. Check the `next_actions` array first — these are the previous session's recommended next steps. Do not re-verify work the previous session already completed\n\n\
|
|
53
|
-
## During Work — Progressive Updates\n\
|
|
54
|
-
- Use handoff_update_task to create/update tasks as work progresses\n\
|
|
55
|
-
- Mark tasks in_progress when starting, done when complete\n\
|
|
56
|
-
- Use handoff_check_criterion to check off task done_criteria as each item is verified — do not wait until the task is fully done\n\
|
|
57
|
-
- Use handoff_update_session to progressively update the active session: toggle checklist items, append decisions, notes, or context pointers\n\
|
|
58
|
-
- When work reaches a point requiring user confirmation, set the task status to review\n\
|
|
59
|
-
- Record decisions as they are made, not just at session end\n\n\
|
|
60
|
-
## Session End\n\
|
|
61
|
-
1. Call handoff_save_context with:\n\
|
|
62
|
-
- summary: one-line description of what was accomplished\n\
|
|
63
|
-
- decisions: key decisions made (with reason and confidence)\n\
|
|
64
|
-
- blockers: anything preventing progress\n\
|
|
65
|
-
- handoff_notes: caution/context/suggestion for the next session\n\
|
|
66
|
-
- context_pointers: files and line ranges the next session should look at"
|
|
67
|
-
.to_string(),
|
|
68
|
-
),
|
|
69
|
-
};
|
|
70
|
-
match serde_json::to_value(result) {
|
|
71
|
-
Ok(value) => JsonRpcResponse::success(None, value),
|
|
72
|
-
Err(e) => JsonRpcResponse::error(None, INTERNAL_ERROR, format!("Serialization error: {e}")),
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
fn handle_tools_list() -> JsonRpcResponse {
|
|
77
|
-
let result = ToolsListResult {
|
|
78
|
-
tools: all_tool_definitions(),
|
|
79
|
-
};
|
|
80
|
-
match serde_json::to_value(result) {
|
|
81
|
-
Ok(value) => JsonRpcResponse::success(None, value),
|
|
82
|
-
Err(e) => JsonRpcResponse::error(None, INTERNAL_ERROR, format!("Serialization error: {e}")),
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
fn handle_tools_call(params: Option<&Value>) -> JsonRpcResponse {
|
|
87
|
-
let params = match params {
|
|
88
|
-
Some(p) => p,
|
|
89
|
-
None => {
|
|
90
|
-
return JsonRpcResponse::error(
|
|
91
|
-
None,
|
|
92
|
-
super::types::INVALID_REQUEST,
|
|
93
|
-
"tools/call requires params",
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
let name = match params.get("name").and_then(|v| v.as_str()) {
|
|
99
|
-
Some(n) => n,
|
|
100
|
-
None => {
|
|
101
|
-
return JsonRpcResponse::error(
|
|
102
|
-
None,
|
|
103
|
-
super::types::INVALID_REQUEST,
|
|
104
|
-
"tools/call requires 'name' parameter",
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
let arguments = params
|
|
110
|
-
.get("arguments")
|
|
111
|
-
.cloned()
|
|
112
|
-
.unwrap_or_else(|| json!({}));
|
|
113
|
-
|
|
114
|
-
handle_tool_call(name, &arguments)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
fn handle_resources_list() -> JsonRpcResponse {
|
|
118
|
-
let resources = all_resource_definitions();
|
|
119
|
-
let result = json!({ "resources": resources });
|
|
120
|
-
JsonRpcResponse::success(None, result)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
fn handle_resources_read(params: Option<&Value>) -> JsonRpcResponse {
|
|
124
|
-
let params = match params {
|
|
125
|
-
Some(p) => p,
|
|
126
|
-
None => {
|
|
127
|
-
return JsonRpcResponse::error(
|
|
128
|
-
None,
|
|
129
|
-
super::types::INVALID_REQUEST,
|
|
130
|
-
"resources/read requires params",
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
let uri = match params.get("uri").and_then(|v| v.as_str()) {
|
|
136
|
-
Some(u) => u,
|
|
137
|
-
None => {
|
|
138
|
-
return JsonRpcResponse::error(
|
|
139
|
-
None,
|
|
140
|
-
super::types::INVALID_REQUEST,
|
|
141
|
-
"resources/read requires 'uri' parameter",
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
match super::resources::handle_resource_read(uri) {
|
|
147
|
-
Ok(result) => JsonRpcResponse::success(None, result),
|
|
148
|
-
Err(e) => JsonRpcResponse::error(
|
|
149
|
-
None,
|
|
150
|
-
super::types::INVALID_REQUEST,
|
|
151
|
-
format!("Resource error: {e}"),
|
|
152
|
-
),
|
|
153
|
-
}
|
|
154
|
-
}
|