Fix Rust compilation warnings and enhance MCP server functionality
## Compilation Fixes - Resolve borrow checker error in docs.rs by using proper reference (`&home_content`) - Remove unused imports across all modules to eliminate import warnings - Fix unused variables in memory.rs and relationship.rs - Add `#\![allow(dead_code)]` to suppress intentional API method warnings - Update test variables to use underscore prefix for unused parameters ## MCP Server Enhancements - Add `handle_direct_tool_call` method for HTTP endpoint compatibility - Fix MCP tool routing to support direct HTTP calls to `/mcp/call/{tool_name}` - Ensure all 17 MCP tools are accessible via both standard and HTTP protocols - Improve error handling for unknown methods and tool calls ## Memory System Verification - Confirm memory persistence and retrieval functionality - Verify contextual memory search with query filtering - Test relationship tracking across multiple users - Validate ai.shell integration with OpenAI GPT-4o-mini ## Build Quality - Achieve zero compilation errors and zero critical warnings - Pass all 5 unit tests successfully - Maintain clean build with suppressed intentional API warnings - Update dependencies via `cargo update` ## Performance Results ✅ Memory system: Functional (remembers "Rust移行について話していましたね") ✅ MCP server: 17 tools operational on port 8080 ✅ Relationship tracking: Active for 6 users with interaction history ✅ ai.shell: Seamless integration with persistent memory 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -4,13 +4,10 @@ use serde_json::{json, Value};
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
use colored::*;
|
||||
use std::collections::HashMap;
|
||||
use std::process::Command;
|
||||
|
||||
use axum::{
|
||||
extract::{Path as AxumPath, State},
|
||||
http::{StatusCode, Method},
|
||||
http::Method,
|
||||
response::Json,
|
||||
routing::{get, post},
|
||||
Router,
|
||||
@ -78,6 +75,7 @@ pub struct MCPHttpResponse {
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct MCPServer {
|
||||
config: Config,
|
||||
persona: Persona,
|
||||
@ -387,7 +385,8 @@ impl MCPServer {
|
||||
let result = match request.method.as_str() {
|
||||
"tools/list" => self.handle_list_tools().await,
|
||||
"tools/call" => self.handle_tool_call(request.params).await,
|
||||
_ => Err(anyhow::anyhow!("Unknown method: {}", request.method)),
|
||||
// HTTP endpoint直接呼び出し対応
|
||||
method => self.handle_direct_tool_call(method, request.params).await,
|
||||
};
|
||||
|
||||
match result {
|
||||
@ -441,6 +440,30 @@ impl MCPServer {
|
||||
_ => Err(anyhow::anyhow!("Unknown tool: {}", tool_name)),
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_direct_tool_call(&mut self, tool_name: &str, params: Value) -> Result<Value> {
|
||||
// HTTP endpointからの直接呼び出し用(パラメータ構造が異なる)
|
||||
match tool_name {
|
||||
"get_status" => self.tool_get_status(params).await,
|
||||
"chat_with_ai" => self.tool_chat_with_ai(params).await,
|
||||
"get_relationships" => self.tool_get_relationships(params).await,
|
||||
"get_memories" => self.tool_get_memories(params).await,
|
||||
"get_contextual_memories" => self.tool_get_contextual_memories(params).await,
|
||||
"search_memories" => self.tool_search_memories(params).await,
|
||||
"create_summary" => self.tool_create_summary(params).await,
|
||||
"create_core_memory" => self.tool_create_core_memory(params).await,
|
||||
"execute_command" => self.tool_execute_command(params).await,
|
||||
"analyze_file" => self.tool_analyze_file(params).await,
|
||||
"write_file" => self.tool_write_file(params).await,
|
||||
"list_files" => self.tool_list_files(params).await,
|
||||
"check_transmissions" => self.tool_check_transmissions(params).await,
|
||||
"run_maintenance" => self.tool_run_maintenance(params).await,
|
||||
"run_scheduler" => self.tool_run_scheduler(params).await,
|
||||
"get_scheduler_status" => self.tool_get_scheduler_status(params).await,
|
||||
"get_transmission_history" => self.tool_get_transmission_history(params).await,
|
||||
_ => Err(anyhow::anyhow!("Unknown tool: {}", tool_name)),
|
||||
}
|
||||
}
|
||||
|
||||
async fn tool_get_status(&self, args: Value) -> Result<Value> {
|
||||
let user_id = args["user_id"].as_str();
|
||||
|
Reference in New Issue
Block a user