Commit 9c7516c

mo khan <mo@mokhan.ca>
2025-06-23 21:23:37
feat: add --help flags to all MCP servers for AI agent discoverability
- Add comprehensive help text to all 7 MCP servers - Include server descriptions, usage examples, and MCP protocol testing commands - Provide tool listings and capability summaries for each server - Reference detailed README documentation for each server - Enable AI coding agents to easily understand server capabilities and usage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 35ad549
Changed files (7)
cmd
fetch
filesystem
git
maildir
memory
sequential-thinking
time
cmd/fetch/main.go
@@ -2,14 +2,54 @@ package main
 
 import (
 	"context"
+	"flag"
+	"fmt"
 	"log"
 
 	"github.com/xlgmokha/mcp/pkg/fetch"
 )
 
+func printHelp() {
+	fmt.Printf(`Fetch MCP Server
+
+DESCRIPTION:
+    A Model Context Protocol server that provides web content fetching capabilities.
+    Features advanced HTML processing, markdown conversion, and content extraction.
+
+USAGE:
+    mcp-fetch [options]
+
+OPTIONS:
+    --help                 Show this help message
+
+EXAMPLE USAGE:
+    # Start the fetch server
+    mcp-fetch
+
+    # Test with MCP protocol
+    echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "fetch", "arguments": {"url": "https://example.com"}}}' | mcp-fetch
+
+MCP CAPABILITIES:
+    - Tools: fetch (web content retrieval with HTML processing)
+    - Features: goquery HTML parsing, html-to-markdown conversion
+    - Content filtering: Automatic removal of ads, navigation, scripts
+    - Protocol: JSON-RPC 2.0 over stdio
+
+For detailed documentation, see: cmd/fetch/README.md
+`)
+}
+
 func main() {
-	server := fetch.New()
+	// Parse command line flags
+	var help = flag.Bool("help", false, "Show help message")
+	flag.Parse()
 
+	if *help {
+		printHelp()
+		return
+	}
+
+	server := fetch.New()
 
 	ctx := context.Background()
 	if err := server.Run(ctx); err != nil {
cmd/filesystem/main.go
@@ -3,17 +3,58 @@ package main
 import (
 	"context"
 	"flag"
+	"fmt"
 	"log"
 	"strings"
 
 	"github.com/xlgmokha/mcp/pkg/filesystem"
 )
 
+func printHelp() {
+	fmt.Printf(`Filesystem MCP Server
+
+DESCRIPTION:
+    A Model Context Protocol server that provides secure filesystem access with configurable 
+    directory restrictions. Enables AI agents to safely interact with files and directories.
+
+USAGE:
+    mcp-filesystem [options]
+
+OPTIONS:
+    --allowed-directory <paths>    Comma-separated list of allowed directories
+    --help                        Show this help message
+
+EXAMPLE USAGE:
+    # Allow access to single directory
+    mcp-filesystem --allowed-directory /tmp
+
+    # Allow access to multiple directories
+    mcp-filesystem --allowed-directory /tmp,/home/user/projects
+
+    # Test with MCP protocol
+    echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | mcp-filesystem --allowed-directory /tmp
+
+MCP CAPABILITIES:
+    - Tools: read_file, write_file, list_directory, create_directory, move_file, search_files, and more
+    - Resources: file:// URIs for directories and files
+    - Security: Path validation and directory restrictions
+    - Protocol: JSON-RPC 2.0 over stdio
+
+For detailed documentation, see: cmd/filesystem/README.md
+`)
+}
+
 func main() {
 	// Parse command line flags
 	var allowedDirectoriesFlag = flag.String("allowed-directory", "", "Comma-separated list of allowed directories")
+	var help = flag.Bool("help", false, "Show help message")
 	flag.Parse()
 
+	if *help {
+		printHelp()
+		return
+	}
+
 	var allowedDirs []string
 	if *allowedDirectoriesFlag != "" {
 		allowedDirs = strings.Split(*allowedDirectoriesFlag, ",")
@@ -26,7 +67,6 @@ func main() {
 
 	server := filesystem.New(allowedDirs)
 
-
 	ctx := context.Background()
 	if err := server.Run(ctx); err != nil {
 		log.Fatalf("Server error: %v", err)
cmd/git/main.go
@@ -3,16 +3,56 @@ package main
 import (
 	"context"
 	"flag"
+	"fmt"
 	"log"
 	"os"
 
 	"github.com/xlgmokha/mcp/pkg/git"
 )
 
+func printHelp() {
+	fmt.Printf(`Git MCP Server
+
+DESCRIPTION:
+    A Model Context Protocol server that provides Git repository operations and browsing.
+    Supports Git commands, file browsing, branch management, and repository exploration.
+
+USAGE:
+    mcp-git [options]
+
+OPTIONS:
+    --repository <path>    Path to the Git repository (default: current directory)
+    --help                Show this help message
+
+EXAMPLE USAGE:
+    # Start server for current directory
+    mcp-git
+
+    # Start server for specific repository
+    mcp-git --repository /path/to/repo
+
+    # Test with MCP protocol
+    echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"}}}' | mcp-git
+
+MCP CAPABILITIES:
+    - Tools: git_status, git_diff, git_commit, git_add, git_log, git_create_branch, git_checkout, and more
+    - Resources: git:// URIs for files, branches, and commits
+    - Protocol: JSON-RPC 2.0 over stdio
+
+For detailed documentation, see: cmd/git/README.md
+`)
+}
+
 func main() {
 	var repository = flag.String("repository", "", "Path to the git repository (defaults to current directory)")
+	var help = flag.Bool("help", false, "Show help message")
 	flag.Parse()
 
+	if *help {
+		printHelp()
+		return
+	}
+
 	repoPath := *repository
 	if repoPath == "" {
 		var err error
@@ -24,7 +64,6 @@ func main() {
 
 	server := git.New(repoPath)
 
-
 	ctx := context.Background()
 	if err := server.Run(ctx); err != nil {
 		log.Fatalf("Server error: %v", err)
cmd/maildir/main.go
@@ -3,17 +3,59 @@ package main
 import (
 	"context"
 	"flag"
+	"fmt"
 	"log"
 	"strings"
 
 	"github.com/xlgmokha/mcp/pkg/maildir"
 )
 
+func printHelp() {
+	fmt.Printf(`Maildir MCP Server
+
+DESCRIPTION:
+    A Model Context Protocol server that provides secure email management through Maildir format.
+    Enables comprehensive email analysis, searching, and contact management capabilities.
+
+USAGE:
+    mcp-maildir [options]
+
+OPTIONS:
+    --maildir-path <paths>    Comma-separated list of Maildir directory paths (required)
+    --help                   Show this help message
+
+EXAMPLE USAGE:
+    # Single mailbox
+    mcp-maildir --maildir-path ~/.local/share/mail
+
+    # Multiple mailboxes
+    mcp-maildir --maildir-path ~/.local/share/mail/personal,~/.local/share/mail/work
+
+    # Test with MCP protocol
+    echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "maildir_scan_folders", "arguments": {"maildir_path": "~/.local/share/mail"}}}' | mcp-maildir --maildir-path ~/.local/share/mail
+
+MCP CAPABILITIES:
+    - Tools: maildir_scan_folders, maildir_list_messages, maildir_read_message, maildir_search_messages, maildir_get_thread, maildir_analyze_contacts, maildir_get_statistics
+    - Resources: maildir:// URIs for email folder access
+    - Features: Email parsing, search, contact analysis, privacy sanitization
+    - Security: Read-only access with path validation and content filtering
+    - Protocol: JSON-RPC 2.0 over stdio
+
+For detailed documentation, see: cmd/maildir/README.md
+`)
+}
+
 func main() {
 	// Parse command line flags
 	var maildirPathsFlag = flag.String("maildir-path", "", "Comma-separated list of allowed maildir paths")
+	var help = flag.Bool("help", false, "Show help message")
 	flag.Parse()
 
+	if *help {
+		printHelp()
+		return
+	}
+
 	var maildirPaths []string
 	if *maildirPathsFlag != "" {
 		maildirPaths = strings.Split(*maildirPathsFlag, ",")
cmd/memory/main.go
@@ -3,6 +3,7 @@ package main
 import (
 	"context"
 	"flag"
+	"fmt"
 	"log"
 	"os"
 	"path/filepath"
@@ -10,11 +11,54 @@ import (
 	"github.com/xlgmokha/mcp/pkg/memory"
 )
 
+func printHelp() {
+	fmt.Printf(`Memory MCP Server
+
+DESCRIPTION:
+    A Model Context Protocol server that provides persistent knowledge graph management.
+    Stores entities, relations, and observations for AI agents to maintain context across sessions.
+
+USAGE:
+    mcp-memory [options]
+
+OPTIONS:
+    --memory-file <path>    Path to the memory JSON file (default: ~/.mcp_memory.json)
+    --help                 Show this help message
+
+ENVIRONMENT VARIABLES:
+    MEMORY_FILE    Alternative way to specify memory file path
+
+EXAMPLE USAGE:
+    # Use default memory file
+    mcp-memory
+
+    # Use custom memory file
+    mcp-memory --memory-file /path/to/knowledge.json
+
+    # Test with MCP protocol
+    echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "read_graph", "arguments": {}}}' | mcp-memory
+
+MCP CAPABILITIES:
+    - Tools: create_entities, create_relations, read_graph, search_nodes, add_observations, and more
+    - Resources: memory:// URIs for knowledge graph access
+    - Persistence: JSON file storage with automatic saving
+    - Protocol: JSON-RPC 2.0 over stdio
+
+For detailed documentation, see: cmd/memory/README.md
+`)
+}
+
 func main() {
 	// Parse command line flags
 	var memoryFileFlag = flag.String("memory-file", "", "Path to the memory file (defaults to ~/.mcp_memory.json)")
+	var help = flag.Bool("help", false, "Show help message")
 	flag.Parse()
 
+	if *help {
+		printHelp()
+		return
+	}
+
 	memoryFile := *memoryFileFlag
 	if memoryFile == "" {
 		// Check environment variable
@@ -31,7 +75,6 @@ func main() {
 
 	server := memory.New(memoryFile)
 
-
 	ctx := context.Background()
 	if err := server.Run(ctx); err != nil {
 		log.Fatalf("Server error: %v", err)
cmd/sequential-thinking/main.go
@@ -2,14 +2,54 @@ package main
 
 import (
 	"context"
+	"flag"
+	"fmt"
 	"log"
 
 	"github.com/xlgmokha/mcp/pkg/thinking"
 )
 
+func printHelp() {
+	fmt.Printf(`Sequential Thinking MCP Server
+
+DESCRIPTION:
+    A Model Context Protocol server that provides structured thinking workflows.
+    Enables AI agents to perform step-by-step reasoning and problem decomposition.
+
+USAGE:
+    mcp-sequential-thinking [options]
+
+OPTIONS:
+    --help                 Show this help message
+
+EXAMPLE USAGE:
+    # Start the sequential thinking server
+    mcp-sequential-thinking
+
+    # Test with MCP protocol
+    echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "sequentialthinking", "arguments": {"task": "Analyze the problem step by step"}}}' | mcp-sequential-thinking
+
+MCP CAPABILITIES:
+    - Tools: sequentialthinking (structured reasoning workflows)
+    - Features: Step-by-step problem decomposition, logical reasoning chains
+    - Use cases: Complex problem solving, systematic analysis, decision making
+    - Protocol: JSON-RPC 2.0 over stdio
+
+For detailed documentation, see: cmd/sequential-thinking/README.md
+`)
+}
+
 func main() {
-	server := thinking.New()
+	// Parse command line flags
+	var help = flag.Bool("help", false, "Show help message")
+	flag.Parse()
 
+	if *help {
+		printHelp()
+		return
+	}
+
+	server := thinking.New()
 
 	ctx := context.Background()
 	if err := server.Run(ctx); err != nil {
cmd/time/main.go
@@ -2,14 +2,54 @@ package main
 
 import (
 	"context"
+	"flag"
+	"fmt"
 	"log"
 
 	"github.com/xlgmokha/mcp/pkg/time"
 )
 
+func printHelp() {
+	fmt.Printf(`Time MCP Server
+
+DESCRIPTION:
+    A Model Context Protocol server that provides time and date utilities.
+    Supports time zone conversions, date formatting, and temporal calculations.
+
+USAGE:
+    mcp-time [options]
+
+OPTIONS:
+    --help                 Show this help message
+
+EXAMPLE USAGE:
+    # Start the time server
+    mcp-time
+
+    # Test with MCP protocol
+    echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "get_current_time", "arguments": {}}}' | mcp-time
+
+MCP CAPABILITIES:
+    - Tools: get_current_time, convert_time
+    - Features: Time zone conversions, date formatting, temporal calculations
+    - Standards: ISO 8601 date formats, multiple time zone support
+    - Protocol: JSON-RPC 2.0 over stdio
+
+For detailed documentation, see: cmd/time/README.md
+`)
+}
+
 func main() {
-	server := time.New()
+	// Parse command line flags
+	var help = flag.Bool("help", false, "Show help message")
+	flag.Parse()
 
+	if *help {
+		printHelp()
+		return
+	}
+
+	server := time.New()
 
 	ctx := context.Background()
 	if err := server.Run(ctx); err != nil {