This directory contains example implementations of MCP servers demonstrating various features and transport mechanisms.
time_server.jl- Basic stdio server that provides time-related tools- Simple subprocess communication model
- Good starting point for local MCP servers
Following the MCP Streamable HTTP specification (latest protocol version 2025-11-25):
-
simple_http_server.jl- Simplest Streamable HTTP server- Basic tools (echo, greet)
- Minimal configuration
- Good for testing with MCP Inspector
-
reg_dir_http.jl- Auto-registration over Streamable HTTP- Loads tools/resources/prompts from the
mcp_tools/directory - Same component model as
reg_dir.jl, served over HTTP
- Loads tools/resources/prompts from the
-
multi_content_tool.jl- Demonstrates tools returning multiple content types- Shows how to return text, images, and mixed content
- Useful for complex tool responses
-
complex_schema_server.jl- Advanced JSON Schema tool inputs- Raw
input_schemawith arrays, enums, and nested objects
- Raw
-
task_server.jl- MCP Tasks demo (experimental)- Long-running tool executed in the background (
task_support = :optional) - Status polling, blocking result retrieval, cooperative cancellation, progress
- Long-running tool executed in the background (
-
reg_dir.jl- Directory registration example (stdio)- Auto-registers components from
mcp_tools/subdirectories
- Auto-registers components from
julia --project examples/time_server.jl# Start the server
julia --project examples/simple_http_server.jl
# In another terminal, test with curl:
curl -X POST http://localhost:3000/ \
-H 'Content-Type: application/json' \
-H 'MCP-Protocol-Version: 2025-11-25' \
-d '{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}'
# Or use MCP Inspector:
npx @modelcontextprotocol/inspector
# Then connect to: http://localhost:3000/# Start an HTTP server
julia --project examples/simple_http_server.jl
# Connect an SSE client for server-to-client notifications
curl -N -H 'Accept: text/event-stream' http://localhost:3000/These examples implement the Streamable HTTP transport specification, which replaced the deprecated HTTP+SSE transport from protocol version 2024-11-05.
Current protocol version: 2025-11-25 (negotiated per client, down to 2024-11-05)
Key features of Streamable HTTP:
- Single endpoint for POST and GET
- Optional SSE for streaming
- Session management via headers
- Protocol version negotiation
- 202 Accepted for notifications
- Start with
simple_http_server.jlfor basic HTTP setup - Use
reg_dir_http.jlto understand component auto-registration over HTTP - Test with MCP Inspector for visual debugging
- Use curl for manual testing and debugging
- Check server logs (stderr) for debugging information
When deploying Streamable HTTP servers:
- Bind to localhost (127.0.0.1) for local-only access
- Implement Origin validation for web clients
- Use HTTPS in production (via reverse proxy)
- Add authentication as needed