Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing to MCPTools

Thank you for considering contributing to MCPTools! This document provides guidelines and instructions for contributing to the project.

## Getting Started

1. Fork the repository
2. Clone your fork: `git clone https://github.com/YOUR-USERNAME/mcptools.git`
3. Create a new branch: `git checkout -b feature/your-feature-name`

## Development Setup

1. No need to pre-install Go - the setup process will automatically install it if needed
2. Run `make setup` to set up the development environment (this will check/install Go and set up everything else)
3. Make your changes
4. Run tests using `make test`
5. Run the linter using `make lint`

## Pull Request Process

1. Update the README.md with details of changes if needed
2. Follow the existing code style and formatting
3. Add tests for new features
4. Ensure all tests pass and the linter shows no errors
5. Update documentation as needed

## Commit Messages

- Use clear and meaningful commit messages
- Start with a verb in present tense (e.g., "Add feature" not "Added feature")
- Reference issue numbers if applicable

## Code Style

- Follow Go best practices and idioms
- Use meaningful variable and function names
- Add comments for complex logic
- Keep functions focused and small

## Questions or Problems?

Feel free to open an issue for any questions or problems you encounter.

## License

By contributing, you agree that your contributions will be licensed under the same terms as the main project.
39 changes: 34 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,57 @@
# Color definitions
BLUE=\033[0;34m
GREEN=\033[0;32m
YELLOW=\033[0;33m
RED=\033[0;31m
NC=\033[0m # No Color

BINARY_NAME=mcp
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_TIME=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME)"

.PHONY: build clean install test
# Default Makefile step
default: setup
@echo "$(GREEN)All setup steps completed successfully!$(NC)"

# Setup for Cocoapods
setup: \
check-go \
build \
clean \
install \
test
@echo "$(GREEN)Setup process completed$(NC)"

check-go:
@echo "$(BLUE)Checking Go installation and version...$(NC)"
chmod +x ./scripts/check_go.sh
./scripts/check_go.sh

build:
@echo "$(YELLOW)Building $(BINARY_NAME)...$(NC)"
go build $(LDFLAGS) -o bin/$(BINARY_NAME) ./cmd/mcptools

build-all: clean
@echo "$(YELLOW)Building all platform binaries...$(NC)"
GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)_darwin_amd64 ./cmd/mcptools
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)_darwin_arm64 ./cmd/mcptools
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)_linux_amd64 ./cmd/mcptools
GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)_linux_arm64 ./cmd/mcptools
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)_windows_amd64.exe ./cmd/mcptools

install:
@echo "$(BLUE)Installing $(BINARY_NAME)...$(NC)"
go install $(LDFLAGS) ./cmd/mcptools

clean:
rm -rf bin/
@echo "$(RED)Cleaning build artifacts...$(NC)"


test:
test: check-go
@echo "$(YELLOW)Running tests...$(NC)"
go test -v ./...

lint:
golangci-lint run ./...
lint: check_go
@echo "$(BLUE)Running linter...$(NC)"
golangci-lint run ./...
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ This will open a shell as following:

![MCP Tools Screenshot](.github/resources/screenshot.png)

## Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on how to submit pull requests, report issues, and contribute to the project.

## Installation

### Using Homebrew
Expand Down
60 changes: 60 additions & 0 deletions scripts/check_go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

check_go() {
if ! command -v go &> /dev/null; then
printf "Go is not installed on your system.\n"
read -p "Would you like to install Go now? (y/n): " choice

case "$choice" in
y|Y)
printf "Installing Go...\n"

# Detect OS
case "$(uname -s)" in
Darwin)
if command -v brew &> /dev/null; then
brew install go
else
printf "Homebrew not found. Please install Go manually from https://golang.org/dl/\n"
exit 1
fi
;;
Linux)
if command -v apt-get &> /dev/null; then
sudo apt-get update && sudo apt-get install -y golang-go
elif command -v yum &> /dev/null; then
sudo yum install -y golang
else
printf "Package manager not found. Please install Go manually from https://golang.org/dl/\n"
exit 1
fi
;;
MINGW*|MSYS*|CYGWIN*)
printf "On Windows, please install Go manually from https://golang.org/dl/\n"
exit 1
;;
*)
printf "Unsupported operating system. Please install Go manually from https://golang.org/dl/\n"
exit 1
;;
esac

# Verify installation
if ! command -v go &> /dev/null; then
printf "Go installation failed.\n"
exit 1
fi
printf "Go has been installed successfully!\n"
;;
*)
printf "Go installation skipped. Please install Go before building.\n"
exit 1
;;
esac
else
printf "Go is already installed. Version: %s\n" "$(go version)"
return 0
fi
}

check_go