GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - futuretea/mcp-server-template: A template for building Model Context Protocol (MCP) servers

BranchesTags
Open more actions menu

Latest commit

 

History

11 Commits
11 Commits

Folders and files

NameName
Last commit message
Last commit date
cmd/mcp-server
cmd/mcp-server
 
 
internal
internal
 
 
pkg
pkg
 
 
scripts
scripts
 
 
templates
templates
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
.tool-versions
.tool-versions
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
README.zh.md
README.zh.md
 
 
config.example.yaml
config.example.yaml
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 

Repository files navigation

MCP Server Template

中文文档

Cloneable minimal MCP (Model Context Protocol) server skeleton with a dual-mode binary: MCP server for AI assistants and a small CLI for humans. Ships with example tools echo / ping.

Initialize a derived repository

After creating a repository from this template, initialize its explicit placeholders before building:

./scripts/init-template.sh \
  --module github.com/acme/my-mcp \
  --binary my-mcp \
  --npm-package @acme/my-mcp \
  --image ghcr.io/acme/my-mcp

This creates the build workflow. Add --with-release only when the project is ready to publish; it also creates npm and Docker tag-release workflows. Add --use-ghcr with a ghcr.io/... image to publish to GitHub Container Registry using GITHUB_TOKEN, without Docker registry secrets. Other registries continue to require their credentials. Configure the npm registry before enabling a release. Use --dry-run to inspect the planned initialization without changing files.

Quick start

# Requires Go 1.25+ (see .tool-versions)
make build
./bin/mcp-template-binary-placeholder version

# Start MCP server (stdio, default)
./bin/mcp-template-binary-placeholder mcp

# List / call tools from the CLI (no MCP client required)
./bin/mcp-template-binary-placeholder tools list
./bin/mcp-template-binary-placeholder tools call echo --params '{"message":"hello"}'
./bin/mcp-template-binary-placeholder tools call ping --params '{}'

Features

  • Subcommand CLI: mcp starts the server; tools / version / completion are separate commands
  • Multi-transport: stdio, Streamable HTTP, and SSE
  • Tool filtering: --enabled-tools, --disabled-tools, --enable-domains, --disable-domains
  • Engineering defaults: Makefile, Dockerfile, GitHub Actions CI, golangci-lint config, MIT license

CLI commands

Command Purpose
mcp-template-binary-placeholder mcp Start the MCP server (stdio or HTTP)
mcp-template-binary-placeholder tools list List enabled tools
mcp-template-binary-placeholder tools describe <name> Show tool schema
mcp-template-binary-placeholder tools call <name> Invoke a tool with JSON params
mcp-template-binary-placeholder version Print build metadata
mcp-template-binary-placeholder completion <shell> Generate shell completion

Tools examples

./bin/mcp-template-binary-placeholder tools list
./bin/mcp-template-binary-placeholder tools list --json
./bin/mcp-template-binary-placeholder tools describe echo
./bin/mcp-template-binary-placeholder tools describe echo --json
./bin/mcp-template-binary-placeholder tools call echo --params '{"message":"hello"}'
echo '{"message":"hello"}' | ./bin/mcp-template-binary-placeholder tools call echo --params-file -
./bin/mcp-template-binary-placeholder tools call ping --params '{}'

MCP transports

Stdio (default)

./bin/mcp-template-binary-placeholder mcp

Cursor / Claude Desktop style config:

{
  "mcpServers": {
    "mcp-template-binary-placeholder": {
      "command": "/absolute/path/to/bin/mcp-template-binary-placeholder",
      "args": ["mcp"]
    }
  }
}

Streamable HTTP

./bin/mcp-template-binary-placeholder mcp --port 8080
curl -s http://127.0.0.1:8080/healthz

Client config example:

{
  "mcpServers": {
    "mcp-template-binary-placeholder": {
      "url": "http://127.0.0.1:8080/mcp"
    }
  }
}

SSE

Same process as HTTP mode. Endpoints:

Path Purpose
/healthz Health check (GET/HEAD)
/mcp Streamable HTTP
/sse SSE connection
/message SSE message endpoint
./bin/mcp-template-binary-placeholder mcp --port 8080 --sse-base-url http://127.0.0.1:8080

Docker

# Build
make docker

# Stdio (default ENTRYPOINT is `mcp-template-binary-placeholder mcp`)
docker run -i --rm mcp-template-image-placeholder:dev

# HTTP
docker run --rm -p 8080:8080 mcp-template-image-placeholder:dev --port 8080 --listen 0.0.0.0

HTTP / SSE have no auth and no TLS. Default --listen 127.0.0.1. Use only on trusted networks; put a reverse proxy in front if you expose the port.

Configuration

Priority: flags > environment variables > config file > defaults.

Environment variables

Variable Description Default
MCP_LOG_LEVEL Log level info
MCP_PORT HTTP port (0 = stdio) 0
MCP_LISTEN HTTP listen host 127.0.0.1
MCP_SSE_BASE_URL Public SSE base URL ""

Config file

See config.example.yaml:

port: 0
listen: 127.0.0.1
sse_base_url: ""
log_level: info
enabled_tools: []
disabled_tools: []
enabled_domains: []
disabled_domains: []
./bin/mcp-template-binary-placeholder mcp --config config.example.yaml --port 8080

Project layout

cmd/mcp-server/          # binary entrypoint
internal/cmd/             # cobra CLI (mcp / tools / version / completion)
pkg/core/                 # config / logging / version
pkg/server/mcp/           # MCP registration and transports
pkg/server/http/          # HTTP / SSE / healthz
pkg/toolset/              # Toolset interface and filters
pkg/toolset/example/      # sample tools (replace with your domain)
.github/workflows/        # CI
scripts/init-template.sh  # derived-project initializer
templates/                # CI and release scaffolding copied by the initializer

Extend with your own tools

  1. Add pkg/toolset/<your-domain>/ implementing toolset.Toolset.
  2. Register it in internal/cmd/root.go via defaultToolsets().
  3. Control exposure with --enabled-tools / --enable-domains.

Development

make tidy
make format
make lint
make test
make coverage
make ci
make build
make docker

Generated build CI (.github/workflows/build.yaml) runs lint, tests, a multi-OS build with CLI smoke checks, and a Docker image build.

Local reference clones

third-party-projects/ can hold local reference checkouts. It is listed in .gitignore and is not part of the template deliverable.

License

MIT

About

A template for building Model Context Protocol (MCP) servers

Topics

boilerplatemcpmcp-servermodel-context-protocoltemplate

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.