Skip to main content

Crate systemprompt_mcp

Crate systemprompt_mcp 

Source
Expand description

Native Model Context Protocol (MCP) implementation for systemprompt.io.

This crate hosts the in-process MCP server runtime, the registry/orchestrator that supervises per-tenant MCP child processes, the OAuth2/RBAC middleware, and the tool/resource/UI-renderer abstractions used across the platform.

§Layered components

§Feature matrix

This crate has no Cargo features today; it is built as a single unit. The facade crate systemprompt gates this crate behind the mcp / full features.

§Errors

All public APIs return McpDomainResult — a typed Result aliased over McpDomainError. External error types (sqlx, serde_json, io, join errors) are composed via #[from] on the error enum. Third-party errors without a typed adapter are converted at the boundary with .map_err(|e| McpDomainError::Internal(e.to_string())).

Copyright (c) systemprompt.io — Business Source License 1.1. See https://systemprompt.io for licensing details.

Re-exports§

pub use repository::CreateMcpArtifact;
pub use repository::McpArtifactRecord;
pub use repository::McpArtifactRepository;
pub use services::ui_renderer::templates::html::artifact_shell_template;
pub use services::ui_renderer::artifact_resource_uri;
pub use services::ui_renderer::parse_artifact_resource_uri;
pub use services::monitoring::health::HealthStatus;
pub use services::monitoring::status::McpServiceStatus;
pub use services::registry::RegistryService;
pub use services::registry::trait_impl::McpDeploymentProviderImpl;
pub use services::tool_provider::McpToolProvider;
pub use services::EventBus as McpEventBus;
pub use services::McpEvent;
pub use services::McpOrchestrator;
pub use orchestration::McpServerConnectionInfo;
pub use orchestration::McpServiceState;
pub use orchestration::McpToolLoader;
pub use orchestration::ServerStatus;
pub use orchestration::ServiceStateService;
pub use orchestration::SkillLoadingResult;

Modules§

middleware
HTTP-facing middleware for the MCP server: RBAC enforcement, database-backed session management, and request-context/bearer-token extraction helpers.
models
Domain models for MCP — sessions, artifacts, validation results, etc.
orchestration
Multi-server lifecycle and state orchestration: tool discovery/loading across MCP servers and runtime service-state lookups backed by the database.
registry
repository
Postgres persistence for MCP: tool-execution records and aggregate stats, session state, and tool-output artifacts.
services
Publicly re-exported submodule. See submodule rustdoc for details.

Macros§

register_artifact_theme
register_ui_renderer

Structs§

ArtifactViewerConfig
ClientProfile
Deployment
DeploymentConfig
McpError
Error information for JSON-RPC error responses.
McpExtension
McpHttpConfig
McpResponseBuilder
McpServerConfig
McpServerMetadata
McpServerState
McpState
McpToolExecutor
OAuthRequirement
ProtocolVersion
Represents the MCP protocol version used for communication.
SessionTimeouts
Settings
TaskContext
Handle passed to a running task operation, allowing it to surface server-to-client requests (elicitation, sampling, roots) mid-task and await the client’s tasks/update response.
TaskManager
Server-side task store and executor for the SEP-2663 Tasks extension.
TaskOptions
Options controlling a spawned task.
ToolIdentity

Enums§

McpAuthState
McpDomainError

Constants§

ERROR
MAX_REQUEST_BODY_BYTES
RUNNING
STARTING
STOPPED
UI_RESOURCE_URI_META_KEY
WEBSITE_URL

Traits§

McpDeploymentProvider
McpOutputSchema
McpProvider
McpRegistry
McpToolHandler

Functions§

build_artifact_viewer_resource
build_extension_capabilities
build_resource_template_list_result
build_tool_list_result
client_profile_from_peer
client_profile_from_stored
create_progress_callback
create_router
default_server_icons
default_tool_visibility
mcp_apps_ui_extension
mcp_protocol_version
mcp_protocol_version_str
mcp_supported_protocol_versions
model_only_visibility
read_artifact_resource
read_artifact_viewer_resource
tool_ui_meta
visibility_to_json

Type Aliases§

DynMcpDeploymentProvider
DynMcpRegistry
DynMcpToolProvider
McpDomainResult
McpResult
ProgressCallback