-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Create your first MCP server in 5 minutes. This guide walks through creating a manifest, writing an action script, and running the server locally.
- Node.js 18+
- npm
npm install -g git-doc-mcpOr run directly with npx:
npx git-doc-mcp --manifest ./manifest.ymlCreate manifest.yml in your project:
schemaVersion: "1.0"
name: my-first-mcp
version: 1.0.0
description: My first MCP server
tools:
- name: hello
title: Say Hello
description: Returns a greeting for the given name
inputSchema:
type: object
properties:
name:
type: string
description: Name to greet
required: [name]
action: https://example.com/actions/hello.v1.js
actionHash: "sha256:abc123..."
annotations:
readOnlyHint: true
destructiveHint: false
idempotentHint: true
openWorldHint: falseNote: The
actionURL must point to where your action script is hosted. For development, you can host files on GitHub using raw URLs. TheactionHashis the SHA256 hash of the action file and must match exactly.
Create hello.v1.js:
export default async function hello(input, ctx) {
const { name } = input;
ctx.log('info', `Greeting ${name}`);
return {
content: [{
type: 'text',
text: `Hello, ${name}! Welcome to git-doc-mcp.`,
}],
};
}Action scripts are ES modules that export a default async function. They receive:
-
input— validated tool input matching yourinputSchema -
ctx— execution context withfetch,getSecret,log, andmanifest
shasum -a 256 hello.v1.js
# Output: abc123def456... hello.v1.jsUpdate your manifest's actionHash field:
actionHash: "sha256:abc123def456..."Push your action script to a publicly accessible URL. For GitHub repos:
https://raw.githubusercontent.com/{owner}/{repo}/{branch}/actions/hello.v1.js
Update the action field in your manifest to match.
Instead of hosting your action script remotely, you can point action at a local file path during development:
action: ./hello.v1.js
actionHash: "sha256:abc123def456..."Relative paths are resolved against the manifest file's directory. The actionHash is still required. Local actions are re-read from disk on each tool call, so you can edit the script and see changes immediately without restarting the server.
Note: Local file paths only work when the manifest itself is a local file. Remote manifests with local action paths are rejected.
# From a local manifest file
git-doc-mcp --manifest ./manifest.yml
# From a remote manifest URL
git-doc-mcp --manifest https://raw.githubusercontent.com/you/repo/main/manifest.ymlThe server starts on stdio and is ready to accept MCP connections.
Add to your Claude Desktop config (~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"my-first-mcp": {
"command": "npx",
"args": [
"git-doc-mcp",
"--manifest",
"https://raw.githubusercontent.com/you/repo/main/manifest.yml"
]
}
}
}Or for Claude Code, add to .mcp.json:
{
"mcpServers": {
"my-first-mcp": {
"command": "npx",
"args": [
"git-doc-mcp",
"--manifest",
"https://raw.githubusercontent.com/you/repo/main/manifest.yml"
]
}
}
}- Manifest Reference — Full schema documentation
-
Writing Actions — Learn the
ctxAPI - Defining Tools — Input schemas and annotations
- Examples — Complete working examples
- Managing Secrets — Add API key support