> ## Documentation Index
> Fetch the complete documentation index at: https://link.datarelay.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Use case: AI Server files, Git and jobs

> Reproduce file, Git, stdin, output and stop workflows from either MCP client.

# Control Server files, Git and jobs from Claude or ChatGPT

**Outcome:** create/read/delete a file, commit locally, exchange stdin/EOF, read output and stop a disposable job. First complete [MCP setup](https://link.datarelay.run/guides/mcp-clients.md). This uses **server:self** Server management permission, separately from Agent operations.

## Step 1 — verify the product and MCP connection

Start after [Server installation](https://link.datarelay.run/getting-started/server-installation.md) and [Claude/ChatGPT connection](https://link.datarelay.run/guides/mcp-clients.md). On the Server shell:

```bash theme={null}
sudo drlink system status
sudo drlink system diagnostics mcp
sudo drlink show ai-identities
```

Select DataRelay Link in Claude or ChatGPT and ask:

```text theme={null}
Use DataRelay Link get_server to identify the connected Server.
Do not change files or settings. Show only the Server name and availability.
```

File, Git and process operations use the OS account configured for the product. This tutorial uses /tmp/drlink-mcp-tutorial; substitute your approved workspace if different. command-exec grants that account's command authority; an initial working directory is not a filesystem sandbox.

## Step 2 — verify the dedicated identity and rule

Assume **mcp-lab** is already OAuth-connected; substitute your actual dedicated identity. **Server REPL:**

```text theme={null}
set permission-object mcp-lab-ops permissions host-info,process-read,file-read,file-write,command-exec
set ai-access mcp-lab-server mode whitelist source mcp-lab destination server:self permission mcp-lab-ops paths '/tmp/drlink-mcp-tutorial/**',/tmp enabled
set ai-access enabled
test ai-access source mcp-lab destination server:self permission command-exec path /tmp
test ai-access source mcp-lab destination server:self permission file-read path /tmp/drlink-mcp-tutorial/note.txt
test ai-access source mcp-lab destination server:self permission file-read path /etc/shadow
show ai-access
```

Expect first two policy tests ALLOW, final DENY unless another Rule broadens access. File existence is separate. Upload/download need separately reviewed file-upload/file-download grants.

## Step 3 — file round trip

First confirm the tutorial directory is not used by another task. Create it with the normal product MCP tool. If it already belongs to another workflow, choose a unique name and update the Rule's path as well.

```json theme={null}
{"tool":"server_exec","arguments":{"cwd":"/tmp","command":"mkdir -p /tmp/drlink-mcp-tutorial"}}
```

JSON below describes **MCP tool calls**, not shell commands. Ask either client to use these tools. Pick a unique file if note.txt already exists.

```text theme={null}
Use DRLink MCP get_server to confirm the target first.
Check that /tmp/drlink-mcp-tutorial/note.txt does not exist, then create it
with DRLink MCP tutorial and read it back exactly. Change no other files.
```

```json theme={null}
{"tool":"server_write_file","arguments":{"path":"/tmp/drlink-mcp-tutorial/note.txt","content":"DRLink MCP tutorial"}}
{"tool":"server_read_file","arguments":{"path":"/tmp/drlink-mcp-tutorial/note.txt"}}
```

Decode base64 where indicated by the response schema and compare the original content. Do not report a failed call as a successful file operation.

## Step 4 — disposable local Git

Use the dedicated directory from Step 3, containing only the tutorial note and **not an existing repository**. Initialize only there; add only that note. Do not edit global Git configuration.

```json theme={null}
{"tool":"server_git","arguments":{"cwd":"/tmp/drlink-mcp-tutorial","argv":["git","init"]}}
{"tool":"server_git","arguments":{"cwd":"/tmp/drlink-mcp-tutorial","argv":["git","add","note.txt"]}}
{"tool":"server_git","arguments":{"cwd":"/tmp/drlink-mcp-tutorial","argv":["git","-c","user.name=DRLink Lab","-c","user.email=lab@example.net","commit","-m","Add MCP tutorial note"]}}
{"tool":"server_git","arguments":{"cwd":"/tmp/drlink-mcp-tutorial","argv":["git","log","-1","--oneline"]}}
```

Require completed state, exit\_status=0 and the resulting commit. Remote push additionally needs an approved remote, network access, that OS account's Git credentials and user authorization. MCP OAuth is not GitHub authentication. Choose the intended remote and verify its permissions before pushing.

## Step 5 — asynchronous stdin, EOF and output cursors

```json theme={null}
{"tool":"server_run","arguments":{"cwd":"/tmp/drlink-mcp-tutorial","argv":["python3","-u","-c","import sys; print('READY', flush=True); line=sys.stdin.readline(); print('ECHO:'+line.strip(), flush=True)"],"timeout_seconds":60,"wait_ms":1000}}
```

Inspect **running**, READY and the **job\_id**; send input within 60 seconds. Substitute the actual job ID and stdout.next\_cursor (6 after READY in this example). Use the actual Python path if needed.

```json theme={null}
{"tool":"server_job_input","arguments":{"job_id":"<returned-job-id>","data":"DRLink documentation sample\n","eof":true}}
{"tool":"server_job_poll","arguments":{"job_id":"<returned-job-id>","stdout_cursor":6,"stderr_cursor":0,"wait_ms":1000}}
```

Expect accepted\_bytes=28, input\_closed=true, ECHO:DRLink documentation sample and final exit\_status=0. If still running, continue with new cursors. If timed out, preserve the failure and create a fresh disposable job before retrying.

## Step 6 — stop only your own job and clean up

```json theme={null}
{"tool":"server_exec","arguments":{"cwd":"/tmp/drlink-mcp-tutorial","command":"sleep 30","timeout_seconds":45,"wait_ms":0}}
{"tool":"server_job_stop","arguments":{"job_id":"<sleep-job-id>"}}
{"tool":"server_delete_file","arguments":{"path":"/tmp/drlink-mcp-tutorial/note.txt"}}
```

A stopped job can report completed with a negative signal exit status, distinct from normal exit 0. Stop **only the returned tutorial job**. Let the owning operator review/remove the disposable .git directory; never remove an unrelated repository.

Review `show ai-access-log identity mcp-lab` in Server REPL. Retire the Rule with reviewed `unset ai-access mcp-lab-server` when no longer needed. Do not reset shared AI Access or certificates.

This tutorial targets the Server itself; no Agent enrollment or SSH/RDP Remote Service is required.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.