Skip to content

Getting Started

Z-M-Huang edited this page Mar 19, 2026 · 3 revisions

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.

Prerequisites

  • Node.js 18+
  • npm

Step 1: Install git-doc-mcp

npm install -g git-doc-mcp

Or run directly with npx:

npx git-doc-mcp --manifest ./manifest.yml

Step 2: Create a Manifest

Create 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: false

Note: The action URL must point to where your action script is hosted. For development, you can host files on GitHub using raw URLs. The actionHash is the SHA256 hash of the action file and must match exactly.

Step 3: Write an Action Script

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 your inputSchema
  • ctx — execution context with fetch, getSecret, log, and manifest

Step 4: Compute the Action Hash

shasum -a 256 hello.v1.js
# Output: abc123def456... hello.v1.js

Update your manifest's actionHash field:

actionHash: "sha256:abc123def456..."

Step 5: Host Your Files

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.

Local Development Alternative

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.

Step 6: Run the Server

# 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.yml

The server starts on stdio and is ready to accept MCP connections.

Step 7: Connect to Claude Desktop

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"
      ]
    }
  }
}

What's Next?

Clone this wiki locally