Custom Node & Server Development

Learn how to build your own MCP server, define custom block schemas, and package connectors for reuse.

Building Your Own MCP Server (Python/TypeScript)

  1. Scaffold a new project

    bashCopyEdit# TypeScript
    npx create-contextmesh-server my-server
    # Python
    pip install contextmesh-mcp-server
    mcp-server init my_server
  2. Implement JSON-RPC handlers

    • Define initialize, manifest/load, blocks/execute methods

    • Honor capabilities: resources, tools, prompts

  3. Run & test locally

    bashCopyEditnpm start       # for TS
    python server.py  # for Python

Defining Custom Block Schemas

Blocks are the building blocks of your MCP. Define them via JSON Schema:

jsonCopyEdit{
  "title": "FetchOnchainData",
  "type": "object",
  "properties": {
    "endpoint": { "type": "string", "format": "uri" },
    "query": { "type": "string" }
  },
  "required": ["endpoint", "query"]
}
  • id: unique block identifier

  • inputs: data fields your block consumes

  • outputs: fields your block produces

  • config: user-configurable settings

Place schemas in schemas/ and reference them in manifest.json.

Packaging & Publishing Connectors

  1. Version your package in package.json or setup.py.

  2. Publish to registry:

    bashCopyEdit# npm
    npm publish
    # PyPI
    python -m twine upload dist/*
  3. Share on ContextMesh

    • In the web app, go to Connectors → Publish New

    • Provide package name and version

Consumers can then import your connector in their manifests by name and version.

Last updated