Initial Go MCP server implementation

This commit is contained in:
Ian Gulliver
2025-06-27 20:03:53 -07:00
commit aec727e006
3 changed files with 177 additions and 0 deletions

32
CONTEXT.md Normal file
View File

@@ -0,0 +1,32 @@
# Context - gocp Project
## CRITICAL INSTRUCTIONS - MUST FOLLOW
1. **Simple commits**: One-line commit messages ONLY. NEVER add "Generated by Claude" footers, emojis, or any multi-line messages. Just describe what changed in one line.
2. **Minimal comments**: Only add comments when absolutely critical for disambiguation
3. **Never use `go build`**: Always use `go run` instead of `go build` for testing Go programs
4. **Never change directories**: Never change directories with `cd` - always use absolute paths instead
5. **Error handling**: Always propagate errors with proper messages, never silently handle errors
## Project Overview
gocp is a Go MCP (Model Context Protocol) server that provides tools for building and executing Go code. It uses the go-mcp library to implement the MCP protocol.
## Key Files
- `main.go`: MCP server implementation with build_and_run_go tool
- `go.mod`: Module definition with go-mcp dependency
## Tool Details
- **build_and_run_go**: Executes Go code using `go run`
- Parameters:
- `code` (required): Go source code to execute
- `timeout` (optional): Timeout in seconds (default: 30)
- Returns JSON with:
- `stdout`: Standard output
- `stderr`: Standard error
- `exit_code`: Process exit code
- `error`: Error message if any
- Creates temporary directories with `gocp-*` prefix