Skip to content

Scaffold documentation site #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 24, 2025
Merged
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
30 changes: 30 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and Deploy to GitHub Pages

on:
push:
branches: [ main ] # or your default branch
workflow_dispatch: # Allows manual triggering

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest # or specify a version like '1.0.0'

- name: Install Dependencies
run: bun install

- name: Build
run: bun run build

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: www/docs/dist # Your build output directory
branch: gh-pages # The branch the action should deploy to
2 changes: 2 additions & 0 deletions www/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
docs/dist
1 change: 1 addition & 0 deletions www/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a [Vocs](https://vocs.dev) project bootstrapped with the Vocs CLI.
1,166 changes: 1,166 additions & 0 deletions www/bun.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions www/docs/pages/example.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example

This is an example page.
138 changes: 138 additions & 0 deletions www/docs/pages/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Getting Started

MCP-Go makes it easy to build Model Context Protocol (MCP) servers in Go. This guide will help you create your first MCP server in just a few minutes.

## Installation

Add MCP-Go to your Go project:

```bash
go get github.com/mark3labs/mcp-go
```

## Your First MCP Server

Let's create a simple MCP server with a "hello world" tool:

```go
package main

import (
"context"
"errors"
"fmt"

"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
)

func main() {
// Create a new MCP server
s := server.NewMCPServer(
"Demo 🚀",
"1.0.0",
server.WithToolCapabilities(false),
)

// Add tool
tool := mcp.NewTool("hello_world",
mcp.WithDescription("Say hello to someone"),
mcp.WithString("name",
mcp.Required(),
mcp.Description("Name of the person to greet"),
),
)

// Add tool handler
s.AddTool(tool, helloHandler)

// Start the stdio server
if err := server.ServeStdio(s); err != nil {
fmt.Printf("Server error: %v\n", err)
}
}

func helloHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
name, ok := request.Params.Arguments["name"].(string)
if !ok {
return nil, errors.New("name must be a string")
}

return mcp.NewToolResultText(fmt.Sprintf("Hello, %s!", name)), nil
}
```

## Running Your Server

1. Save the code above to a file (e.g., `main.go`)
2. Run it with:
```bash
go run main.go
```

Your MCP server is now running and ready to accept connections via stdio!

## What's Next?

Now that you have a basic server running, you can:

- **Add more tools** - Create tools for calculations, file operations, API calls, etc.
- **Add resources** - Expose data sources like files, databases, or APIs
- **Add prompts** - Create reusable prompt templates for better LLM interactions
- **Explore examples** - Check out the `examples/` directory for more complex use cases

## Key Concepts

### Tools
Tools let LLMs take actions through your server. They're like functions that the LLM can call:

```go
calculatorTool := mcp.NewTool("calculate",
mcp.WithDescription("Perform basic arithmetic operations"),
mcp.WithString("operation",
mcp.Required(),
mcp.Enum("add", "subtract", "multiply", "divide"),
),
mcp.WithNumber("x", mcp.Required()),
mcp.WithNumber("y", mcp.Required()),
)
```

### Resources
Resources expose data to LLMs. They can be static files or dynamic data:

```go
resource := mcp.NewResource(
"docs://readme",
"Project README",
mcp.WithResourceDescription("The project's README file"),
mcp.WithMIMEType("text/markdown"),
)
```

### Server Options
Customize your server with various options:

```go
s := server.NewMCPServer(
"My Server",
"1.0.0",
server.WithToolCapabilities(true),
server.WithRecovery(),
server.WithHooks(myHooks),
)
```

## Transport Options

MCP-Go supports multiple transport methods:

- **Stdio** (most common): `server.ServeStdio(s)`
- **HTTP**: `server.ServeHTTP(s, ":8080")`
- **Server-Sent Events**: `server.ServeSSE(s, ":8080")`

## Need Help?

- Check out the [examples](https://github.com/mark3labs/mcp-go/tree/main/examples) for more complex use cases
- Join the discussion on [Discord](https://discord.gg/RqSS2NQVsY)
- Read the full documentation in the [README](https://github.com/mark3labs/mcp-go/blob/main/README.md)
17 changes: 17 additions & 0 deletions www/docs/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: landing
---

import { HomePage } from 'vocs/components'

<HomePage.Root>
<HomePage.Logo />
<HomePage.Tagline>MCP-Go</HomePage.Tagline>
<HomePage.Description>
A Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools. Build powerful MCP servers with minimal boilerplate and focus on creating great tools.
</HomePage.Description>
<HomePage.Buttons>
<HomePage.Button href="/getting-started" variant="accent">Get started</HomePage.Button>
<HomePage.Button href="https://github.com/mark3labs/mcp-go">GitHub</HomePage.Button>
</HomePage.Buttons>
</HomePage.Root>
Binary file added www/docs/public/logo.png

Unable to render rich display

Invalid image source.

20 changes: 20 additions & 0 deletions www/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "mcp-go",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vocs dev",
"build": "vocs build",
"preview": "vocs preview"
},
"dependencies": {
"react": "latest",
"react-dom": "latest",
"vocs": "latest"
},
"devDependencies": {
"@types/react": "latest",
"typescript": "latest"
}
}
24 changes: 24 additions & 0 deletions www/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["**/*.ts", "**/*.tsx"]
}
23 changes: 23 additions & 0 deletions www/vocs.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from 'vocs'

export default defineConfig({
title: 'MCP-Go',
logoUrl: '/logo.png',
description: 'A Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.',
sidebar: [
{
text: 'Getting Started',
link: '/getting-started',
},
{
text: 'Example',
link: '/example',
},
],
socials: [
{
icon: 'github',
link: 'https://github.com/mark3labs/mcp-go',
},
],
})