Skip to main content
Glama
Secil Canary Historian MCP Server

Secil Canary Historian MCP Server

by eins53740

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
LOG_LEVELNoLogging verbosity: DEBUG, INFO, WARNING, ERROR, or CRITICAL.INFO
CANARY_TIMEOUTNoRequest timeout in seconds.30
CANARY_MCP_HOSTNoHost for the remote HTTP/SSE transport, for example 0.0.0.0.
CANARY_MCP_PORTNoPort for the remote HTTP/SSE transport.6000
MCP_SERVER_HOSTNoOptional MCP server host.localhost
MCP_SERVER_PORTNoOptional MCP server port.6000
CANARY_API_TOKENYesAuthentication token for the Canary API. Keep this secret.
CANARY_POOL_SIZENoConnection pool size.10
CANARY_ASSET_VIEWNoAsset metadata view used by get_asset_types and get_asset_instances.
CANARY_VECTOR_DIMNoDimension used for deterministic vector embeddings.512
CANARY_DEFAULT_VIEWNoOptional default view scoping for read_timeseries.
CANARY_SAF_BASE_URLYesBase URL for the Canary SAF (Store and Forward) API.
CANARY_TESTER_ROLESNoComma-separated allowed tester roles for write_test_dataset.
CANARY_VECTOR_TOP_KNoNumber of top semantic matches to return from the vector index.5
CANARY_MCP_TRANSPORTNoTransport mode for the MCP server, for example stdio or http.stdio
CANARY_RETRY_ATTEMPTSNoNumber of retry attempts for failed requests.6
CANARY_VIEWS_BASE_URLYesBase URL for the Canary Views API.
CANARY_WRITER_ENABLEDNoFlag controlling whether the write tool is enabled.
CANARY_TAG_SEARCH_ROOTNoRoot namespace used when calling browseTags, for example Secil.Portugal.
CANARY_VECTOR_HASH_SEEDNoHash seed for deterministic vector embeddings.0
CANARY_MAX_WRITE_RECORDSNoMaximum number of records allowed in a write_test_dataset request.
CANARY_VECTOR_INDEX_PATHNoPath to the optional vector index.data/vector-index
CANARY_MAX_RESPONSE_BYTESNoMaximum MCP response size in bytes before truncation.1000000
CANARY_ENABLE_VECTOR_SEARCHNoFlag enabling optional vector/RAG semantic search.false
CANARY_LAST_VALUE_PAGE_SIZENoMaximum number of samples requested to resolve last known values.500
CANARY_TAG_SEARCH_FALLBACKSNoComma-separated additional namespace prefixes to probe when the root search scope is empty.
CANARY_WRITE_ALLOWED_DATASETSNoComma-separated allowed Test datasets for write_test_dataset, for example Test/Maceira,Test/Outao.
CANARY_LAST_VALUE_LOOKBACK_HOURSNoWindow in hours used when retrieving last known values.24

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Expose Canary historian metadata, guide natural-language requests toward precise tag paths, and lean on the tag catalog resource plus the tag_lookup_workflow prompt to clarify any ambiguous user intent. Interpret time ranges with the Canary relative time standard (see resource://canary/time-standards) and convert results from the Europe/Lisbon timezone to UTC. When requesting data for more than one tag, prefer the historian POST endpoints instead of multi-tag GET queries. When searching, pair English keywords with Portuguese synonyms—especially for the Portuguese sites (Maceira, Outão, Pataias, Montijo, Rio Maior, Martingança)—and translate the user's natural-language prompt as needed to surface the correct tags, variables, and historian locations. Remember this database stores industrial-process telemetry (PLCs, temperature sensors, pressure transmitters, etc.) that is normalized, filtered, or aggregated into metrics and KPIs over intervals such as weekly or monthly, so keep plant performance, maintenance, product quality, and compliance context in mind.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
pingA

Simple ping tool to test MCP server connectivity.

Returns: str: Success message confirming server is responding

mcp_statusB

Checks MCP server connectivity and provides a status message named "mcp status".

Returns: str: A detailed success message with server status, time, weather, and project info.

get_asset_catalogA

Retrieve curated metadata for Secil Maceira sensors, devices, and historian tags.

This tool compiles information from the Canary auxiliary catalog so LLM or MCP clients can convert natural-language requests into concrete historian paths. Pair this with the tag_lookup_workflow prompt and the search_tags tool when the user provides only a partial description.

Args: refresh: When True, reload the auxiliary files from disk (default: False) limit: Maximum number of tag entries to return inline (default: 200) include_examples: When True, include the raw request examples from the source file

Returns: dict[str, Any]: Keys include - success: Whether metadata was loaded - tags: Inline sample of tag entries limited by limit - examples: Optional example list (present when include_examples=True) - total_tags: Number of tag entries available in the catalog - summary: Metadata about the returned sample (site, counts, truncation) - resource_uri: The canonical MCP resource URI for the catalog - refreshed: Whether the cache was refreshed this call - hint: Guidance for follow-up actions

search_tagsA

Search for Canary tags by name pattern.

This tool searches for industrial process tags in the Canary historian that match the provided search pattern. Results are cached for performance.

Hint: combine this tool with the tag_lookup_workflow prompt and the resource://canary/tag-catalog metadata. Start from literal identifiers (for example "P431") without introducing wildcards—Canary performs its own fuzzy matching and rewards precise fragments.

Args: search_pattern: Tag name or pattern to search for (supports wildcards) bypass_cache: If True, skip cache and fetch fresh data (default: False) search_path: Optional namespace path to scope the browseTags query. Defaults to the CANARY_TAG_SEARCH_ROOT environment variable when omitted.

Returns: dict[str, Any]: Dictionary containing search results with keys: - tags: List of matching tags with metadata - count: Total number of tags found - success: Boolean indicating if operation succeeded - pattern: The search pattern used - search_path: The path used to scope the search (may be empty) - cached: Boolean indicating if result came from cache

Raises: Exception: If authentication fails or API request errors occur

get_tag_metadataB

Get detailed metadata for a specific tag in Canary.

This tool retrieves comprehensive metadata for a tag including properties, data type, units, description, and configuration details.

Args: tag_path: Full path or name of the tag to retrieve metadata for

Returns: dict[str, Any]: Dictionary containing tag metadata with keys: - metadata: Dictionary of tag properties - success: Boolean indicating if operation succeeded - tag_path: The tag path that was queried

Raises: Exception: If authentication fails or API request errors occur

get_tag_pathA

Resolve a natural-language tag description to the best-matching tag path.

Args: description: Natural-language description of the desired tag max_results: Maximum number of candidate tags to return bypass_cache: If True, skip cached results and fetch fresh data

Returns: dict[str, Any]: Response containing the most likely tag path and candidates

get_tag_propertiesB

Fetch raw tag property dictionaries from Canary getTagProperties API.

Args: tag_paths: List of fully qualified tag paths to fetch properties for.

Returns: dict[str, Any]: { "success": bool, "properties": mapping of tag path -> property dict, "count": number of property payloads returned, "requested": original tag_paths, "cached": always False }

list_namespacesA

List available Canary namespaces from the historian.

This tool retrieves the hierarchical organization of industrial process tags by querying the Canary Views API for namespace information.

Returns: dict[str, Any]: Dictionary containing namespace structure with keys: - namespaces: List of namespace paths - count: Total number of namespaces found - success: Boolean indicating if operation succeeded

Raises: Exception: If authentication fails or API request errors occur

get_last_known_valuesC

Retrieve the most recent sample for one or more tags.

read_timeseriesB

Retrieve historical timeseries data for specific tags and time ranges.

This tool retrieves historical process data from the Canary historian for analysis and troubleshooting.

Args: tag_names: Single tag name or list of tag names to retrieve data for. If a JSON-style string array is provided (e.g. '["tag1","tag2"]'), it will be parsed automatically, but callers should prefer passing an actual list. start_time: Start time (ISO timestamp or relative expression like "now-1d") end_time: End time (ISO timestamp or relative expression like "now") page_size: Number of samples per page (default 1000)

Returns: dict[str, Any]: Dictionary containing timeseries data with keys: - data: List of data points with timestamp, value, quality - count: Total number of data points returned - success: Boolean indicating if operation succeeded - tag_names: The tag names that were queried - start_time: The start time used for the query - end_time: The end time used for the query - hint: Guidance for correct usage

Raises: Exception: If authentication fails or API request errors occur

Note: When retrieving data for multiple tags, the MCP issues POST requests to the Canary historian. Avoid multi-tag GET queries to remain compatible with the API.

write_test_datasetA

Write manual entry samples into approved Test/* datasets via Canary SAF.

Args: dataset: The Test dataset to target (e.g., "Test/Maceira"). records: List of objects with keys tag, value, and optional timestamp/quality. original_prompt: Natural-language instruction captured for auditing. role: Caller role; must match one of CANARY_TESTER_ROLES (default: "tester"). dry_run: When True, validate payload but skip the actual Canary API call.

Returns: Dict summarising the write attempt, including recorded prompt and role metadata.

get_tag_data2B

Retrieve historian data via Canary getTagData2 endpoint with optional aggregates.

Args: tag_names: Single tag or list of tags (same normalization rules as read_timeseries) start_time: ISO timestamp or relative time string end_time: ISO timestamp or relative time string aggregate_name: Optional aggregate (e.g., TimeAverage2) aggregate_interval: Optional interval (e.g., 00:05:00) when aggregate_name is set max_size: Desired response size (# of samples) before Canary paginates (default 1000)

Returns: dict: Structured response including raw data, count, and metadata summary

get_aggregatesB

Fetch supported Canary aggregate definitions (wrapper around getAggregates).

get_asset_typesC

Return asset types available in the configured Canary view.

get_asset_instancesC

Return asset instances for a given asset type (wrapper for getAssetInstances).

get_events_limit10C

Retrieve recent Canary events (wrapper for getEvents with limit 10 default).

browse_statusC

Inspect namespace nodes using the browseStatus endpoint.

get_server_infoA

Get Canary server health and capability information.

This tool retrieves server version, status, supported time zones, and aggregation functions from the Canary historian, along with MCP server configuration details.

Returns: dict[str, Any]: Dictionary containing server information with keys: - success: Boolean indicating if operation succeeded - server_info: Dictionary with Canary server details - mcp_info: Dictionary with MCP server details - error: Error message (only on failure)

Raises: Exception: If authentication fails or API request errors occur

get_eventsB

Retrieve event data from the Canary historian.

Args: start_time: Start time (ISO timestamp or relative expression like "now-1d") end_time: End time (ISO timestamp or relative expression like "now") limit: Maximum number of events to return (default 10) tag_names: Optional list of tag names to filter events

Returns: dict[str, Any]: Dictionary containing event data with keys: - success: Boolean indicating if operation succeeded - events: List of event records - count: Total number of events returned - error: Error message (only on failure)

get_metricsB

Get performance metrics in Prometheus format.

Story 2.1: Returns collected metrics including request counts, latencies, cache hit/miss rates, and connection pool statistics.

Returns: str: Metrics formatted in Prometheus text exposition format

Example: # HELP canary_requests_total Total number of requests by tool # TYPE canary_requests_total counter canary_requests_total{tool_name="search_tags",status_code="200"} 42 ...

get_metrics_summaryB

Get human-readable summary of performance metrics.

Story 2.1: Returns aggregated metrics including request counts, latency percentiles, and cache statistics for all MCP tools.

Returns: dict[str, Any]: Dictionary containing metric summaries with keys: - total_requests: Total number of requests processed - by_tool: Per-tool statistics (counts, latencies, cache stats) - cache_stats: Overall cache hit/miss counts - active_connections: Current connection pool usage

Example: json { "total_requests": 156, "by_tool": { "search_tags": { "request_count": 42, "latency": {"median": 1.2, "p95": 3.5, "p99": 5.1}, "cache_hits": 10, "cache_misses": 32 } }, "cache_stats": {"total_hits": 45, "total_misses": 111}, "active_connections": 3 }

get_cache_statsB

Get cache statistics.

Story 2.2: Returns cache performance statistics including hit rate, size, and entry count.

Returns: dict[str, Any]: Dictionary containing cache statistics with keys: - success: Boolean indicating if operation succeeded - stats: Cache statistics object

Example: json { "success": true, "stats": { "entry_count": 42, "total_size_mb": 12.5, "max_size_mb": 100, "cache_hits": 150, "cache_misses": 30, "hit_rate_percent": 83.3, "evictions": 5 } }

invalidate_cacheA

Invalidate cache entries matching pattern.

Story 2.2: Clears cached data, optionally filtering by pattern. Use this when configuration changes or fresh data is required.

Args: pattern: SQL LIKE pattern for keys (empty string = invalidate all)

Returns: dict[str, Any]: Dictionary containing invalidation results with keys: - success: Boolean indicating if operation succeeded - count: Number of entries invalidated - pattern: The pattern used (if any)

Example: json { "success": true, "count": 15, "pattern": "search:%" }

cleanup_expired_cacheA

Remove expired entries from cache.

Story 2.2: Cleans up expired cache entries to free storage space. This is done automatically but can be triggered manually.

Returns: dict[str, Any]: Dictionary containing cleanup results with keys: - success: Boolean indicating if operation succeeded - count: Number of expired entries removed

Example: json { "success": true, "count": 8 }

get_healthA

Get MCP server health status including circuit breaker state.

Story 2.3: Advanced Error Handling & Retry Logic Exposes circuit breaker state and system health for monitoring.

Returns: dict[str, Any]: Dictionary containing health status with keys: - status: Overall health status ("healthy", "degraded", "unhealthy") - timestamp: Current timestamp - circuit_breakers: Dictionary of circuit breaker states - cache_health: Cache system health information - metrics_summary: Performance metrics summary

Example: json { "status": "healthy", "timestamp": "2025-11-01T10:00:00", "circuit_breakers": { "canary-api": { "state": "closed", "failure_count": 0, "state_changes": 2 } }, "cache_health": { "operational": true, "entry_count": 42, "hit_rate_percent": 75.5 } }

Prompts

Interactive templates invoked by user choice

NameDescription
tag_lookup_workflowWorkflow for translating natural-language requests into precise Canary tag paths.
timeseries_query_workflowWorkflow for retrieving historical samples from the Canary historian.

Resources

Contextual data attached and managed by the client

NameDescription
maceira_tag_catalogStructured metadata for the Secil Maceira site, including tag paths, descriptions, and engineering units gathered from Canary auxiliary files.
canary_time_standardsReference guide for Canary relative time expressions and Europe/Lisbon timezone defaults used in historian queries.
maceira_uns_tag_guideHuman-readable guide to the Secil Maceira ISA-95/UNS hierarchy and tag naming. LLM/MCP clients should read this to understand the semantics and translate natural-language asset references into valid Canary tag paths.

TDQS

B3/5.0

Scored across 25 tools

Disambiguation2/5

Several tools have overlapping boundaries: read_timeseries and get_tag_data2 both retrieve historical timeseries with optional aggregates, get_events and get_events_limit10 overlap, and get_tag_metadata vs get_tag_properties both expose tag details. Status/health tools (ping, mcp_status, get_health, get_server_info) also blur connectivity, server health, and capability reporting. Distinct core tools exist, but an agent could easily misselect among these pairs.

Naming Consistency4/5

Most tool names follow a predictable snake_case verb_noun pattern such as search_tags, get_tag_metadata, list_namespaces, and invalidate_cache. Minor deviations include ping and mcp_status, plus numeric suffixes in get_tag_data2 and get_events_limit10. The convention is still readable and mostly consistent.

Tool Count3/5

At 25 tools, the surface is at the heavy end for a historian server and includes redundant wrappers, connection-test tools, and multiple observability/cache tools. The domain is complex enough to justify many operations, but several tools do not clearly earn their place as separate entries. This feels borderline over-scoped rather than well-scoped.

Completeness4/5

The server covers a strong historian read/analysis lifecycle: tag discovery, metadata, namespaces, historical timeseries, last-known values, aggregates, events, assets, and cache/health monitoring. Write support is intentionally limited to test datasets, and real-time subscriptions or broader production write operations are absent, but these are minor gaps for the apparent purpose.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues