📄️ Basics
Let's build a simple MCP server with Neva and add a tool, prompt and resource handlers.
📄️ Tools
The Model Context Protocol (MCP) allows servers to expose tools that can be invoked by language models. Tools enable models to interact with external systems, such as querying databases, calling APIs, or performing computations. Each tool is uniquely identified by a name and includes metadata describing its schema.
📄️ Resources
The Model Context Protocol (MCP) provides a standardized way for servers to expose resources to clients. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Each resource is uniquely identified by a URI.
📄️ Prompts
The Model Context Protocol (MCP) provides a standardized way for servers to expose prompt templates to clients. Prompts allow servers to provide structured messages and instructions for interacting with language models. Clients can discover available prompts, retrieve their contents, and provide arguments to customize them.
📄️ Sampling
The Model Context Protocol (MCP) provides a standardized way for servers to request LLM sampling (“completions” or “generations”) from language models via clients. This flow allows clients to maintain control over model access, selection, and permissions while enabling servers to leverage AI capabilities—with no server API keys necessary. Servers can request text, audio, or image-based interactions and optionally include context from MCP servers in their prompts.
📄️ Elicitation
This guide explains how to use elicitation on the server side to request additional user input or external actions during tool execution.
📄️ HTTP Transport
In addition to stdio, Neva supports Streamable HTTP transport — a bidirectional transport layer built on top of HTTP that enables remote MCP server connections.
📄️ Logging
Neva integrates with Rust's tracing ecosystem to emit structured log messages. When configured correctly, these log messages are automatically forwarded to connected clients as MCP log notifications (notifications/message).
📄️ Middlewares
Neva supports a middleware pipeline that allows you to intercept, inspect, or modify requests before and after they are processed. Middlewares are async functions that receive a MwContext and a Next callback.
📄️ Progress
For long-running tools, Neva can emit progress notifications (notifications/progress) to keep clients informed about how far along a task has progressed.
📄️ Tasks
Neva supports long-running tasks — a way to call tools asynchronously and manage their lifecycle. Tasks allow clients to execute tools that may take a long time or require additional interactions (such as sampling or elicitation), with optional TTL-based cancellation.
📄️ Dependency Injection
Neva includes a built-in dependency injection (DI) container that lets you register shared services — database connections, HTTP clients, configuration objects, caches — and have them automatically provided to your tool, resource, and prompt handlers.
📄️ Argument Completion
MCP allows servers to suggest completions for prompt and tool arguments — similar to tab-complete in a terminal. When a client types a partial value, it can request a list of matching options, and the server responds with suggestions.
📄️ Content Types
MCP tool and resource handlers can return several different kinds of content — not just plain text. This page covers all available content types and when to use each.
📄️ Error Handling
The way errors behave in Neva depends on which kind of handler returns them.