server
server
¶
Marianne MCP Server implementation.
This module implements the core MCP server that exposes Marianne job management capabilities through the Model Context Protocol. The server provides tools and resources for external AI agents to interact with Marianne.
The server implements JSON-RPC 2.0 over HTTP/SSE transport and follows the MCP specification for capability negotiation, tool execution, and resource access.
Classes¶
MCPServer
¶
Marianne MCP Server - Exposes Marianne capabilities via Model Context Protocol.
The server implements the MCP specification to provide: - Job management tools (run, pause, resume, cancel, status) - Artifact browsing and log streaming - Configuration access as resources
Security: - All tool executions require explicit user consent - File system access is restricted to Marianne workspace directories - No arbitrary code execution beyond Marianne's built-in capabilities
Attributes:
| Name | Type | Description |
|---|---|---|
tools |
Available MCP tools grouped by category |
|
resources |
Available MCP resources |
|
capabilities |
dict[str, Any]
|
Server capabilities advertised during negotiation |
Example
server = MCPServer() await server.initialize()
Server is ready to accept MCP connections¶
Initialize the MCP server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_root
|
Path | None
|
Optional root directory for workspace operations. Defaults to current working directory. |
None
|
Source code in src/marianne/mcp/server.py
Attributes¶
Functions¶
initialize
async
¶
Initialize the server with client capabilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client_info
|
dict[str, Any] | None
|
Information about the connecting MCP client |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Server initialization response with capabilities |
Source code in src/marianne/mcp/server.py
list_tools
async
¶
List all available tools.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of tool definitions with schemas |
Source code in src/marianne/mcp/server.py
call_tool
async
¶
Execute a tool with the given arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Tool name to execute |
required |
arguments
|
dict[str, Any] | None
|
Tool arguments |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Tool execution result |
Raises:
| Type | Description |
|---|---|
ValueError
|
If tool is not found or arguments are invalid |
RuntimeError
|
If server is not initialized |
Source code in src/marianne/mcp/server.py
list_resources
async
¶
List all available resources.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of resource definitions |
Source code in src/marianne/mcp/server.py
read_resource
async
¶
Read a resource by URI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri
|
str
|
Resource URI to read |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Resource content |
Raises:
| Type | Description |
|---|---|
ValueError
|
If resource URI is not found |
Source code in src/marianne/mcp/server.py
shutdown
async
¶
Shutdown the server and cleanup resources.