# Theta MCP

> Theta MCP Server lets your agent manage decentralized infrastructure directly. You can query blockchain data—check account balances with `rpc_get_account` or fetch block hashes using `rpc_get_block`. It also handles EdgeCloud AI deployment (create, stop, list) and manages the full video pipeline: generating URLs via `video_create_upload_url`, transcoding assets, and orchestrating livestreams.

## Overview
- **Category:** image-video
- **Price:** Free
- **Tags:** theta-network, edge-computing, web3, decentralized-video, gpu-rendering

## Description

This server gives your agent direct command over decentralized infrastructure—everything from managing AI deployments on EdgeCloud to running full video pipelines and submitting blockchain transactions. You don't need a dedicated terminal; your agent handles it all.

**AI Model Deployments:**
Your agent can manage the entire lifecycle of AI models using tools like `ai_list_standard_templates` to see what built-in templates are ready for use, or `ai_list_deployments` to check every current and past deployment associated with your project. Need a new environment? You'll launch it by calling `ai_create_deployment` for a fresh AI model or Jupyter Notebook setup. When you're done with the compute cycle, you can shut down resources using `ai_stop_deployment` to save cash, or delete the entire deployment via `ai_delete_deployment`. If a GPU Node gets stopped, you can bring it back online and ready for work by running `ai_start_deployment`; you'll also check available hardware types using `ai_list_vm_resources`.

**Blockchain Operations:**
Your agent lets you read the whole ledger. You can fetch detailed status and balances for any specific Theta account address with `rpc_get_account`. To track network movement, you can get finalized details for any block at a specific height using `rpc_get_block_by_height`, or pull complete data using a unique hash identifier via `rpc_get_block`. For real-time monitoring, check the mempool contents to see all transactions waiting confirmation with `rpc_get_pending_transactions`, and drill down on specific events by getting transaction details with `rpc_get_transaction` using its unique hash. The network also gives you basic info like the current version number of the blockchain software running via `rpc_get_version`. 

For sending money or data, your agent handles transactions securely. You'll list all local account addresses managed by the Theta CLI integration with `cli_list_keys` and create a new, encrypted key locally using `cli_new_key`. If you need to pause an account for safety, use `cli_lock_key`; when it’s clear everything is safe, run `cli_unlock_key` on that specific account. You can send both Theta or TFuel tokens from an active local account with `cli_send`. For broadcasting raw transactions, you've got two options: submit a signed data payload immediately and wait for confirmation using `rpc_broadcast_raw_transaction`, or use `rpc_broadcast_raw_transaction_async` to send the data without forcing your agent to wait.

**Key Management:**
Beyond just sending tokens, you manage key security directly. You'll list all local account addresses with `cli_list_keys`; create a new encrypted account using `cli_new_key`; lock an existing account with `cli_lock_key` until it's safe to proceed; and unlock that account again when transactions are ready via `cli_unlock_key`.

**Video Media Pipeline:**
Your agent manages the entire media workflow. You can start by listing all videos tied to your service account using `video_list`, or search your entire library for specific assets based on metadata like date or tags, which you do with `video_search`. Before a big upload, generate a unique, temporary URL using `video_create_upload_url`; this is where external clients can securely drop large video files. To process raw media, call `video_transcode` to convert files into multiple formats—say, 1080p MP4—for distribution. For live content, you'll first set up a new stream object using `video_create_livestream`, then assign an Edge Ingestor service using `video_select_ingestor`; remember to release that capacity later with `video_unselect_ingestor`. You can retrieve the metadata and status for any video asset or stream by running `video_get`, while checking available processing services with `video_list_ingestors`.

## Tools

### ai_create_deployment
Launches a new AI model or Jupyter Notebook environment on EdgeCloud.

### ai_delete_deployment
Terminates an existing AI deployment, cleaning up resources.

### ai_list_deployments
Retrieves a list of all current and past deployments associated with the project.

### ai_list_standard_templates
Shows the built-in, pre-configured AI templates available for use.

### ai_list_vm_resources
Lists all machine types and GPU resources currently available on the EdgeCloud.

### ai_start_deployment
Restarts a GPU Node that has been stopped, bringing it back online for work.

### ai_stop_deployment
Shuts down a running GPU Node to save costs and free up resources.

### cli_list_keys
Outputs all local account addresses managed by the Theta CLI integration.

### cli_lock_key
Locks local accounts, preventing them from sending transactions until explicitly unlocked.

### cli_new_key
Creates a new, encrypted account locally for secure key management.

### cli_send
Sends Theta or TFuel tokens from an active local account.

### cli_unlock_key
Unlocks a specified local account, allowing it to send transactions again.

### rpc_get_account
Fetches detailed information and balance status for a specific Theta account address.

### rpc_get_block_by_height
Gets finalized details for any block at a specific, given height number on the chain.

### rpc_get_block
Retrieves the complete details of a block using its unique hash identifier.

### rpc_broadcast_raw_transaction_async
Submits a signed transaction data payload asynchronously, allowing your agent to continue other work.

### rpc_broadcast_raw_transaction
Submits a signed transaction data payload to the network immediately and waits for confirmation.

### rpc_call_smart_contract
Simulates executing code within a smart contract environment locally before deploying it on-chain.

### rpc_get_pending_transactions
Checks the mempool to retrieve a list of transactions waiting to be confirmed by miners.

### rpc_get_transaction
Pulls specific transaction details using its unique hash, confirming what happened.

### rpc_get_version
Returns the current version number of the Theta blockchain software running on the network.

### video_create_livestream
Sets up a new live stream object that tracks video content and metadata.

### video_create_upload_url
Generates a unique, temporary URL where external clients can upload large video files securely.

### video_get
Retrieves the metadata and status details for a specific video asset or stream.

### video_list_ingestors
Provides a list of available Edge Ingestor services that can handle video uploads.

### video_list
Lists all videos associated with your service account within the Theta media platform.

### video_search
Searches the entire video library using specific metadata filters (e.g., date, tags).

### video_select_ingestor
Assigns a specific Edge Ingestor service to manage and process an active stream.

### video_transcode
Processes raw video files, converting them into various formats (e.g., 1080p MP4) for distribution.

### video_unselect_ingestor
Releases an assigned Edge Ingestor service from a stream, freeing up capacity.

## Prompt Examples

**Prompt:** 
```
What is the current version of the Theta blockchain software?
```

**Response:** 
```
I've checked the network status. The current Theta blockchain version is v4.2.0.
```

**Prompt:** 
```
List all available VM resources for AI deployments on EdgeCloud.
```

**Response:** 
```
I've retrieved the available VM resources. You have access to several tiers including 'Small' (2 vCPU, 4GB RAM) and 'GPU-Medium' (NVIDIA T4, 16GB RAM).
```

**Prompt:** 
```
Show me the details for block height 25000000.
```

**Response:** 
```
Fetching block 25000000... The block hash is 0xabc... and it contains 12 transactions. It was finalized at timestamp 1712345678.
```

## Capabilities

### Manage AI Model Deployments
Create, list, start, or delete full-stack AI deployments on the EdgeCloud.

### Query Blockchain Status
Get specific block details by hash or height, and check pending transactions in the mempool.

### Send Transactions
Lock/unlock local accounts and submit signed Theta/TFuel transactions synchronously or asynchronously.

### Process Video Assets
Generate secure upload links, transcode raw videos, and manage live streaming objects.

### List Network Resources
Check available VM resource types or list all existing AI deployments in a project.

## Use Cases

### Checking a Smart Contract Before Deployment
A dev finds an old contract address. Instead of guessing if the code is valid or if the gas limits are right, they tell their agent to run `rpc_call_smart_contract` with sample inputs. The agent simulates the execution locally, giving them immediate feedback on expected state changes before they commit to a live deployment.

### Handling Live Video Ingestion
A content team is going live. They don't want manual steps. Their agent first calls `video_create_upload_url` for the raw stream, then uses `video_select_ingestor` to assign a worker service, and finally monitors status with `video_get`. The entire process runs without human intervention.

### Monitoring Network Health Post-Incident
After an outage, the ops engineer needs to know what's stuck. They ask their agent for a list of pending transactions (`rpc_get_pending_transactions`) and then cross-reference those hashes by calling `rpc_get_transaction` until they find the missing data point.

### Quickly Scaling AI Testing
A team needs to test a new model on high-end hardware. The agent first checks capacity using `ai_list_vm_resources`. Once confirmed, it runs `ai_create_deployment` for the required GPU size, then waits until the node is ready to start testing.

## Benefits

- Blockchain queries are instant. Instead of opening a separate RPC client, you use `rpc_get_block` or `rpc_get_pending_transactions` directly in conversation to get real-time network status.
- AI resource scaling is controlled via code. You can list templates with `ai_list_standard_templates` and then immediately launch a new environment using `ai_create_deployment`, all without leaving your agent's chat interface.
- Video workflows become fully automated. When content arrives, the agent uses `video_create_upload_url` for ingestion, followed by `video_transcode` to get it ready for any platform.
- Key management is secure and simple. You can list local keys with `cli_list_keys` and use `cli_unlock_key` when you're ready to execute a financial transaction via `cli_send`.
- Node state changes are direct commands. Need to pause costs? Use `ai_stop_deployment`. Need it back? Call `ai_start_deployment`. It’s simple, immediate control over your GPU resources.

## How It Works

The bottom line is that your AI client uses these tools as functions it can call directly, letting you interact with complex systems like blockchain networks without writing boilerplate code.

1. First, subscribe to the Theta server and give your agent the necessary credentials (RPC URL, EdgeCloud/Video API keys).
2. Then, tell your AI client what you need—for example: 'List all available VM resources for a new deployment.'
3. The agent executes the relevant tool (`ai_list_vm_resources`), gets the data back, and reports it to you in plain English.

## Frequently Asked Questions

**How do I check the current network health using rpc_get_version?**
You run `rpc_get_version` to get the exact software version. This is useful for ensuring your client tools are compatible with what's running on the Theta blockchain.

**What’s the difference between cli_send and rpc_broadcast_raw_transaction?**
`cli_send` handles the full process: it checks if your key is unlocked (`cli_unlock_key`) and then sends the tokens for you. `rpc_broadcast_raw_transaction` requires you to manually prepare a signed transaction payload.

**How can I list available GPU resources with ai_list_vm_resources?**
Just prompt your agent to 'List VM resources.' The tool runs `ai_list_vm_resources` and returns specific hardware details, like the NVIDIA T4 type and available RAM/vCPU counts.

**Can I search videos using video_search?**
Yes. You pass metadata filters—like a date range or a specific tag—to `video_search`. It finds matching assets across your entire service account's library instantly.

**How do I manage key security after running cli_new_key?**
The system generates a new encrypted account and returns your private seed phrase. You must copy this phrase immediately and store it offline in a secure location. Never share or input this phrase into an online tool.

**What is the proper sequence when I use video_create_upload_url followed by video_transcode?**
First, you generate the upload URL and push your raw asset to that endpoint. Once the ingestion confirms receipt, you call `video_transcode` with the resulting video ID. Transcoding then processes the file into multiple formats.

**If I run ai_stop_deployment on a node that is already stopped, will it cause an error?**
No. The tool checks the current state first and simply confirms the deployment is inactive. You can safely use `ai_stop_deployment` regardless of the node's current status to ensure the command executes cleanly.

**How do I check if a signed transaction is pending confirmation using rpc_get_pending_transactions?**
This tool returns a list of all transactions currently in the mempool. You can filter this data by your specific account address or transaction hash to see if it's waiting for block inclusion.

**How can I check the balance and sequence of a specific Theta wallet?**
Use the `rpc_get_account` tool by providing the wallet address (0x...). The agent will return the coin balances and the current sequence number for that account.

**Can I manage AI model deployments on Theta EdgeCloud?**
Yes. You can use `ai_list_deployments` to see active ones, and `ai_create_deployment` or `ai_stop_deployment` to control your AI infrastructure resources.

**How do I search for existing video assets in my Theta library?**
Simply use the `video_search` tool. You can provide a query string to filter through your uploaded and transcoded video content.