Skip to content

Commit 7d273b0

Browse files
authored
Add MCP Support to 'list' and 'info' Commands (#85)
## Summary Implements comprehensive MCP (Model Context Protocol) support for the struct tool as requested in issue #75. ## Changes Made ### Core MCP Implementation - **MCP Server**: Added `struct_module/mcp_server.py` with full stdio transport support - **MCP Command**: Added `struct_module/commands/mcp.py` for starting MCP server - **Dependencies**: Added `mcp` package to requirements.txt ### MCP Tools Implemented 1. **list_structures**: List all available structure definitions 2. **get_structure_info**: Get detailed information about a specific structure 3. **generate_structure**: Generate structures with various options (supports console output for AI workflows) 4. **validate_structure**: Validate structure configuration YAML files ### Enhanced Commands - **list command**: Added `--mcp` flag for MCP integration - **info command**: Added `--mcp` flag for MCP integration - Both commands maintain full backward compatibility ### AI-Assisted Development Support - Console output mode for structure generation enables AI prompt chaining - MCP tools can be used programmatically for automated workflows - Enhanced documentation with workflow examples ### Testing & Documentation - Complete test suite in `tests/test_mcp_integration.py` (9 test cases, all passing) - Comprehensive documentation in `docs/mcp-integration.md` - Updated README.md with MCP feature highlights ## Usage Examples ```bash # Start MCP server struct mcp --server # Use MCP integration in existing commands struct list --mcp struct info project/python --mcp ``` ## Benefits ✅ **Automation**: Programmatic access to all struct tool functionality ✅ **Integration**: Easy integration with AI tools and development workflows ✅ **Backward Compatibility**: All existing functionality remains unchanged ✅ **Comprehensive**: Covers all major struct operations (list, info, generate, validate) ✅ **Well-Tested**: Full test coverage with 9 test cases ✅ **Documented**: Complete usage guide and examples ## Addresses Closes #75 ## Testing - [x] All existing tests pass (44/44) - [x] New MCP integration tests pass (9/9) - [x] Manual testing of MCP server and CLI integration - [x] Verified backward compatibility ## Assignee @httpdss
1 parent 6f23d78 commit 7d273b0

File tree

9 files changed

+1155
-2
lines changed

9 files changed

+1155
-2
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- **🪝 Automation Hooks** - Pre and post-generation shell commands
1616
- **🎯 Dry Run Mode** - Preview changes before applying them
1717
- **✅ Validation & Schema** - Built-in YAML validation and IDE support
18+
- **🤖 MCP Integration** - Model Context Protocol support for AI-assisted development workflows
1819

1920
## 🚀 Quick Start
2021

@@ -39,8 +40,41 @@ struct list
3940

4041
# Validate a configuration
4142
struct validate my-config.yaml
43+
44+
# Start MCP server for AI integration
45+
struct mcp --server
46+
```
47+
48+
### 🤖 MCP Integration Quick Start
49+
50+
Struct supports MCP (Model Context Protocol) for seamless AI tool integration:
51+
52+
```bash
53+
# 1. Start the MCP server
54+
struct mcp --server
55+
56+
# 2. Configure your AI tool (Claude Desktop example)
57+
# Add to ~/.config/claude/claude_desktop_config.json:
58+
{
59+
"mcpServers": {
60+
"struct": {
61+
"command": "struct",
62+
"args": ["mcp", "--server"]
63+
}
64+
}
65+
}
66+
67+
# 3. Use MCP tools in your AI conversations:
68+
# - list_structures: Get all available structures
69+
# - get_structure_info: Get details about a structure
70+
# - generate_structure: Generate project structures
71+
# - validate_structure: Validate YAML configs
4272
```
4373

74+
**Supported MCP Clients:** Claude Desktop, Cline/Continue, Custom clients
75+
76+
[📖 Full MCP Integration Guide](docs/mcp-integration.md)
77+
4478
### Example Configuration
4579

4680
```yaml
@@ -87,6 +121,7 @@ Our comprehensive documentation is organized into the following sections:
87121
- **[Hooks](docs/hooks.md)** - Pre and post-generation automation
88122
- **[Mappings](docs/mappings.md)** - External data integration
89123
- **[GitHub Integration](docs/github-integration.md)** - Automation with GitHub Actions
124+
- **[MCP Integration](docs/mcp-integration.md)** - Model Context Protocol for AI-assisted workflows
90125
- **[Command-Line Completion](docs/completion.md)** - Enhanced CLI experience
91126
92127
### 👩‍💻 Development

0 commit comments

Comments
 (0)