Skip to content

Commit 563a9c7

Browse files
authored
Scaffold documentation site (#324)
* Scaffold documentation site * Remove node_modules * rename * add getting-started * add gh-pages workflow
1 parent 820b7a6 commit 563a9c7

File tree

11 files changed

+1424
-0
lines changed

11 files changed

+1424
-0
lines changed

.github/workflows/pages.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ] # or your default branch
6+
workflow_dispatch: # Allows manual triggering
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v3
14+
15+
- name: Setup Bun
16+
uses: oven-sh/setup-bun@v1
17+
with:
18+
bun-version: latest # or specify a version like '1.0.0'
19+
20+
- name: Install Dependencies
21+
run: bun install
22+
23+
- name: Build
24+
run: bun run build
25+
26+
- name: Deploy to GitHub Pages
27+
uses: JamesIves/github-pages-deploy-action@v4
28+
with:
29+
folder: www/docs/dist # Your build output directory
30+
branch: gh-pages # The branch the action should deploy to

www/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
docs/dist

www/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a [Vocs](https://vocs.dev) project bootstrapped with the Vocs CLI.

www/bun.lock

Lines changed: 1166 additions & 0 deletions
Large diffs are not rendered by default.

www/docs/pages/example.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Example
2+
3+
This is an example page.

www/docs/pages/getting-started.mdx

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Getting Started
2+
3+
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.
4+
5+
## Installation
6+
7+
Add MCP-Go to your Go project:
8+
9+
```bash
10+
go get github.com/mark3labs/mcp-go
11+
```
12+
13+
## Your First MCP Server
14+
15+
Let's create a simple MCP server with a "hello world" tool:
16+
17+
```go
18+
package main
19+
20+
import (
21+
"context"
22+
"errors"
23+
"fmt"
24+
25+
"github.com/mark3labs/mcp-go/mcp"
26+
"github.com/mark3labs/mcp-go/server"
27+
)
28+
29+
func main() {
30+
// Create a new MCP server
31+
s := server.NewMCPServer(
32+
"Demo 🚀",
33+
"1.0.0",
34+
server.WithToolCapabilities(false),
35+
)
36+
37+
// Add tool
38+
tool := mcp.NewTool("hello_world",
39+
mcp.WithDescription("Say hello to someone"),
40+
mcp.WithString("name",
41+
mcp.Required(),
42+
mcp.Description("Name of the person to greet"),
43+
),
44+
)
45+
46+
// Add tool handler
47+
s.AddTool(tool, helloHandler)
48+
49+
// Start the stdio server
50+
if err := server.ServeStdio(s); err != nil {
51+
fmt.Printf("Server error: %v\n", err)
52+
}
53+
}
54+
55+
func helloHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
56+
name, ok := request.Params.Arguments["name"].(string)
57+
if !ok {
58+
return nil, errors.New("name must be a string")
59+
}
60+
61+
return mcp.NewToolResultText(fmt.Sprintf("Hello, %s!", name)), nil
62+
}
63+
```
64+
65+
## Running Your Server
66+
67+
1. Save the code above to a file (e.g., `main.go`)
68+
2. Run it with:
69+
```bash
70+
go run main.go
71+
```
72+
73+
Your MCP server is now running and ready to accept connections via stdio!
74+
75+
## What's Next?
76+
77+
Now that you have a basic server running, you can:
78+
79+
- **Add more tools** - Create tools for calculations, file operations, API calls, etc.
80+
- **Add resources** - Expose data sources like files, databases, or APIs
81+
- **Add prompts** - Create reusable prompt templates for better LLM interactions
82+
- **Explore examples** - Check out the `examples/` directory for more complex use cases
83+
84+
## Key Concepts
85+
86+
### Tools
87+
Tools let LLMs take actions through your server. They're like functions that the LLM can call:
88+
89+
```go
90+
calculatorTool := mcp.NewTool("calculate",
91+
mcp.WithDescription("Perform basic arithmetic operations"),
92+
mcp.WithString("operation",
93+
mcp.Required(),
94+
mcp.Enum("add", "subtract", "multiply", "divide"),
95+
),
96+
mcp.WithNumber("x", mcp.Required()),
97+
mcp.WithNumber("y", mcp.Required()),
98+
)
99+
```
100+
101+
### Resources
102+
Resources expose data to LLMs. They can be static files or dynamic data:
103+
104+
```go
105+
resource := mcp.NewResource(
106+
"docs://readme",
107+
"Project README",
108+
mcp.WithResourceDescription("The project's README file"),
109+
mcp.WithMIMEType("text/markdown"),
110+
)
111+
```
112+
113+
### Server Options
114+
Customize your server with various options:
115+
116+
```go
117+
s := server.NewMCPServer(
118+
"My Server",
119+
"1.0.0",
120+
server.WithToolCapabilities(true),
121+
server.WithRecovery(),
122+
server.WithHooks(myHooks),
123+
)
124+
```
125+
126+
## Transport Options
127+
128+
MCP-Go supports multiple transport methods:
129+
130+
- **Stdio** (most common): `server.ServeStdio(s)`
131+
- **HTTP**: `server.ServeHTTP(s, ":8080")`
132+
- **Server-Sent Events**: `server.ServeSSE(s, ":8080")`
133+
134+
## Need Help?
135+
136+
- Check out the [examples](https://github.com/mark3labs/mcp-go/tree/main/examples) for more complex use cases
137+
- Join the discussion on [Discord](https://discord.gg/RqSS2NQVsY)
138+
- Read the full documentation in the [README](https://github.com/mark3labs/mcp-go/blob/main/README.md)

www/docs/pages/index.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: landing
3+
---
4+
5+
import { HomePage } from 'vocs/components'
6+
7+
<HomePage.Root>
8+
<HomePage.Logo />
9+
<HomePage.Tagline>MCP-Go</HomePage.Tagline>
10+
<HomePage.Description>
11+
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.
12+
</HomePage.Description>
13+
<HomePage.Buttons>
14+
<HomePage.Button href="/getting-started" variant="accent">Get started</HomePage.Button>
15+
<HomePage.Button href="https://github.com/mark3labs/mcp-go">GitHub</HomePage.Button>
16+
</HomePage.Buttons>
17+
</HomePage.Root>

www/docs/public/logo.png

42.3 KB
Loading

www/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "mcp-go",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vocs dev",
8+
"build": "vocs build",
9+
"preview": "vocs preview"
10+
},
11+
"dependencies": {
12+
"react": "latest",
13+
"react-dom": "latest",
14+
"vocs": "latest"
15+
},
16+
"devDependencies": {
17+
"@types/react": "latest",
18+
"typescript": "latest"
19+
}
20+
}

www/tsconfig.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
6+
"module": "ESNext",
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"noEmit": true,
15+
"jsx": "react-jsx",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true
22+
},
23+
"include": ["**/*.ts", "**/*.tsx"]
24+
}

0 commit comments

Comments
 (0)