| Page properties | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
|
Enable AI-powered industrial automation through Model Context Protocol integration.
- Name: MCPServer
- Version: 1.0.0.0
- Interface: TCP/IP
- Configuration:
- Scripts / Classes
| Table of Contents | ||||||
|---|---|---|---|---|---|---|
|
Overview
The AI MCP for Runtime service bridges FrameworX solutions with AI language models, enabling intelligent automation assistance while maintaining industrial-grade safety. This connector exposes your solution's live data and functionality as structured tools that AI models can invoke.
Note: This connector is for querying live data from running solutions (connects to TServer.exe). For AI-assisted solution configuration, see AI MCP for Designer Connector.
Key Capabilities
- Real-time Data Access — Query live tag values, historian data, and alarm states through AI
- Unified Namespace Browsing — Explore your tag structure and discover available data
- Historical Analysis — Query historian for trend analysis and past behavior investigation
- Alarm Monitoring — Check active alarms and query alarm history
- Custom Methods — Extend with your own solution-specific AI tools
- Platform Agnostic — Works with Claude, GitHub Copilot, and other MCP-compatible AI models
When to Use MCP for Runtime
| Use Case | Example |
|---|---|
| Process monitoring | "What is the current temperature in Tank1?" |
| Alarm investigation | "Are there any active alarms? What's causing them?" |
| Historical analysis | "Show me the temperature trend for the last 24 hours" |
| Data discovery | "What tags are available under Plant1/Line2?" |
| Operational questions | "What is the system uptime?" |
Prerequisites
- FrameworX 10.1 or later
- .NET 8.0 runtime
- Claude Desktop or compatible MCP client
- Running FrameworX solution (TServer.exe)
- Network connectivity
Configuration
The MCP Server starts automatically when your solution runs. You need to configure your AI client to connect to it.
Connection Methods
| Method | Use Case | Requirements |
|---|---|---|
| stdio | AI client on same machine as solution | Local installation |
| HTTP | AI client on different machine | Network access, optional SSL |
| SSE | Server-sent events | Not yet tested |
stdio Configuration
Use stdio when the AI client runs on the same machine as your solution.
Configure Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"YourSolution": {
"command": "C:\\FrameworX\\fx-10\\net8.0\\TMCPServerStdio\\TMCPServerStdio.exe",
"args": ["/host:127.0.0.1", "/port:3101"],
"transport": "stdio"
}
}
}
Note: For Windows-only solutions, use the path
<ProductPath>\fx-10\TMCPServerStdio\TMCPServerStdio.exe(without net8.0).
HTTP Configuration
Use HTTP when the AI client runs on a different machine than your solution.
MCP Server Settings (TMCPServerHttp.json in C:\Users\Public\Documents\FrameworX\MachineSettings):
{
"appSettings": {
"X_API_KEY": "",
"CertFileName": "",
"CertPass": "",
"CertHash": "",
"ListenPort": "3000",
"Runtime": {
"Host": "localhost",
"Port": "3101",
"Username": "guest",
"Password": ""
}
}
}
AI Client Settings (GitHub Copilot .mcp.json):
{
"servers": {
"FrameworX Runtime": {
"type": "http",
"url": "http://localhost:3000",
"headers": {
"X-API-KEY": ""
}
}
}
}
HTTP Settings Reference:
| Setting | Description |
|---|---|
X_API_KEY | Optional authentication password |
CertFileName | SSL certificate file (for HTTPS) |
CertPass | SSL certificate password |
CertHash | SSL certificate thumbprint (alternative to file) |
ListenPort | HTTP endpoint port (default: 3000) |
Runtime.Host | FrameworX runtime host (default: localhost) |
Runtime.Port | FrameworX runtime port (default: 3101) |
Runtime.Username | Runtime authentication user |
Runtime.Password | Runtime authentication password |
Multiple Connections: To connect to multiple runtimes, use /instance:<number> argument and matching numbered settings (e.g., X_API_KEY2, ListenPort2, Runtime2).
Verifying Connection
- Click the LLM connector icon — you should see your solution name
- Go to Settings → Developer and verify the connection shows "running"
- Ask the AI a simple question like "What is the server uptime?"
Available Tools
AI MCP for Runtime provides these built-in tools:
Data Access
| Tool | Purpose |
|---|---|
| get_value | Get current value of a tag or runtime object |
| get_tag_metadata | Get tag description, units, range, and data type |
| get_children | Browse the Unified Namespace structure |
| search_tags | Find tags by name pattern |
Historical Data
| Tool | Purpose |
|---|---|
| get_tag_history | Query historical time-series data for a tag |
Alarms
| Tool | Purpose |
|---|---|
| get_active_alarms | Get currently active alarms |
| query_alarm_database | Query historical alarm records |
Example Queries
Reading Values:
- "What is the current value of Tag.Temperature1?"
- "Get the value of Tag.Plant1/Line2/Pressure"
- "What is the Server.SystemMonitor.CPUUsage?"
- "How many active alarms are there?" (uses Alarm.TotalCount)
Browsing Data:
- "What tags are available under Tag.Plant1?"
- "Show me the members of Tag.Pump1" (for UserType tags)
- "What alarm groups exist?"
- "Find all tags containing 'Temperature'"
Historical Analysis:
- "Show me the temperature history for today"
- "Get the historian data for Tag.Pressure from 8am to noon"
- "What was the highest temperature value today and when did it occur?"
Alarm Investigation:
- "Are there any active alarms?"
- "Show me alarms from the last 24 hours"
- "How many alarms were acknowledged today?"
- "Query the alarm history for Tag.Temperature1"
Custom Methods
You can extend the MCP server with your own solution-specific tools by creating custom methods in Scripts.
Creating Custom Methods
- Navigate to Scripts → Classes
- Create a new class with type MCP Tool
- Define methods using MCP decorators:
[McpServerTool, Description("Get current tank level for a specific tank")]
public string get_tank_level(
[Description("Tank identifier (1-4)")] string tank_id = "1")
{
return @Tag[$"Tank{tank_id}_Level"].ToString();
}
Method Structure:
| Element | Purpose |
|---|---|
[McpServerTool] | Marks method as MCP tool |
[Description("...")] | Explains what the tool does (shown to AI) |
| Method name | Tool name (use snake_case) |
| Parameter descriptions | Explains expected input to AI |
| Return value | Result sent to AI |
Custom Method Examples
Simple Value Retrieval:
[McpServerTool, Description("Get production count for today")]
public string get_production_count()
{
return @Tag.Production.TodayCount.ToString();
}
With Error Handling:
[McpServerTool, Description("Get data for a specific tag with validation")]
public string get_tag_data(
[Description("Full tag path")] string tag_name)
{
try
{
if (!@Tag.Exists(tag_name))
return $"Error: Tag '{tag_name}' not found";
return @Tag[tag_name].ToString();
}
catch (Exception ex)
{
@Info.Trace($"MCP Error: {ex.Message}");
return "Error: Unable to retrieve data";
}
}
Aggregated Data:
[McpServerTool, Description("Get summary of all tank levels")]
public string get_all_tank_levels()
{
var result = new StringBuilder();
for (int i = 1; i <= 4; i++)
{
var level = @Tag[$"Tank{i}_Level"].Value;
result.AppendLine($"Tank {i}: {level}%");
}
return result.ToString();
}
Important: After creating or modifying custom methods, fully restart the AI client (close from Task Manager, not just the window).
Best Practices
For AI Queries
- Be specific about tag paths when asking for values
- Use "active alarms" for current state, "alarm history" for past events
- Specify time ranges clearly for historical queries
- Ask the AI to browse the namespace if you're unsure of tag names
For Custom Methods
- Use descriptive names and descriptions — the AI relies on these
- Include parameter validation and error handling
- Return clear error messages that help the AI understand what went wrong
- Follow snake_case naming convention for consistency
- Keep methods focused on single tasks
Security Considerations
- Use
X_API_KEYauthentication for HTTP connections - Configure appropriate runtime user permissions
- Be cautious with write operations — consider read-only access for AI
- Review custom methods for security implications
Troubleshooting
MCP Server not starting
- Verify .NET 8.0 runtime is installed
- Check firewall settings for the configured port
- Confirm TMCPServerStdio.exe path is correct in AI client config
AI cannot access methods
- Ensure solution is running (TServer.exe active)
- Verify AI client configuration matches server settings
- Restart AI client completely (close via Task Manager)
- Check that MCP decorators are properly applied to custom methods
Data not updating
- Confirm tags are properly configured in the solution
- Verify real-time database connectivity
- Check custom method error handling for exceptions
Custom methods not appearing
- Verify class type is set to "MCP Tool"
- Check for syntax errors in method code
- Restart AI client completely after changes
HTTP connection failing
- Verify ListenPort is not blocked by firewall
- Check X_API_KEY matches between server and client
- For HTTPS, verify certificate is properly configured
- Test with
http://localhost:3000first before remote access
Related Documentation
Quick Start Tutorial
Build your first MCP connection step by step:
- AI MCP for Runtime Tutorial — Creating and deploying MCP Tools
Example Implementation
Explore a complete working example:
- SolarPanels MCP Demo — Full solution demonstrating MCP Tools with solar panel monitoring
Technology Information
- AI-Ready by Design — Platform architecture for AI integration
Reference Information
- Scripts Module Reference — Complete scripting documentation
AI MCP for Designer
For AI-assisted solution configuration (creating tags, displays, alarms):
- AI MCP for Designer Connector — Enable AI to configure solutions
- AI MCP for Designer Tutorial — Step-by-step guide for AI-assisted configuration
In this section...
| Page Tree | ||
|---|---|---|
|