mcpField
M
Mcp Server Template

Mcp Server Template

Local
github.com/seepineDeveloper Tools0Updated 17w ago

About Mcp Server Template

Mcp Server Template is a TypeScript starter for creating MCP servers. It supports stdio, SSE, and streamable HTTP, with configuration access suited to local development and deployment.

Key features

  1. 01stdio, SSE, and streamable HTTP
  2. 02Access environment variables in stdio mode
  3. 03Read request headers in HTTP modes
  4. 04Docker deployment support

Use cases

  1. 01Create a server project for an MCP integration
  2. 02Pass credentials through environment variables or headers
  3. 03Test an SSE server with MCP Inspector

MCP support

It provides a template for building MCP servers using stdio, SSE, or streamable HTTP transports.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"template-seepine": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"build"
]
}
}
}
Run commanddocker run -i --rm build

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
ocibuild

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Mcp Server Template

开发

1. 安装
pnpm install
2. 启动
pnpm dev
3. 调试

在弹出的 MCP Inspector 跳时网页,选择 SSE 模式并连接,SSE 支持自动重连,更好支持本地开发调试,当然你也可以选择其他模式

4. 参数传递
  • stdio 模式,可以用 process.env 获取 mcp 配置的 env 变量
  • sse/streamable-http 模式,可以用封装的 ctx.get() 获取 mcp 配置的请求头,方便鉴权等

部署 Stdio

1. 打包
pnpm build
2. 发布到 npm
pnpm publish
3. MCP 配置
{
  "mcpServers": {
    "mcp-server-template": {
      "type": "stdio",
      "command": "npx",
      "args": ["mcp-server-template"],
      "env": {
        "API_KEY": "sk-123"
      }
    }
  }
}

部署 docker

1. Build
docker build -t mcp-server-template .
2. Run the server
docker run -p 3000:3000 mcp-server-template
# 或启动 sse
docker run -p 4000:4000 mcp-server-template node sse.js
3. MCP 配置
{
  "mcpServers": {
    "mcp-server-template": {
      "type": "streamableHttp",
      "url": "http://localhost:3000/mcp",
      "headers": {
        "api-key": "sk-123"
      }
    },
    // 或 sse
    "mcp-server-template": {
      "type": "sse",
      "url": "http://localhost:4000/mcp",
      "headers": {
        "api-key": "sk-123"
      }
    }
  }
}

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.