@@ -5,11 +5,18 @@ description of each tool.
5
5
6
6
## Environment Variables Configuration
7
7
8
+ The tools system can be configured using environment variables to enable or disable specific features:
9
+
8
10
### General Configuration
9
11
10
- - ` MCP_DOCUMENT_NAME_FORMAT ` : Controls how documents are named in the system.
11
- - Default: ` [{path}] {description} `
12
- - Example: A document might appear as ` [src/file.php] Main controller file `
12
+ | Variable | Description | Default |
13
+ | -----------------------------| --------------------------------------------| ---------|
14
+ | ` MCP_CUSTOM_TOOLS_ENABLE ` | Enable/disable custom tools | ` true ` |
15
+ | ` MCP_TOOL_MAX_RUNTIME ` | Maximum runtime for a command in seconds | ` 30 ` |
16
+ | ` MCP_FILE_OPERATIONS ` | Master switch for all file operation tools | ` true ` |
17
+ | ` MCP_FILE_WRITE ` | Enable/disable file write operations | ` true ` |
18
+ | ` MCP_FILE_APPLY_PATCH ` | Enable/disable applying patches to files | ` false ` |
19
+ | ` MCP_FILE_DIRECTORIES_LIST ` | Enable/disable directory listing | ` true ` |
13
20
14
21
## Available Tool Categories
15
22
@@ -60,40 +67,101 @@ These tools are always available regardless of environment configuration:
60
67
| ` document-content ` | Get document content by ID |
61
68
| ` list-tools ` | List all available tools (what you're using now) |
62
69
63
- ## Configuration Examples
70
+ ## Custom Tools
71
+
72
+ The Custom Tools feature allows you to define project-specific commands that can be executed directly from the
73
+ configuration files. This enables easy integration of common development tasks, build processes, code analysis, and
74
+ more.
75
+
76
+ ## Configuration Format
77
+
78
+ Custom tools are defined in the ` tools ` section of the configuration file.
79
+
80
+ ** Here's the basic structure:**
81
+
82
+ ``` yaml
83
+ tools :
84
+ - id : tool-id # Unique identifier for the tool
85
+ description : ' Tool description' # Human-readable description
86
+ env : # Optional environment variables for all commands
87
+ KEY1 : value1
88
+ KEY2 : value2
89
+ commands : # List of commands to execute
90
+ - cmd : executable # Command to run
91
+ args : # Command arguments (array)
92
+ - arg1
93
+ - arg2
94
+ workingDir : path/to/dir # Optional working directory (relative to project root)
95
+ env : # Optional environment variables for this command
96
+ KEY1 : value1
97
+ KEY2 : value2
98
+ ` ` `
64
99
65
- ### Developer Mode (All Features)
100
+ ## Example Use Cases
66
101
67
- ```
68
- MCP_FILE_OPERATIONS=true
69
- MCP_FILE_WRITE=true
70
- MCP_FILE_APPLY_PATCH=true
71
- MCP_FILE_DIRECTORIES_LIST=true
72
- MCP_CONTEXT_OPERATIONS=true
73
- MCP_PROMPT_OPERATIONS=true
102
+ ### 1. Code Style Fixing
103
+
104
+ ` ` ` yaml
105
+ tools :
106
+ - id : cs-fixer
107
+ description : ' Fix code style issues'
108
+ commands :
109
+ - cmd : composer
110
+ args : [
111
+ - cs:fix
74
112
` ` `
75
113
76
- ### Read-Only Mode (Safe for Production)
114
+ ### 2. Static Analysis
77
115
116
+ ` ` ` yaml
117
+ tools :
118
+ - id : phpstan
119
+ description : ' Run static analysis'
120
+ commands :
121
+ - cmd : vendor/bin/phpstan
122
+ args : [ 'analyse', 'src', '--level', '8' ]
78
123
` ` `
79
- MCP_FILE_OPERATIONS=true
80
- MCP_FILE_WRITE=false
81
- MCP_FILE_APPLY_PATCH=false
82
- MCP_FILE_DIRECTORIES_LIST=true
83
- MCP_CONTEXT_OPERATIONS=true
84
- MCP_PROMPT_OPERATIONS=false
85
- ```
86
-
87
- ### Minimal Mode
88
124
125
+ ### 3. Multi-Step Processes
126
+
127
+ ` ` ` yaml
128
+ tools :
129
+ - id : test-suite
130
+ description : ' Run full test suite with coverage'
131
+ commands :
132
+ - cmd : composer
133
+ args : [ 'install', '--no-dev' ]
134
+ - cmd : vendor/bin/phpunit
135
+ args : [ '--coverage-html', 'coverage' ]
136
+ - cmd : vendor/bin/infection
137
+ args : [ '--min-msi=80' ]
89
138
` ` `
90
- MCP_FILE_OPERATIONS=true
91
- MCP_FILE_WRITE=false
92
- MCP_FILE_APPLY_PATCH=false
93
- MCP_FILE_DIRECTORIES_LIST=true
94
- MCP_CONTEXT_OPERATIONS=false
95
- MCP_PROMPT_OPERATIONS=false
139
+
140
+ ### 4. Deployment
141
+
142
+ ` ` ` yaml
143
+ tools :
144
+ - id : deploy-staging
145
+ description : ' Deploy to staging environment'
146
+ commands :
147
+ - cmd : bash
148
+ args : [ 'deploy.sh', 'staging' ]
149
+ env :
150
+ DEPLOY_TOKEN : " ${STAGING_TOKEN}"
96
151
` ` `
97
152
98
- This documentation provides users with a clear understanding of available tools, their purpose, and how to enable or
99
- disable them without requiring knowledge of the underlying class implementation.
153
+ ## Security Considerations
154
+
155
+ The custom tools feature includes several security measures:
156
+
157
+ 1. **Environment Variable Controls**:
158
+ - ` MCP_CUSTOM_TOOLS_ENABLE`: Enable/disable the custom tools feature (default: `true`)
159
+ - `MCP_TOOL_MAX_RUNTIME` : Maximum runtime for a command in seconds (default: `30`)
160
+
161
+ # # Best Practices
162
+
163
+ 1. **Keep Commands Simple** : Break complex operations into multiple commands
164
+ 2. **Use Environment Variables** : Avoid hardcoding secrets in tool configurations
165
+ 3. **Set Appropriate Timeouts** : Adjust the `max_runtime` for long-running commands
166
+ 4. **Test Thoroughly** : Test custom tools before implementing them in production
167
+ 5. **Consider Security** : Be cautious about what commands are allowed and who can execute them
0 commit comments