LOPs + MCP (Model Context Protocol)
Overview
Section titled “Overview”The Model Context Protocol (MCP) is an open standard designed to let AI models (like those used by the Agent
LOP) interact with external tools, data sources (resources), and predefined prompts. It uses a client-server architecture:
- MCP Servers: Separate applications that provide specific capabilities (e.g., accessing files, querying databases, searching the web, running code).
- MCP Client: An application (like this LOPS component) that connects to one or more MCP servers, discovers their capabilities, and brokers interactions between the AI model and the servers.
This MCP Client LOP acts as the central hub within TouchDesigner for managing connections to MCP servers. Its goal is to enable LOPS Agents to leverage external tools and information seamlessly.
Communication typically happens via JSON-RPC messages over standard input/output (stdio) of server processes launched by the client.
Usage in LOPS (Planned Integration)
Section titled “Usage in LOPS (Planned Integration)”Once fully integrated, the workflow will be:
- Configuration: You configure which MCP servers the client should connect to using a
mcp_servers.json
file. - Connection: The MCP Client LOP connects to the configured servers.
- Tool Discovery: The
Agent
LOP (or other LOPS operators) will query this MCP Client LOP to get a list of available tools from all connected servers. - AI Interaction: The
Agent
will inform the underlying AI model about the available tools (name, description, expected inputs). - Tool Invocation: When the AI model decides to use a tool, the
Agent
will instruct this MCP Client LOP to execute the tool call on the appropriate connected server. - Result Handling: The MCP Client LOP receives the result from the server and passes it back to the
Agent
, which then feeds it back into the AI model’s context to continue the conversation.
This will allow you to extend the capabilities of the Agent
LOP significantly by connecting it to file systems, web search, code execution environments, custom databases, and more, simply by running the corresponding MCP servers.
Configuration (mcp_servers.json
)
Section titled “Configuration (mcp_servers.json)”Connections to MCP servers are managed through a JSON configuration file. You specify the path to this file in the Config File Path
parameter and then use the Load Config
pulse.
The JSON file should contain a list under the servers
key. Each entry defines a server to connect to.
Example mcp_servers.json
:
{ "servers": [ { "name": "FileSystem", "type": "stdio", "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "./MCP/data" ], "id": "filesystem_1", "always_allow": true, "transport": "stdio" }, { "name": "SequentialThinking", "type": "stdio", "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-sequentialthinking" ], "id": "seq_think_1", "always_allow": true, "transport": "stdio" } // Add more server configurations here ]}
name
: A user-friendly name for the server.type
: Usuallystdio
for servers launched as local processes.command
: The executable to run (e.g.,npx
,python
, path to binary).args
: A list of arguments to pass to the command. Note the use of-y
withnpx
to auto-install server packages if needed. The last argument forserver-filesystem
is the directory it should manage.id
: (Optional) A unique identifier for the server connection.always_allow
: (Not currently used by this client) Intended for auto-approving tool calls.transport
: Specifies the communication method, typicallystdio
.
After editing the JSON file, pulse the Load Config
parameter on the Connection
page to update the list of available servers shown in the sessions
table inside the component.
Adding & Connecting Servers
Section titled “Adding & Connecting Servers”- Define Servers: Add server definitions to your
mcp_servers.json
file. - Load Config: Pulse the
Load Config
parameter. The defined servers will appear in the internalsessions
table with a status ofsaved
. - Connect: Use the
ConnectByName
method in the extension (or potentially future UI elements) to initiate a connection to a specific server listed in thesessions
table. The client will attempt to launch the server process as defined in the config.
Alternatively, for specific built-in or common servers:
- File Server: Pulse
Connect to File Server
on theDebug
page to directly launch and connect to the official@modelcontextprotocol/server-filesystem
, using the path specified inFile System Directory
. This is useful for quick testing without editing the JSON config. - MCP Inspector: Use
Launch Web Inspector
to open the Inspector’s web UI andConnect Inspector
to establish a test connection to the Inspector running in server mode (useful for debugging MCP interactions). Requiresnpm install -g @modelcontextprotocol/inspector
.)
Monitoring
Section titled “Monitoring”- Status: The
Connected
toggle indicates if any MCP server session is active. TheNumServers
,NumTools
,NumResources
, andNumPrompts
parameters show the total count across all connected sessions. - Sessions Table: The internal
sessions
table lists all configured and connected servers, their status (saved
,connecting
,connected
,failed
,disconnected
), command, args, and capability counts. - Tools/Resources/Prompts Tables: The internal
tools
,resources
, andprompts
tables provide detailed listings of all capabilities discovered from connected servers. - Logs: Operations, connections, errors, and communication details are logged. Use the
Show Logs
parameter to filter the view andOpen Log
/Clear Log
for management.
Further Reading & Resources
Section titled “Further Reading & Resources”- Official MCP Servers: github.com/modelcontextprotocol/servers (Reference implementations for Filesystem, Sequential Thinking, Memory, etc.)
- MCP GitHub Organization: github.com/modelcontextprotocol
- MCP Specification: spec.modelcontextprotocol.io
- NSHipster MCP Overview: nshipster.com/model-context-protocol/
Parameter Reference
Section titled “Parameter Reference”op('mcp').par.Loadconfig
Pulse - Default:
None
op('mcp').par.Configfile
File - Default:
D:/TD-tox/LOPS_tox/GITsync/MCP/config/mcp_servers.json
op('mcp').par.Editconfig
Pulse - Default:
None
op('mcp').par.Disconnect
Pulse - Default:
None
op('mcp').par.Refreshmcp
Pulse - Default:
None
op('mcp').par.Connected
Toggle - Default:
off
op('mcp').par.Numservers
Int - Default:
0
op('mcp').par.Numtools
Int - Default:
0
op('mcp').par.Numresources
Int - Default:
0
op('mcp').par.Numprompts
Int - Default:
0
op('mcp').par.Openlog
Pulse - Default:
None
op('mcp').par.Clearlog
Pulse - Default:
None
op('mcp').par.Launchwebinspector
Pulse - Default:
None
op('mcp').par.Connectinspector
Pulse - Default:
None
op('mcp').par.Connectfileserver
Pulse - Default:
None
op('mcp').par.Filesystemdirectory
Folder - Default:
C:/Users/DotSimulate/Downloads/test_repo/dotBOT
op('mcp').par.Connectiontimeout
Int - Default:
30
op('mcp').par.Tooltimeout
Int - Default:
60
op('mcp').par.Bypass
Toggle - Default:
off
op('mcp').par.Showbuiltin
Toggle - Default:
off
op('mcp').par.Version
Str - Default:
0.0.11
op('mcp').par.Lastupdated
Str - Default:
2025-05-05
op('mcp').par.Creator
Str - Default:
dotsimulate
op('mcp').par.Website
Str - Default:
https://dotsimulate.com
op('mcp').par.Chattd
OP - Default:
/dot_lops/ChatTD