Free MCP Hosting. Set Your Price. Get Paid.
Example MCP Server
A working MCP server built with @mctx-ai/mcp-server. Clone, customize, deploy to mctx.
What This Demonstrates
All framework features in one file (src/index.ts):
- Tools — sync handlers, object returns, error handling, generators with progress, LLM sampling
- Resources — static URIs and dynamic URI templates with parameter extraction
- Prompts — single-message (string return) and multi-message (
conversation()) - Logging — structured logging with
log.info(),log.error(), etc. - Environment Variables — configurable behavior via
GREETINGenv var (set in mctx dashboard)
Quick Start
git clone https://github.com/mctx-ai/example-mcp-server.git
cd example-mcp-server
npm install
npm run build
Deploy to mctx:
- Visit mctx.ai
- Connect your repository
- Deploy — mctx reads
package.jsonfor server configuration
Project Structure
src/index.ts → Server implementation (all features in one file)
package.json → Server metadata (name, version, description, main entrypoint)
Local Development
Run the dev server with automatic rebuild and hot-reload:
npm run dev
This runs both esbuild watch (rebuilds on source changes) and mctx-dev (hot-reloads the server) in parallel.
Testing Environment Variables
To test environment variable configuration locally:
GREETING="Howdy" npm run dev
The greet tool will use "Howdy" instead of the default "Hello". When deployed to mctx, set GREETING in the dashboard to customize the greeting.
Learn More
- @mctx-ai/mcp-server — Framework documentation
- docs.mctx.ai — Platform guides
- MCP Specification — Protocol spec