Skip to content

Commit

Permalink
Merge pull request #1 from wesen/task/rename-go-go-mcp
Browse files Browse the repository at this point in the history
Merge client and server into single binary
  • Loading branch information
wesen authored Feb 10, 2025
2 parents 17d8b50 + 4418fa5 commit e89d745
Show file tree
Hide file tree
Showing 59 changed files with 263 additions and 11,273 deletions.
14 changes: 7 additions & 7 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 2
project_name: XXX
project_name: go-go-mcp

before:
hooks:
Expand All @@ -10,8 +10,8 @@ before:
builds:
- env:
- CGO_ENABLED=0
main: ./cmd/XXX
binary: XXX
main: ./cmd/go-go-mcp
binary: go-go-mcp
goos:
- linux
# I am not able to test windows at the time
Expand All @@ -34,9 +34,9 @@ signs:
args: [ "--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}" ]

brews:
- name: XXX
description: "XXX is a tool"
homepage: "https://github.com/go-go-golems/XXX"
- name: go-go-mcp
description: "go-go-mcp is a tool to serve and run MCPs"
homepage: "https://github.com/go-go-golems/go-go-mcp"
repository:
owner: go-go-golems
name: homebrew-go-go-go
Expand All @@ -51,7 +51,7 @@ nfpms:
maintainer: Manuel Odendahl <wesen@ruinwesen.com>

description: |-
XXX is a tool
go-go-mcp is a tool to serve and run MCPs
license: MIT

Expand Down
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/mcp-server",
"args": ["start", "--transport", "sse", "--repositories", "examples/html-extract", "--log-level", "debug"],
"program": "${workspaceFolder}/cmd/go-go-mcp",
"args": ["start", "--transport", "sse", "--repositories", "examples/prompto", "--log-level", "debug", "--port", "3000"],
"cwd": "${workspaceFolder}"
},
{
Expand Down Expand Up @@ -65,7 +65,7 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/mcp-server",
"program": "${workspaceFolder}/cmd/go-go-mcp",
"args": ["run-command", "examples/html-extract/fetch-html.yaml", "--urls", "https://news.ycombinator.com/"],
"cwd": "${workspaceFolder}"
},
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

all: gifs

VERSION=v0.1.14
VERSION ?= $(shell svu)
COMMIT ?= $(shell git rev-parse --short HEAD)
DIRTY ?= $(shell git diff --quiet || echo "dirty")
LDFLAGS=-ldflags "-X main.version=$(VERSION)-$(COMMIT)-$(DIRTY)"

TAPES=$(shell ls doc/vhs/*tape)
gifs: $(TAPES)
Expand All @@ -11,6 +14,9 @@ gifs: $(TAPES)
docker-lint:
docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run -v

ghcr-login:
op read "$(CR_PAT)" | docker login ghcr.io -u wesen --password-stdin

lint:
golangci-lint run -v

Expand All @@ -35,14 +41,15 @@ tag-patch:

release:
git push --tags
GOPROXY=proxy.golang.org go list -m github.com/go-go-golems/XXX@$(shell svu current)
GOPROXY=proxy.golang.org go list -m github.com/go-go-golems/go-go-mcp/cmd/go-go-mcp@$(shell svu current)

bump-glazed:
go get github.com/go-go-golems/glazed@latest
go get github.com/go-go-golems/clay@latest
go get github.com/go-go-golems/geppetto@latest
go mod tidy

XXX_BINARY=$(shell which XXX)
go-go-mcp_BINARY=$(shell which go-go-mcp)
install:
go build -o ./dist/XXX ./cmd/XXX && \
cp ./dist/XXX $(XXX_BINARY)
go build -o ./dist/go-go-mcp ./cmd/go-go-mcp && \
cp ./dist/go-go-mcp $(go-go-mcp_BINARY)
61 changes: 35 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,50 +134,58 @@ The server implements the MCP specification methods:

## Running

### Building the Client and Server
### Building the Binary

First, build both the client and server:
Build the binary which includes both server and client functionality:

```bash
# Build the client
go build -o mcp-client ./cmd/mcp-client/main.go

# Build the server
go build -o mcp-server ./cmd/mcp-server/main.go
go build -o go-go-mcp ./cmd/mcp-server/main.go
```

### Basic Usage

The client supports two transport types:
- `command` (default): Launch and communicate with an MCP server process
- `sse`: Server-Sent Events over HTTP for web applications
The binary can be run in two modes:
- Server mode (default): Run as an MCP server process
- Client mode: Use client commands to interact with an MCP server

#### Server Mode

Start the server with either stdio or SSE transport:

```bash
# Start with stdio transport (default)
./go-go-mcp start --transport stdio

# Start with SSE transport
./go-go-mcp start --transport sse --port 3001
```

#### Using Command Transport (Default)
#### Client Mode

The command transport is the default way to interact with an MCP server:
Use the client subcommand to interact with an MCP server:

```bash
# List available prompts (uses default command: mcp-server start --transport stdio)
./mcp-client --command ./mcp-server prompts list
# List available prompts (uses default server: go-go-mcp start --transport stdio)
./go-go-mcp client prompts list

# List available tools
./mcp-client --command ./mcp-server tools list
./go-go-mcp client tools list

# Execute a prompt with arguments
./mcp-client --command ./mcp-server prompts execute hello --args '{"name":"World"}'
./go-go-mcp client prompts execute hello --args '{"name":"World"}'

# Call a tool with arguments
./mcp-client tools call echo --args '{"message":"Hello, MCP!"}'
./go-go-mcp client tools call echo --args '{"message":"Hello, MCP!"}'
```

You can customize the server command and arguments if needed:

```bash
# Use a different server binary with custom arguments
./mcp-client --command custom-server,start,--debug,--port,8001 prompts list
./go-go-mcp client --command custom-server,start,--debug,--port,8001 prompts list

# Use a server with a specific configuration
./mcp-client -c mcp-server,start,--config,config.yaml prompts list
./go-go-mcp client -c go-go-mcp,start,--config,config.yaml prompts list
```

#### Using SSE Transport
Expand All @@ -186,26 +194,26 @@ For web-based applications, use the SSE transport:

```bash
# Start the server with SSE transport
./mcp-server start --transport sse --port 3001
./go-go-mcp start --transport sse --port 3001

# In another terminal, connect using the client
./mcp-client --transport sse --server http://localhost:3001 prompts list
./go-go-mcp client --transport sse --server http://localhost:3001 prompts list
```

### Debug Mode

Add the `--debug` flag to enable detailed logging:

```bash
./mcp-client --debug prompts list
./go-go-mcp client --debug prompts list
```

### Version Information

Check the version of the client:
Check the version:

```bash
./mcp-client version
./go-go-mcp version
```

### Project Structure
Expand All @@ -218,8 +226,9 @@ Check the version of the client:
- `server/` - Server implementation
- `doc/` - Documentation
- `cmd/`
- `mcp-client/` - MCP client implementation
- `mcp-server/` - MCP server implementation
- `mcp-server/` - MCP server and client implementation
- `cmds/` - Command implementations
- `client/` - Client subcommands

### Dependencies

Expand Down
92 changes: 88 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Added GitHub Pull Request Listing Command

Added a new command to list pull requests from GitHub repositories:
- Created list-github-pull-requests command with support for filtering by state, assignee, author, labels, and base branch
- Added draft PR filtering support
- Included comprehensive JSON output options for PR-specific fields

# Added Shell Tool Provider Debug Flags

Added command line flags to control ShellToolProvider debugging and tracing:
Expand Down Expand Up @@ -403,10 +410,10 @@ Refactored the start and schema commands to use the Glazed command framework for

# Extract start and schema commands to separate files

Moved start and schema commands to their own files in cmd/mcp-server/cmds for better code organization and maintainability.
Moved start and schema commands to their own files in cmd/go-go-mcp/cmds for better code organization and maintainability.

- Created cmd/mcp-server/cmds/start.go for start command
- Created cmd/mcp-server/cmds/schema.go for schema command
- Created cmd/go-go-mcp/cmds/start.go for start command
- Created cmd/go-go-mcp/cmds/schema.go for schema command
- Updated main.go to use the extracted commands
- Improved code organization and readability

Expand Down Expand Up @@ -711,4 +718,81 @@ HTML Selector Template Control
Added ability to disable template rendering in the HTML selector tool.

- Added --no-template flag to disable template rendering
- Template rendering can now be explicitly disabled even when config file or extract options are used
- Template rendering can now be explicitly disabled even when config file or extract options are used

## PubMed Search Command

Added a new shell command for searching PubMed and extracting structured data from search results.

- Added `examples/html-extract/pubmed.yaml` with search term and config file parameters
- Support for configurable maximum pages to scrape

## Prompto Shell Commands

Added shell command wrappers for prompto CLI:
- `prompto-list.yaml`: Lists all prompto entries
- `prompto-get.yaml`: Retrieves a specific prompto entry

## RAG Shell Commands

Added shell command wrappers for mento-service RAG operations:
- `rag-recent-documents.yaml`: Lists recent documents in the RAG system
- `rag-search.yaml`: Searches documents in the RAG system with a query

## Coaching Conversation Tools

Added shell command wrappers for accessing coaching conversation history:
- `recent-coaching-conversations.yaml`: Lists recent coaching conversations with detailed metadata
- `search-coaching-conversations.yaml`: Performs semantic search through coaching conversation history

These tools are specifically designed for LLMs to use in the context of coaching discussions.

## Google Calendar Integration

Added a new shell command for retrieving Google Calendar agenda using gcalcli with configurable date ranges.

- Added `examples/google/get-calendar.yaml` with support for custom start and end dates
- Added `examples/google/add-calendar-event.yaml` with comprehensive event creation options
- Added `examples/google/search-calendar.yaml` with extensive search and display options

## GitHub Issue Management

Added shell command for listing GitHub issues with comprehensive filtering options:
- Added `examples/github/list-issues.yaml` with support for filtering by state, assignee, author, labels, etc.
- Added JSON output formatting and web browser viewing options

# Fix string joining in GitHub issues list command
Fixed the join syntax in the GitHub issues list command template to use proper Go template string joining.

- Fixed join syntax in list-github-issues.yaml to use printf with join function

## Merge MCP Client into Server

Merged the MCP client functionality into the server as a subcommand for better code organization and maintainability.

- Moved client commands to `cmd/mcp-server/cmds/client/`
- Added client subcommand to server binary
- Updated package names and imports

## Update README for Merged Client/Server

Updated the README.md to reflect the new unified client/server architecture:
- Updated build instructions to show single binary build
- Added documentation for server and client modes
- Updated all command examples to use client subcommand
- Updated project structure to show new organization

## Rename Binary to go-go-mcp

Renamed the binary from mcp-server to go-go-mcp for consistency:
- Updated build instructions to use go-go-mcp as binary name
- Updated all command examples to use new binary name
- Updated configuration examples

## Update README for Merged Client/Server

Updated the README.md to reflect the new unified client/server architecture:
- Updated build instructions to show single binary build
- Added documentation for server and client modes
- Updated all command examples to use client subcommand
- Updated project structure to show new organization
File renamed without changes.
22 changes: 22 additions & 0 deletions cmd/go-go-mcp/cmds/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmds

import (
"github.com/go-go-golems/glazed/pkg/help"
"github.com/go-go-golems/go-go-mcp/cmd/go-go-mcp/cmds/client"
"github.com/spf13/cobra"
)

var ClientCmd = &cobra.Command{
Use: "client",
Short: "MCP client functionality",
Long: `Client commands for interacting with MCP servers`,
}

func InitClientCommand(helpSystem *help.HelpSystem) error {
// Add client subcommands
ClientCmd.AddCommand(client.ToolsCmd)
ClientCmd.AddCommand(client.ResourcesCmd)
ClientCmd.AddCommand(client.PromptsCmd)

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

glazed_layers "github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/go-go-mcp/cmd/mcp-client/cmds/layers"
"github.com/go-go-golems/go-go-mcp/cmd/go-go-mcp/cmds/client/layers"
"github.com/go-go-golems/go-go-mcp/pkg/client"
"github.com/go-go-golems/go-go-mcp/pkg/protocol"
"github.com/rs/zerolog/log"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmds
package client

import (
"context"
Expand All @@ -9,21 +9,17 @@ import (
"github.com/go-go-golems/glazed/pkg/cli"
"github.com/go-go-golems/glazed/pkg/cmds"
glazed_layers "github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/go-go-mcp/cmd/mcp-client/cmds/layers"
"github.com/go-go-golems/go-go-mcp/cmd/go-go-mcp/cmds/client/layers"

"github.com/go-go-golems/glazed/pkg/cmds/parameters"
"github.com/go-go-golems/glazed/pkg/middlewares"
"github.com/go-go-golems/glazed/pkg/settings"
"github.com/go-go-golems/glazed/pkg/types"
"github.com/go-go-golems/go-go-mcp/cmd/mcp-client/cmds/helpers"
"github.com/go-go-golems/go-go-mcp/cmd/go-go-mcp/cmds/client/helpers"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)

var (
promptArgs string
)

// PromptsCmd handles the "prompts" command group
var PromptsCmd = &cobra.Command{
Use: "prompts",
Expand Down
Loading

0 comments on commit e89d745

Please sign in to comment.