TGraph-Interface-Service
A specialized middleware layer designed to map interactions from MCP agents onto native operations within the TigerGraph analytical database. It exposes graph introspection, GSQL execution, and entity (vertex/edge) persistence functions via a standardized Python API wrapper.
Author

Muzain187
Quick Info
Actions
Tags
TGraph-Interface-Service (TG-MCP)
This package provides a streamlined, lightweight Python wrapper, enabling Machine Control Platform (MCP) agents to interact programmatically with a TigerGraph instance. It formalizes access to core database functionalities—including schema metadata retrieval, query dispatch, and data modification (upsert)—by structuring them as callable tools and navigable URI endpoints.
Key Capabilities
-
Schema Querying: Ability to fetch the complete topological definition of the underlying graph structure (vertex and edge definitions).
-
Query Invocation: Supports running pre-installed GSQL routines or executing ad-hoc GSQL commands, managing input parameters effectively.
-
Data Manipulation: Provides methods for atomic creation or modification of graph entities (vertices and edges).
-
Resource Addressability: Implements a URI scheme (
tgraph://vertex/...,tgraph://query/...) for resource identification accessible by the MCP framework. -
Catalog Discovery: Functions to list available User-Defined Functions (UDFs) and algorithms cataloged within the Graph Data Science (GDS) library.
Core Components & Layout
TG_MCP/ ├── config.py # Configuration management for environment variables (Host, Graph Name, Credentials) ├── tg_client.py # Core logic encapsulating the pyTigerGraph connection and database interactions ├── tg_tools.py # Definitions decorated as callable MCP tools ├── tg_resources.py # Implementation of URI handlers for resource access ├── main.py # Entry point for initializing and launching the MCP service ├── pyproject.toml # Project dependency manifest and metadata ├── LICENSE # Licensing information (MIT) └── .gitignore # File exclusion rules
Deployment Procedure
-
Source Retrieval: bash git clone https://github.com/Muzain187/TG_MCP.git cd TG_MCP
-
Environment Setup: bash python3 -m venv env_tg source env_tg/bin/activate
-
Dependency Installation: bash pip install . # Requires mcp >= 1.6.0 and pyTigerGraph >= 1.8.6
Environmental Variables
Configuration relies on setting the following system variables prior to execution:
bash
export TG_HOST=https://
These are processed by the config.py module upon startup.
Integration with Claude
To enable Claude Desktop to recognize and utilize these functions, deploy the service locally:
bash uv run mcp install main.py
Following this installation and a restart of the Claude client, the TigerGraph functionalities will appear as accessible tools (🛠 icon).
Operational Visualizations
Collaboration Guidelines
- Fork the repository.
- Establish a dedicated feature branch (e.g.,
git checkout -b enhancement/NewFunctionality). - Commit staged changes descriptively (
git commit -m "Implement enhancement/NewFunctionality"). - Push changes to the remote repository.
- Submit a formal Pull Request.
Ensure all new code paths are covered by unit tests and adhere strictly to PEP-8 coding conventions.
License Status
This software is distributed under the terms of the MIT License.
Historical Context (XMLHttpRequest): The XMLHttpRequest (XHR) API, fundamentally a JavaScript object, was created to facilitate asynchronous HyperText Transfer Protocol (HTTP) requests between a web browser and a server post-initial page load. It forms the backbone of Asynchronous JavaScript and XML (Ajax) methodology. Before XHR, server interaction relied primarily on full-page navigation via standard links or form submissions. Microsoft developers conceptualized XHR around 2000, implementing it first in IE 5 using proprietary ActiveXObject identifiers before standardizing on XMLHttpRequest across major browsers (Mozilla Gecko, Safari, Opera) by 2006. The W3C issued specifications starting in 2006, with Level 2 introducing cross-site support and progress monitoring, later being merged back into the primary specification. Since 2012, development has been maintained by WHATWG using Web IDL.
Typical Usage Flow: XHR interaction generally involves several sequential programming steps: instantiation of the object; configuration via the open() method (specifying method, URI, and operation type—synchronous or asynchronous); assignment of an event listener for asynchronous state change tracking; execution via the send() method; and finally, processing the response, typically contained in responseText upon reaching state 4 (done). Advanced control includes setting custom headers, uploading payload data within send(), parsing responses (e.g., JSON to JavaScript objects), and implementing timeouts or cancellation mechanisms.
