Skip to content

Commit

Permalink
📚 Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wesen committed Feb 11, 2025
1 parent d28d82e commit 32e4b7d
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 11 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,39 @@ go-go-mcp can be configured using YAML configuration files that allow you to:
- Control access through blacklists/whitelists
- Manage security through parameter filtering

### Command-Line Configuration Management

The `config` command group provides tools to manage your configuration:

```bash
# Create a new configuration file
go-go-mcp config init

# Edit configuration in your default editor
go-go-mcp config edit

# List available profiles
go-go-mcp config list-profiles

# Show details of a specific profile
go-go-mcp config show-profile default

# Add a tool directory to a profile
go-go-mcp config add-tool default --dir ./tools/system

# Add a specific tool file to a profile
go-go-mcp config add-tool default --file ./tools/special-tool.yaml

# Create a new profile
go-go-mcp config add-profile production "Production environment configuration"

# Duplicate an existing profile
go-go-mcp config duplicate-profile development staging "Staging environment configuration"

# Set the default profile
go-go-mcp config set-default-profile production
```

For detailed configuration documentation, use:
```bash
# View configuration file documentation
Expand Down
11 changes: 10 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -927,4 +927,13 @@ Added a helper package for managing profiles configuration paths:
- Added GetDefaultProfilesPath to get the default XDG config path
- Added GetProfilesPath to handle both default and custom paths
- Updated all config commands to use the new helpers
- Updated start command to use the new helpers
- Updated start command to use the new helpers

# Update Configuration Documentation with CLI Tools

Updated the configuration documentation to include the command-line configuration management tools:

- Added config command examples to README.md
- Updated configuration file tutorial with CLI tool usage
- Added CLI-based configuration workflow to MCP in Practice guide
- Improved documentation organization and clarity
21 changes: 13 additions & 8 deletions cmd/go-go-mcp/cmds/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,21 @@ func (c *StartCommand) Run(
if s.ConfigFile != "" {
cfg, err := config.LoadFromFile(s.ConfigFile)
if err != nil {
return errors.Wrap(err, "failed to load configuration file")
}
if !os.IsNotExist(err) || len(s.Repositories) == 0 {
fmt.Fprintf(os.Stderr, "Run 'go-go-mcp config init' to create a starting configuration file, and further edit it with 'go-go-mcp config edit'\n")
return errors.Wrap(err, "failed to load configuration file")
}
// Config file doesn't exist but we have repositories, continue
log.Warn().Str("config", s.ConfigFile).Msg("Configuration file not found, continuing with provided repositories")
} else {
// Determine profile
profile := s.Profile
if profile == "" {
profile = cfg.DefaultProfile
}

// Determine profile
profile := s.Profile
if profile == "" {
profile = cfg.DefaultProfile
toolProviderOptions = append(toolProviderOptions, config.WithConfig(cfg, profile))
}

toolProviderOptions = append(toolProviderOptions, config.WithConfig(cfg, profile))
}

// Handle repository directories
Expand Down
39 changes: 38 additions & 1 deletion pkg/doc/topics/01-config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,44 @@ This tutorial will guide you through creating and using configuration files in g

## Basic Configuration

Let's start with a minimal configuration file:
The easiest way to get started is to use the built-in configuration management commands:

```bash
# Create a new configuration file
go-go-mcp config init

# Edit the configuration in your default editor
go-go-mcp config edit
```

This will create a minimal configuration file with a default profile. You can then add more profiles and tools:

```bash
# Add a new profile
go-go-mcp config add-profile development "Development environment with debug tools"

# Add tool directories to the profile
go-go-mcp config add-tool development --dir ./tools/system
go-go-mcp config add-tool development --dir ./tools/data

# Set it as the default profile
go-go-mcp config set-default-profile development

# View your profiles
go-go-mcp config list-profiles

# Show the full configuration of a profile
go-go-mcp config show-profile development
```

You can also create profiles by duplicating existing ones:

```bash
# Create a staging profile based on development
go-go-mcp config duplicate-profile development staging "Staging environment"
```

Alternatively, you can manually create a configuration file with this minimal structure:

```yaml
version: "1"
Expand Down
50 changes: 49 additions & 1 deletion pkg/doc/topics/03-mcp-in-practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,55 @@ Key points:

## Configuring MCP

Now let's create a configuration file that organizes tools by their use cases. Create `config.yaml`:
Let's set up our configuration using the built-in configuration management tools:

1. **Initialize Configuration**
```bash
# Create a new configuration file
go-go-mcp config init
# Edit it in your default editor to review
go-go-mcp config edit
```

2. **Create Profiles for Different Environments**
```bash
# Create development profile
go-go-mcp config add-profile development "Development environment with debug tools"
# Add tool directories
go-go-mcp config add-tool development --dir ./tools/system
go-go-mcp config add-tool development --dir ./tools/data
# Create production profile
go-go-mcp config add-profile production "Production environment with strict controls"
# Add production tools
go-go-mcp config add-tool production --dir /opt/go-go-mcp/tools
# Create staging by duplicating development
go-go-mcp config duplicate-profile development staging "Staging environment"
```

3. **Review Configuration**
```bash
# List all profiles
go-go-mcp config list-profiles
# Show development profile configuration
go-go-mcp config show-profile development
# Show production profile configuration
go-go-mcp config show-profile production
```

4. **Set Default Profile**
```bash
# Set development as default for local work
go-go-mcp config set-default-profile development
```

Now let's create a configuration file that organizes tools by their use cases:

## Working with Configuration Files

Expand Down

0 comments on commit 32e4b7d

Please sign in to comment.