/server name:prompt nameprompts/get API of the MCP server is called to obtain the full content.local > project > user-p/--print parameter is used), approval cannot be performed through the UI, so you need to preconfigure allowed MCP servers through the --settings parameter:# Method 1: Allow all project MCP serverscodebuddy --settings '{"enableAllProjectMcpServers": true}' -p "your prompt"# Method 2: Allow specific MCP serverscodebuddy --settings '{"enabledMcpjsonServers": ["server-name-1", "server-name-2"]}' -p "your prompt"
mcp__<server_name>__<tool_name>, with segments separated by double underscores __ (single underscores in names are treated as regular characters). Rules can be written in three ways:mcp__<server_name>
mcp__<server_name>__, that is, all tools of this server. Equivalent notation: mcp__<server_name>__*.mcp__<server_name>__<tool_name>
mcp__*
deny and ask. Placing it in allow has no effect. To allow tools in batches, list them by server.mcp__web-search is equivalent to mcp__web_search.* can only replace the entire last segment. mcp__git* and mcp__github__get_* do not match any tools, and no error is reported.mcp__. A bare * has no effect on them. To deny all MCP tools, write "deny": ["mcp__*"].mcp__github__.{"permissions": {"allow": ["mcp__github"]}}
{"permissions": {"allow": ["mcp__github__get_issue","mcp__github__list_issues"]}}
{"permissions": {"deny": ["mcp__dangerous_server__delete_file"]}}
mcp__filesystem__.{"permissions": {"deny": ["mcp__filesystem"]}}
{"permissions": {"deny": ["mcp__*"]}}
~/.codebuddy/.mcp.json (recommended)~/.codebuddy/mcp.json (deprecated)~/.codebuddy.json (legacy configuration file)~/.codebuddy/.mcp.json (highest priority).<project_root>/.mcp.json (recommended)<project_root>/mcp.json (deprecated)<project_root>/.mcp.json (highest priority).projects field is used to distinguish local configurations of different projects.~/.codebuddy.json#/projects/<workspace_path>#/projects/<workspace_path> uses JSON Pointer syntax to point to a specific location in a JSON document. For details about JSON Pointer, see https://datatracker.ietf.org/doc/html/rfc6901.// to add inline or end-of-line comments./* */ to add block comments.{// MCP server configuration"mcpServers": {"server-name": {"type": "stdio|sse|http","command": "Command path","args": ["parameter1", "parameter2"],"env": {"ENV_VAR": "value"},"url": "http://example.com/mcp","headers": {"Authorization": "Bearer token"},"description": "Server description"}},// The projects field is valid only in files within the user scope and is used to identify configurations in the local scope."projects": {"/path/to/project": {"mcpServers": {"local-server": {"type": "stdio","command": "./local-tool"}}}}}
{// MCP Server Configuration for CodeBuddy// This file configures the MCP servers used by the project."mcpServers": {/** Filesystem Server* Provides file system access capabilities.* Documentation: https://github.com/modelcontextprotocol/servers*/"filesystem": {"type": "stdio","command": "npx","args": ["-y","@modelcontextprotocol/server-filesystem","/path/to/workspace", // Workspace directory path],"env": {"DEBUG": "true", // Enable debug mode},},// HTTP API server example"api-server": {"type": "http","url": "http://localhost:3000/mcp", // Local development server"headers": {"Authorization": "Bearer your-token",},},},// List of disabled servers (for reference)"disabledMcpServers": ["deprecated-server",],}
**Note**: The `type` field is optional. If not specified, the system automatically infers it based on the configuration content:- When the `command` field is included, the type is inferred as `stdio`.- When the `url` field is included, the type is inferred as `http`.It is recommended to explicitly specify the `type` field to ensure configuration accuracy.### Environment variable expansionMCP configuration supports environment variable expansion, allowing you to reference system environment variables in the configuration. This is particularly useful for sharing configurations across teams, managing sensitive information such as API keys and tokens, and supporting environment-specific configurations for development, testing, and production.#### Supported Syntax- **`${VAR_NAME}`** - Expands to the value of the environment variable VAR_NAME.- **`${VAR_NAME:-default_value}`** - If VAR_NAME is not set, the default value is used.#### Variable Naming Rules- Variable names must start with an uppercase letter or an underscore `[A-Z_]`.- Subsequent characters can only be uppercase letters, digits, or underscores `[A-Z0-9_]*`.- Variables that are lowercase, mixed-case, or start with a digit are not expanded.#### Supported Configuration FieldsEnvironment variables can be expanded in the following configuration fields:**STDIO Type Configuration**:- `command` - Path to the executable file or the command.- `args` - Each parameter in the command line parameter list.- `env` - Environment variable values (keys are not expanded).**SSE/HTTP/Remote Type Configuration**:- `url` - Service endpoint URL.- `headers` - HTTP request header values (keys are not expanded).#### Error Handling**Behavior When Environment Variables Are Not Set**:- If the environment variable is not set and has a default value, the default value is used.- If the environment variable is not set and has no default value, keep the original placeholder (`${VAR}`) and report a WARNING message in diagnostics.This means that the configuration does not fail due to missing environment variables. Instead, it retains the placeholders and issues a warning.#### Example Configuration**Example 1: STDIO Type Server Using Environment Variables**```json{"mcpServers": {"python-tools": {"type": "stdio","command": "${PYTHON_PATH:-python}","args": ["-m","my_mcp_server","--config","${CONFIG_DIR:-/etc/config}"],"env": {"PYTHONPATH": "${PYTHON_LIB_PATH}","DEBUG": "${DEBUG_MODE:-false}","API_KEY": "${API_KEY}"}}}}
{"mcpServers": {"api-server": {"type": "http","url": "${API_BASE_URL:-https://api.example.com}/mcp","headers": {"Authorization": "Bearer ${API_TOKEN}","X-API-Version": "${API_VERSION:-v1}","User-Agent": "CodeBuddy/${CODEBUDDY_VERSION:-1.0}"}}}}
# Using Environment Variables in .mcp.json# Each team member sets environment variables locally.export API_TOKEN="their-personal-token"export LOCAL_TOOL_PATH="/home/user/tools"
# Development Environmentexport API_BASE_URL="http://localhost:3000"# Production Environmentexport API_BASE_URL="https://api.production.com"
{"headers": {"Authorization": "Bearer ${MY_API_KEY}"}}
/mcp command to view MCP server configuration and diagnostic information.Missing environment variables: API_TOKEN, DATABASE_URL
Field | Type | Required | Description |
type | string | Yes | Fixed value "stdio" |
command | string | Yes | Executable file path or command |
args | Array<string> | No | Command-line argument list |
env | Object | No | Environment variable key-value pairs |
defer_loading | boolean | No | Whether to lazily load tools (default: false) |
tools | Object | No | Tool-level configuration that can override server-level settings |
{"type": "stdio","command": "python","args": ["-m", "my_mcp_server"],"env": {"PYTHONPATH": "/path/to/tools","DEBUG": "true"}}
Field | Type | Required | Description |
type | string | Yes | Fixed value "sse" |
url | string | Yes | SSE endpoint URL |
headers | Object | No | HTTP request header key-value pairs |
defer_loading | boolean | No | Whether to lazily load tools (default: false) |
tools | Object | No | Tool-level configuration that can override server-level settings |
{"type": "sse","url": "https://api.example.com/mcp/sse","headers": {"Authorization": "Bearer your-api-token","X-API-Version": "v1"}}
Field | Type | Required | Description |
type | string | Yes | Fixed value "http" |
url | string | Yes | HTTP endpoint URL |
headers | Object | No | HTTP request header key-value pairs |
defer_loading | boolean | No | Whether to lazily load tools (default: false) |
tools | Object | No | Tool-level configuration that can override server-level settings |
{"type": "http","url": "https://mcp.example.com/api/v1","headers": {"Authorization": "Bearer secret-token","Content-Type": "application/json"}}
defer_loading configuration to lazy-load tools, reducing context consumption and improving the accuracy of model tool selection.defer_loading: true are not loaded into the model context during the initial request.ToolSearch tool.{"mcpServers": {"my-server": {"type": "stdio","command": "my-mcp-server","defer_loading": true}}}
{"mcpServers": {"my-server": {"type": "stdio","command": "my-mcp-server","defer_loading": true,"tools": {"frequently_used_tool": {"defer_loading": false}}}}}
Server defer_loading | Tool defer_loading | Final Result |
true | Not set | true (inherited) |
true | false | false (overridden) |
false/Not set | Not set | false |
false/Not set | true | true (overridden) |
defer_loading in the MCP configuration, you can use the Defer(...) / NoDefer(...) modifiers in the --tools parameter or custom agent frontmatter to temporarily change the lazy-loading state of a tool or a group of tools:# Temporarily put the entire set of GitHub MCP tools into lazy loadingcodebuddy --tools "default,Defer(mcp__github__*)"# Force the MCP tool to be directly available this time, even if it is lazy-loaded by default.codebuddy --tools "default,NoDefer(mcp__time__current_time)"
defer_loading configuration in MCP, and NoDefer always overrides Defer. For details, see Tool Lazy Loading Override.# Add a local executable filecodebuddy mcp add --scope user my-tool -- /path/to/tool arg1 arg2# Add a Python scriptcodebuddy mcp add --scope project python-tool -- python /path/to/script.py
# Add an SSE servercodebuddy mcp add --scope user --transport sse sse-server https://example.com/mcp/sse
# Add an HTTP streaming servercodebuddy mcp add --scope project --transport http http-server https://example.com/mcp/http
# Add a STDIO servercodebuddy mcp add-json --scope user my-server '{"type":"stdio","command":"/usr/local/bin/tool","args":["--verbose"]}'# Add an HTTP servercodebuddy mcp add-json --scope user http-server '{"type":"http","url":"https://example.com/mcp","headers":{"Authorization":"Bearer token"}}'# Add an SSE servercodebuddy mcp add-json --scope project sse-server '{"type":"sse","url":"https://api.example.com/mcp/sse","headers":{"X-API-Key":"your-api-key"}}'# Add a STDIO server with environment variablescodebuddy mcp add-json --scope user python-tool '{"type":"stdio","command":"python","args":["-m","my_mcp_server"],"env":{"PYTHONPATH":"/path/to/tools"}}'
# List servers in all scopescodebuddy mcp list
# View information for a specific servercodebuddy mcp get my-server
# Remove a specific servercodebuddy mcp remove my-server# Remove servers in a specific scopecodebuddy mcp remove my-server --scope user
${API_TOKEN} or ${API_TOKEN:-default}) to manage sensitive data such as API keys and tokens..gitignore.{"mcpServers": {"python-tools": {"type": "stdio","command": "python","args": ["-m", "my_mcp_server"],"env": {"PYTHONPATH": "/path/to/tools"},"description": "A collection of Python tools"}}}
{"mcpServers": {"api-server": {"type": "sse","url": "https://api.example.com/mcp/sse","headers": {"Authorization": "Bearer your-token","X-API-Version": "v1"},"description": "Remote API service"}}}
{"mcpServers": {"node-server": {"type": "stdio","command": "node","args": ["./mcp-server.js"],"env": {"NODE_ENV": "production"},"description": "Node.js MCP server"}}}
FastMCP@modelcontextprotocol/sdkcodebuddy mcp add --scope user --transport http --header "X-Tapd-Access-Token: TAPD_ACCESS_TOKEN" -- tapd_mcp_http https://mcp-oa.tapd.woa.com/mcp
codebuddy mcp add --scope user chrome-devtools -- npx -y chrome-devtools-mcp@latest
codebuddy mcp add --scope user iwiki -- npx -y mcp-remote@latest https://prod.mcp.it.woa.com/app_iwiki_mcp/mcp3
MAX_MCP_OUTPUT_TOKENS (default: 20000 tokens, approximately 80KB of characters), CodeBuddy automatically processes it to avoid consuming too much context:~/.codebuddy/projects/<project-hash>/<session-id>/tool-results/mcp-<server>-<tool>-<timestamp>-<rand>.txt in the current session, and return a read guide to the model (including the file path, format description, and segmented reading requirements). The model can read the complete content in segments by using the Read tool with the offset / limit parameters, or perform structured queries on the JSON structure by using jq.MAX_MCP_OUTPUT_TOKENS * 4 character limit without being written to disk:.txt files).CODEBUDDY_DISABLE_MCP_LARGE_OUTPUT_FILES=1.[OUTPUT TRUNCATED - exceeded N token limit] marker is appended to the end of the content, and the model is informed of which types of blocks were dropped (for example, [Dropped 2 audio blocks due to size limit]), so that the model can retry with pagination or filtering parameters.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback