Skip to content
Development
Agent

server-templates

```typescript import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; import { CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from

From plugin
vexjoy-agent
449198 skills198 agents12 commands83 hooks

Claude Code

$ npx -y skills add notque/vexjoy-agent --agent claude-code

Agent definition

server-templates.md

MCP Server Templates Reference

TypeScript/Node.js Core Structure

import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
  CallToolRequestSchema,
  ListResourcesRequestSchema,
  ReadResourceRequestSchema,
} from '@modelcontextprotocol/sdk/types.js';

interface DocMetadata {
  title: string;
  description?: string;
  scope?: string;
  service?: string;
  tags?: string[];
  draft?: boolean;
  lastModified: Date;
}

interface ParsedDoc {
  uri: string;
  metadata: DocMetadata;
  content: string;
  path: string;
}

class DocsServer {
  private server: Server;
  private docsIndex: Map<string, ParsedDoc> = new Map();
  private docsPath: string;

  constructor(docsPath: string) {
    this.docsPath = docsPath;
    this.server = new Server(
      { name: 'local-docs', version: '1.0.0' },
      { capabilities: { resources: {}, tools: {} } }
    );
    this.setupHandlers();
  }

  private setupHandlers(): void {
    // List all documentation resources
    this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
      const resources = Array.from(this.docsIndex.values()).map((doc) => ({
        uri: doc.uri,
        name: doc.metadata.title,
        description: doc.metadata.description,
        mimeType: 'text/markdown',
      }));
      return { resources };
    });

    // Read specific documentation resource
    this.server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
      const doc = this.docsIndex.get(request.params.uri);
      if (!doc) {
        throw new Error(`Resource not found: ${request.params.uri}`);
      }
      return {
        contents: [{
          uri: doc.uri,
          mimeType: 'text/markdown',
          text: doc.content,
        }],
      };
    });

    // Search documentation tool
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      if (request.params.name === 'search_docs') {
        return this.handleSearchDocs(request.params.arguments);
      }
      throw new Error(`Unknown tool: ${request.params.name}`);
    });
  }

  async run(): Promise<void> {
    await this.indexDocs();
    const transport = new StdioServerTransport();
    await this.server.connect(transport);
  }
}

Go Implementation Core Structure

package main

import (
    "bufio"
    "encoding/json"
    "fmt"
    "io/fs"
    "os"
    "path/filepath"
    "strings"
    "sync"

    "gopkg.in/yaml.v3"
)

type DocMetadata struct {
    Title       string   `yaml:"title" json:"title"`
    Description string   `yaml:"description" json:"description,omitempty"`
    Scope       string   `yaml:"scope" json:"scope,omitempty"`
    Service     string   `yaml:"service" json:"service,omitempty"`
    Tags        []string `yaml:"tags" json:"tags,omitempty"`
    Draft       bool     `yaml:"draft" json:"draft,omitempty"`
}

type ParsedDoc struct {
    URI      string      `json:"uri"`
    Metadata DocMetadata `json:"metadata"`
    Content  string      `json:"content"`
    Path     string      `json:"path"`
    ModTime  int64       `json:"modTime"`
}

type DocsServer struct {
    docsPath string
    index    map[string]*ParsedDoc
    mu       sync.RWMutex
}

func (s *DocsServer) IndexDocs() error {
    return filepath.WalkDir(s.docsPath, func(path string, d fs.DirEntry, err error) error {
        if err != nil || d.IsDir() || !strings.HasSuffix(path, ".md") {
            return err
        }

        doc, err := s.parseDoc(path)
        if err != nil {
            fmt.Fprintf(os.Stderr, "Warning: failed to parse %s: %v\n", path, err)
            return nil // Continue indexing
        }

        s.mu.Lock()
        s.index[doc.URI] = doc
        s.mu.Unlock()

        return nil
    })
}

Preferred Patterns

  • **Async I/O**: Cache in memory, serve from cache, index once at startup. See `mcp-patterns.md`.
  • **Custom URI scheme**: `docs://` with relative paths. Never expose filesystem paths. See `mcp-patterns.md`.
  • **Front matter error handling**: Try-catch, partial results, continue indexing.
function parseFrontMatter(content: string): DocMetadata {
  try {
    const parts = content.split('---');
    if (parts.length < 3) return { title: 'Untitled', lastModified: new Date() };
    return { ...yaml.parse(parts[1]), lastModified: new Date() };
  } catch (e) {
    console.error(`Front matter parse error: ${e}`);
    return { title: 'Untitled', lastModified: new Date() };
  }
}
Read more
@notque
Ships withvexjoy-agent

Essays and writing behind this toolkit live at vexjoy.com. VexJoy Agent connects plain-English requests to specialist agents, skills, and workflows. /do selects the knowledge and tools needed for your task.

44964 skills198 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
449
Star history of notque/vexjoy-agent on GitHub, a chart by star-history.com

Other agents on vexjoy-agent.

modules

modules

Agent

**Scope**: Module selection patterns, builtin vs command/shell decisions, collection modules, and version-specific module changes…

@notque@notqueInstall Agent
testing

testing

Agent

**Scope**: Molecule test scenarios, ansible-lint rules, idempotency validation, and check-mode patterns **Version range**:…

@notque@notqueInstall Agent
communication-patterns

communication-patterns

Agent

**Scope**: Failure modes in agent output style — over-reporting, self-congratulation, verbose narration, and hedging. Covers what…

@notque@notqueInstall Agent

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc13d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react2d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex2d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman3d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about server-templates.

Which coding agents can use server-templates?
server-templates installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.