Examples
These examples are complete Nim programs from the repository’s examples/ directory.
Compile an example from the nimwire package directory:
nim c examples/echo_server.nimRun the resulting executable with an MCP client, or pipe newline-delimited JSON-RPC into the stdio examples.
- Echo server: register one tool and serve stdio.
- HTTP server: serve the same style of tool over Streamable HTTP.
- Prompts server: define a typed prompt and completion hook.
- Resources server: serve files, generated data, and URLs.
- Auth server: enable bearer authorization and scope checks.
The HTTP example also includes a minimal reverse proxy configuration.
The examples import ../src/nimwire, so they run directly from a checkout. Installed applications can use import nimwire instead.