Skip to content

Commit df0561f

Browse files
committed
update
1 parent 6ec56c2 commit df0561f

16 files changed

Lines changed: 4370 additions & 289 deletions

File tree

KNOWLEDGE_ASSISTANT_README.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# 🧠 Personal Knowledge Assistant - MCP Server Example
2+
3+
A practical demonstration of Robyn's MCP (Model Context Protocol) implementation that turns your development environment into an AI-accessible workspace.
4+
5+
## What This Does
6+
7+
This MCP server allows AI assistants like Claude Desktop to:
8+
9+
- **📁 Access your files**: Read documents, list directories, browse project structures
10+
- **🔍 Search content**: Find files containing specific text across your workspace
11+
- **📝 Manage notes**: Create and organize markdown notes in your Documents folder
12+
- **✅ Track tasks**: Add, complete, and manage your todo list
13+
- **🔧 Monitor system**: Check running processes and system statistics
14+
- **🌐 Fetch web content**: Download and analyze content from URLs
15+
- **🎯 Git integration**: View repository status and recent commits
16+
- **🤖 Smart prompts**: Generate context-aware prompts for code analysis and planning
17+
18+
## Quick Start
19+
20+
1. **Run the server**:
21+
```bash
22+
python example_knowledge_assistant.py
23+
```
24+
25+
2. **Connect Claude Desktop** to: `http://localhost:8080/mcp`
26+
27+
3. **Ask Claude natural questions** like:
28+
- *"What files are in my projects directory?"*
29+
- *"Show me my recent git commits for my-project"*
30+
- *"Create a note about today's standup meeting"*
31+
- *"What processes are using the most CPU?"*
32+
- *"Add a task to review the quarterly report"*
33+
- *"Search my files for anything about machine learning"*
34+
35+
## Example Conversations with Claude
36+
37+
### 📁 File Management
38+
```
39+
You: "What's in my Documents folder?"
40+
Claude: [Uses fs://dir/Documents resource]
41+
"I can see your Documents folder contains:
42+
📁 notes (your notes directory)
43+
📄 tasks.json (your task list)
44+
📁 projects (symlink to your projects)
45+
..."
46+
```
47+
48+
### 📝 Note Taking
49+
```
50+
You: "Create a note about the new API design we discussed"
51+
Claude: [Uses create_note tool]
52+
"I've created a note titled 'API Design Discussion' with the current timestamp.
53+
The note has been saved to your Documents/notes folder."
54+
```
55+
56+
### 🔍 Code Analysis
57+
```
58+
You: "Help me review the main.py file in my web-app project"
59+
Claude: [Uses fs://web-app/main.py resource, then analyze_file_structure prompt]
60+
"I can see your main.py file. Here's my analysis:
61+
- The code structure follows Flask patterns well
62+
- Consider adding error handling for the database connections
63+
- The API endpoints could benefit from input validation
64+
..."
65+
```
66+
67+
## Directory Structure
68+
69+
The assistant automatically creates:
70+
71+
```
72+
~/Documents/
73+
├── notes/ # Markdown notes created via MCP
74+
└── tasks.json # JSON task list
75+
76+
~/projects/ # Your development projects
77+
├── project1/
78+
├── project2/
79+
└── ...
80+
```
81+
82+
## Security Features
83+
84+
- **Home directory only**: File access is restricted to your home directory
85+
- **Safe evaluation**: Mathematical expressions use restricted eval
86+
- **Path validation**: All file paths are validated before access
87+
- **Read-only git**: Git operations are read-only (status, log)
88+
89+
## MCP Resources Available
90+
91+
### File System
92+
- `fs://{path}` - Read any file in your home directory
93+
- `fs://dir/{path}` - List directory contents
94+
95+
### Git Integration
96+
- `git://repo/{repo_name}` - Get repository status and recent commits
97+
98+
### System Monitoring
99+
- `system://processes` - Running processes (with fallback if psutil not available)
100+
- `system://stats` - System statistics and disk usage
101+
102+
## MCP Tools Available
103+
104+
- **create_note(title, content, tags)** - Create markdown notes
105+
- **add_task(task, priority, due_date)** - Add items to task list
106+
- **complete_task(task_id)** - Mark tasks as done
107+
- **search_files(query, directory)** - Search file contents
108+
- **fetch_url_content(url, max_length)** - Download web content
109+
110+
## MCP Prompts Available
111+
112+
- **analyze_file_structure(directory)** - Generate project analysis prompts
113+
- **code_review_request(file_path, focus_area)** - Create code review prompts
114+
- **task_prioritization(context)** - Help organize and prioritize work
115+
116+
## Optional Dependencies
117+
118+
For enhanced functionality, install:
119+
120+
```bash
121+
pip install psutil # Better system monitoring
122+
```
123+
124+
The server works without these dependencies using fallbacks.
125+
126+
## Real-World Use Cases
127+
128+
### 🏗️ Development Workflow
129+
*"Claude, look at my projects directory and help me prioritize which project to work on next based on recent activity"*
130+
131+
### 📊 Project Analysis
132+
*"Analyze the structure of my web-app project and suggest improvements"*
133+
134+
### 📝 Meeting Notes
135+
*"Create a note about today's architecture review meeting with the key decisions we made"*
136+
137+
### 🔍 Code Search
138+
*"Find all files in my projects that mention 'authentication' and summarize the different approaches I'm using"*
139+
140+
### 📋 Task Management
141+
*"Add a task to refactor the user service, set priority to high, and due date to Friday"*
142+
143+
## Integration with Claude Desktop
144+
145+
Once connected, Claude can seamlessly:
146+
- Browse your file system as if it's a native capability
147+
- Remember context across conversations about your projects
148+
- Suggest improvements based on your actual codebase
149+
- Help organize and prioritize your real tasks
150+
- Provide code reviews of your actual files
151+
152+
This transforms Claude from a general assistant into a personalized development companion that understands your specific workspace and projects.
153+
154+
## Advanced Usage
155+
156+
The MCP implementation supports:
157+
- **URI templates** with parameter extraction
158+
- **Auto-generated schemas** from Python type hints
159+
- **Async/sync handlers** for all operations
160+
- **Proper error handling** with MCP-compliant responses
161+
- **Type-safe parameter passing** from JSON-RPC calls
162+
163+
This makes it easy to extend with additional resources, tools, and prompts specific to your workflow.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ python --version
131131
- Dependency Injection
132132
- Hot Reloading
133133
- Direct Rust Integration
134+
- **🤖 AI Agent Support** - Built-in agent routing and execution
135+
- **🔌 MCP (Model Context Protocol)** - Connect to AI applications as a server
134136
- Community First and truly FOSS!
135137

136138
## 🗒️ How to contribute

docs_src/src/components/documentation/Navigation.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@ export const navigation = [
316316
href: '/documentation/en/api_reference/dependency_injection',
317317
title: 'Dependency Injection',
318318
},
319+
{
320+
href: '/documentation/en/api_reference/mcps',
321+
title: 'MCPs',
322+
},
323+
{
324+
href: '/documentation/en/api_reference/agents',
325+
title: 'AI Agents',
326+
},
319327
],
320328
},
321329
{
@@ -446,6 +454,7 @@ const translations = {
446454
'Direct Rust Usage': 'Direct Rust Usage',
447455
'GraphQL Support': 'GraphQL Support',
448456
'Dependency Injection': 'Dependency Injection',
457+
'AI Agents': 'AI Agents',
449458
Talks: 'Talks',
450459
Blogs: 'Blogs',
451460
Introduction: 'Introduction',
@@ -488,6 +497,7 @@ const translations = {
488497
'Direct Rust Usage': '直接使用 Rust',
489498
'GraphQL Support': 'GraphQL 支持',
490499
'Dependency Injection': '依赖注入',
500+
'AI Agents': 'AI 代理',
491501
'Talks': '演讲',
492502
'Blogs': '博客',
493503
'Introduction': '引入',

0 commit comments

Comments
 (0)