Bot users
Accounts your scripts use to work in Anchor, also known as service accounts.
Building with a bot?
Point your AI agent to this page when it writes code that runs as a bot user.
What is a bot user?
A bot user is an account for code rather than a person: a nightly job, a CI pipeline, a backend service. It belongs to one org. You share files and folders with it just as you would with a teammate, and it sees only what is shared with it or with the whole org. Its script authenticates with an API key, trades it for a short-lived token, and calls the same MCP tools your AI agent uses. A bot can't sign in to Anchor. Whatever it creates goes in a folder a person owns: the only folders it keeps at the top of an org are private temporary ones, for drafting documents and presentations.
Getting started
- As an org owner or manager, open Manage org → Membership → Bots, add a bot and create a key. Copy the key right away: it is shown only once.
- Share the folders the bot should work in with it, from each folder's Share dialog.
- Your script trades the key for a token at
POST https://<host>/api/external/orgs/bots/key-exchange, then calls tools athttps://mcp.<host>/mcpwithAuthorization: Bearer <token>. A token lasts 60 to 3,600 seconds, as asked for; get a new one when it runs out.
<host> is anchor.cc, as in the examples below, or your deployment's
address if you self-host.
Best practice: connect your AI agent to Anchor's MCP while you write the script, so it can list every tool and its exact inputs itself.
Calling each tool
A bot is driven over plain HTTPS, so any language works. Each example below is in
curl, Python, TypeScript, C# and Java: first getting a token, then one call per tool.
Pick a language above any example to show it in every one.
A bot has every tool below. It doesn't have the tools for building apps or for the org's connected
services: build_app and list_mcp_servers. A bot's document can still call
read-only tools on the org's approved MCP servers: ask your own AI agent for the server's id while
you write the script.
Setup
Get a token, then call a tool with it. Every example after this one uses the token it makes. The curl examples also need jq to read the token out of the reply.
# Self-hosting? Use your deployment's address in place of anchor.cc, here and below.
# ANCHOR_BOT_KEY holds the bot's key, put in the environment by your secret manager.
# Trade it for a token that lasts 15 minutes (ttlSeconds: 60 to 3600). The key goes
# in through stdin, so it never shows in the list of running processes.
TOKEN=$(printf '{"key": "%s", "ttlSeconds": 900}' "$ANCHOR_BOT_KEY" |
curl -s https://anchor.cc/api/external/orgs/bots/key-exchange \
-H "Content-Type: application/json" -d @- | jq -er .token)
# Every tool below is a POST to https://mcp.anchor.cc/mcp with this token.
# Its reply is a server-sent event: the JSON is on the line that starts with data:.
# A tool that fails still answers 200, with "isError": true and the reason in its text.
# Self-hosting? Use your deployment's address in place of anchor.cc, here and below.
# Needs the requests package: pip install requests.
import os
import requests
# ANCHOR_BOT_KEY holds the bot's key, put in the environment by your secret manager.
# Trade it for a token that lasts 15 minutes (ttlSeconds: 60 to 3600).
token = requests.post(
"https://anchor.cc/api/external/orgs/bots/key-exchange",
json={"key": os.environ["ANCHOR_BOT_KEY"], "ttlSeconds": 900},
).json()["token"]
# Every tool below is a POST to https://mcp.anchor.cc/mcp with this token.
# Its reply is a server-sent event: the JSON is on the line that starts with data:.
# A tool that fails still answers 200, with "isError": true and the reason in its text.
// Self-hosting? Use your deployment's address in place of anchor.cc, here and below.
// Node 18 or later, run as an ES module (it awaits at the top level).
// ANCHOR_BOT_KEY holds the bot's key, put in the environment by your secret manager.
// Trade it for a token that lasts 15 minutes (ttlSeconds: 60 to 3600).
const exchange = await fetch("https://anchor.cc/api/external/orgs/bots/key-exchange", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ key: process.env.ANCHOR_BOT_KEY, ttlSeconds: 900 }),
});
const { token } = await exchange.json();
// Every tool below is a POST to https://mcp.anchor.cc/mcp with this token.
// Its reply is a server-sent event: the JSON is on the line that starts with data:.
// A tool that fails still answers 200, with "isError": true and the reason in its text.
// Self-hosting? Use your deployment's address in place of anchor.cc, here and below.
// .NET 7 or later, as top-level statements.
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
// ANCHOR_BOT_KEY holds the bot's key, put in the environment by your secret manager.
// Trade it for a token that lasts 15 minutes (ttlSeconds: 60 to 3600).
using var http = new HttpClient();
var exchange = await http.PostAsJsonAsync(
"https://anchor.cc/api/external/orgs/bots/key-exchange",
new { key = Environment.GetEnvironmentVariable("ANCHOR_BOT_KEY"), ttlSeconds = 900 });
var token = (await exchange.Content.ReadFromJsonAsync<JsonElement>()).GetProperty("token").GetString();
// Every tool below is a POST to https://mcp.anchor.cc/mcp with this token.
// Its reply is a server-sent event: the JSON is on the line that starts with data:.
// A tool that fails still answers 200, with "isError": true and the reason in its text.
// Self-hosting? Use your deployment's address in place of anchor.cc, here and below.
// Java 15 or later. The statements go in a main method that throws Exception.
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;
// ANCHOR_BOT_KEY holds the bot's key, put in the environment by your secret manager.
// Trade it for a token that lasts 15 minutes (ttlSeconds: 60 to 3600).
HttpClient http = HttpClient.newHttpClient();
HttpRequest exchange = HttpRequest.newBuilder(URI.create("https://anchor.cc/api/external/orgs/bots/key-exchange"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(
"{\"key\": \"" + System.getenv("ANCHOR_BOT_KEY") + "\", \"ttlSeconds\": 900}"))
.build();
String reply = http.send(exchange, HttpResponse.BodyHandlers.ofString()).body();
// Java has no JSON parser built in: read the token with yours (Jackson, Gson), or as here.
String token = reply.replaceAll(".*\"token\"\\s*:\\s*\"([^\"]+)\".*", "$1");
// Every tool below is a POST to https://mcp.anchor.cc/mcp with this token.
// Its reply is a server-sent event: the JSON is on the line that starts with data:.
// A tool that fails still answers 200, with "isError": true and the reason in its text.
ls
List what is in a folder the bot can see. Pass structured: true to get JSON in structuredContent, so a script needn't parse the default indented text. The JSON holds these fields:
is_completeis false whennumber_of_items, which defaults to 20, left anything out. Raise it untilis_completeis true, because it has no upper limit.omitted_org_countand eachomitted_child_countshow where the gaps are.omitted_org_countis how many orgs an overview left out.itemsholds what was listed. Each has atypeoforg,folderorfile, plusid,name,created_atandupdated_at.- An org or folder also has
child_count,omitted_child_countandchildren. A folder addsparent_folder_idandis_temporary. - A file also has
file_type,parent_folder_id,mime_type,readable_as_text,size_bytes,line_count,version_count,latest_version,is_temporary,appandsource_files.appholdsslugandpublished_versionfor an app, and is null otherwise.source_filesis null unless that file is the target. shared_with_meholdsfolder_count,file_count,child_count,omitted_child_countandchildren. It is null when the target doesn't include it orhide_shared_with_meis on.
# List a folder.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "ls",
"arguments": {"target": {"by": "folder", "folder_id": "FOLDER_ID"}, "structured": true}
}}'
# List a folder.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "ls",
"arguments": {"target": {"by": "folder", "folder_id": "FOLDER_ID"}, "structured": True}
}},
)
print(response.text)
// List a folder.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "ls",
"arguments": {"target": {"by": "folder", "folder_id": "FOLDER_ID"}, "structured": true}
}}),
});
console.log(await response.text());
// List a folder.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "ls",
"arguments": {"target": {"by": "folder", "folder_id": "FOLDER_ID"}, "structured": true}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// List a folder.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "ls",
"arguments": {"target": {"by": "folder", "folder_id": "FOLDER_ID"}, "structured": true}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
mkdir
Create a folder inside another folder. A bot can't create one at the top of an org, except a temporary folder (temporary: true) to stage a document or presentation in before commit_document or commit_presentation.
# Make a folder inside another.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"folder_id": "FOLDER_ID", "name": "Reports"}
}}'
# Make a temporary folder at the top of the org, to stage a document in.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"org_id": "ORG_ID", "name": "Draft", "temporary": true}
}}'
# Make a folder inside another.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"folder_id": "FOLDER_ID", "name": "Reports"}
}},
)
print(response.text)
# Make a temporary folder at the top of the org, to stage a document in.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"org_id": "ORG_ID", "name": "Draft", "temporary": True}
}},
)
print(response.text)
// Make a folder inside another.
let response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"folder_id": "FOLDER_ID", "name": "Reports"}
}}),
});
console.log(await response.text());
// Make a temporary folder at the top of the org, to stage a document in.
response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"org_id": "ORG_ID", "name": "Draft", "temporary": true}
}}),
});
console.log(await response.text());
// Make a folder inside another.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"folder_id": "FOLDER_ID", "name": "Reports"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Make a temporary folder at the top of the org, to stage a document in.
request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"org_id": "ORG_ID", "name": "Draft", "temporary": true}
}}
""", Encoding.UTF8, "application/json");
response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Make a folder inside another.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"folder_id": "FOLDER_ID", "name": "Reports"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
// Make a temporary folder at the top of the org, to stage a document in.
request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mkdir",
"arguments": {"org_id": "ORG_ID", "name": "Draft", "temporary": true}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
write_file
Create a text file (Markdown, HTML, JSON, CSV, …). It takes up to 100 files in one call.
# Write a Markdown file.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "notes.md", "text_content": {"newString": "# Hello"}}
]}
}}'
# Write a Markdown file.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "notes.md", "text_content": {"newString": "# Hello"}}
]}
}},
)
print(response.text)
// Write a Markdown file.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "notes.md", "text_content": {"newString": "# Hello"}}
]}
}}),
});
console.log(await response.text());
// Write a Markdown file.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "notes.md", "text_content": {"newString": "# Hello"}}
]}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Write a Markdown file.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "notes.md", "text_content": {"newString": "# Hello"}}
]}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
read_file
Read a text file's content.
# Read a whole file.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "read_file",
"arguments": {"file_id": "FILE_ID", "start_line": null, "max_lines": null}
}}'
# Read a whole file.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "read_file",
"arguments": {"file_id": "FILE_ID", "start_line": None, "max_lines": None}
}},
)
print(response.text)
// Read a whole file.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "read_file",
"arguments": {"file_id": "FILE_ID", "start_line": null, "max_lines": null}
}}),
});
console.log(await response.text());
// Read a whole file.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "read_file",
"arguments": {"file_id": "FILE_ID", "start_line": null, "max_lines": null}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Read a whole file.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "read_file",
"arguments": {"file_id": "FILE_ID", "start_line": null, "max_lines": null}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
upload_file_presigned_url
Upload any file, binary too: get a URL, PUT the bytes to it, then create the file with write_file. The reply's presigned_urls holds one URL per file; pass count to get several at once, up to 50, and write them all in one write_file call.
# 1. Get a URL to upload to.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "upload_file_presigned_url",
"arguments": {"folder_id": "FOLDER_ID"}
}}'
# 2. PUT the bytes to the URL in the reply's presigned_urls.
curl -s -X PUT --upload-file report.pdf "PRESIGNED_URL"
# 3. Create the file from what you uploaded.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "report.pdf", "presigned_url": "PRESIGNED_URL"}
]}
}}'
# 1. Get a URL to upload to.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "upload_file_presigned_url",
"arguments": {"folder_id": "FOLDER_ID"}
}},
)
print(response.text)
# 2. PUT the bytes to the URL in the reply's presigned_urls.
with open("report.pdf", "rb") as file:
requests.put("PRESIGNED_URL", data=file)
# 3. Create the file from what you uploaded.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "report.pdf", "presigned_url": "PRESIGNED_URL"}
]}
}},
)
print(response.text)
import { readFile } from "node:fs/promises";
// 1. Get a URL to upload to.
let response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "upload_file_presigned_url",
"arguments": {"folder_id": "FOLDER_ID"}
}}),
});
console.log(await response.text());
// 2. PUT the bytes to the URL in the reply's presigned_urls.
await fetch("PRESIGNED_URL", { method: "PUT", body: await readFile("report.pdf") });
// 3. Create the file from what you uploaded.
response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "report.pdf", "presigned_url": "PRESIGNED_URL"}
]}
}}),
});
console.log(await response.text());
// 1. Get a URL to upload to.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "upload_file_presigned_url",
"arguments": {"folder_id": "FOLDER_ID"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// 2. PUT the bytes to the URL in the reply's presigned_urls.
await http.PutAsync("PRESIGNED_URL", new ByteArrayContent(await File.ReadAllBytesAsync("report.pdf")));
// 3. Create the file from what you uploaded.
request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "report.pdf", "presigned_url": "PRESIGNED_URL"}
]}
}}
""", Encoding.UTF8, "application/json");
response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// 1. Get a URL to upload to.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "upload_file_presigned_url",
"arguments": {"folder_id": "FOLDER_ID"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
// 2. PUT the bytes to the URL in the reply's presigned_urls.
http.send(HttpRequest.newBuilder(URI.create("PRESIGNED_URL"))
.PUT(HttpRequest.BodyPublishers.ofFile(Path.of("report.pdf")))
.build(), HttpResponse.BodyHandlers.discarding());
// 3. Create the file from what you uploaded.
request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "write_file",
"arguments": {"writes": [
{"folder_id": "FOLDER_ID", "name": "report.pdf", "presigned_url": "PRESIGNED_URL"}
]}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
download_file_presigned_url
Download a file's bytes: get a URL, then GET it. The URL lasts 15 minutes.
# 1. Get a URL to download from.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "download_file_presigned_url",
"arguments": {"file_id": "FILE_ID"}
}}'
# 2. GET the presigned_url from the reply.
curl -s -o report.pdf "PRESIGNED_URL"
# 1. Get a URL to download from.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "download_file_presigned_url",
"arguments": {"file_id": "FILE_ID"}
}},
)
print(response.text)
# 2. GET the presigned_url from the reply.
with open("report.pdf", "wb") as file:
file.write(requests.get("PRESIGNED_URL").content)
import { writeFile } from "node:fs/promises";
// 1. Get a URL to download from.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "download_file_presigned_url",
"arguments": {"file_id": "FILE_ID"}
}}),
});
console.log(await response.text());
// 2. GET the presigned_url from the reply.
const download = await fetch("PRESIGNED_URL");
await writeFile("report.pdf", Buffer.from(await download.arrayBuffer()));
// 1. Get a URL to download from.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "download_file_presigned_url",
"arguments": {"file_id": "FILE_ID"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// 2. GET the presigned_url from the reply.
await File.WriteAllBytesAsync("report.pdf", await http.GetByteArrayAsync("PRESIGNED_URL"));
// 1. Get a URL to download from.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "download_file_presigned_url",
"arguments": {"file_id": "FILE_ID"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
// 2. GET the presigned_url from the reply.
http.send(HttpRequest.newBuilder(URI.create("PRESIGNED_URL")).build(),
HttpResponse.BodyHandlers.ofFile(Path.of("report.pdf")));
cp
Copy a file into a folder of the same org.
# Copy a file into another folder.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "cp",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}'
# Copy a file into another folder.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "cp",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}},
)
print(response.text)
// Copy a file into another folder.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "cp",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}),
});
console.log(await response.text());
// Copy a file into another folder.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "cp",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Copy a file into another folder.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "cp",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
mv
Move a file into another folder. Pass new_name to rename it.
# Move a file into another folder.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mv",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}'
# Move a file into another folder.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mv",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}},
)
print(response.text)
// Move a file into another folder.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mv",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}),
});
console.log(await response.text());
// Move a file into another folder.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mv",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Move a file into another folder.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "mv",
"arguments": {"file_id": "FILE_ID", "destination_folder_id": "FOLDER_ID"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
rm_file
Delete a file the bot owns, or one in a folder it owns. It can't be undone.
# Delete a file for good.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "rm_file",
"arguments": {"file_id": "FILE_ID"}
}}'
# Delete a file for good.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "rm_file",
"arguments": {"file_id": "FILE_ID"}
}},
)
print(response.text)
// Delete a file for good.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "rm_file",
"arguments": {"file_id": "FILE_ID"}
}}),
});
console.log(await response.text());
// Delete a file for good.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "rm_file",
"arguments": {"file_id": "FILE_ID"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Delete a file for good.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "rm_file",
"arguments": {"file_id": "FILE_ID"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
create_table
Create a table. Its first column is always record_id. The reply has the table's id.
# Create a table with record_id and one text column.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "create_table",
"arguments": {
"folder_id": "FOLDER_ID",
"name": "Run log",
"description": "One row per run",
"columns": [
{"identifier": "record_id", "display_name": "Record ID", "type": "INTEGER", "isUnique": true, "isRequired": true},
{"identifier": "message", "display_name": "Message", "type": "STRING", "isUnique": false, "isRequired": false}
]
}
}}'
# Create a table with record_id and one text column.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "create_table",
"arguments": {
"folder_id": "FOLDER_ID",
"name": "Run log",
"description": "One row per run",
"columns": [
{"identifier": "record_id", "display_name": "Record ID", "type": "INTEGER", "isUnique": True, "isRequired": True},
{"identifier": "message", "display_name": "Message", "type": "STRING", "isUnique": False, "isRequired": False}
]
}
}},
)
print(response.text)
// Create a table with record_id and one text column.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "create_table",
"arguments": {
"folder_id": "FOLDER_ID",
"name": "Run log",
"description": "One row per run",
"columns": [
{"identifier": "record_id", "display_name": "Record ID", "type": "INTEGER", "isUnique": true, "isRequired": true},
{"identifier": "message", "display_name": "Message", "type": "STRING", "isUnique": false, "isRequired": false}
]
}
}}),
});
console.log(await response.text());
// Create a table with record_id and one text column.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "create_table",
"arguments": {
"folder_id": "FOLDER_ID",
"name": "Run log",
"description": "One row per run",
"columns": [
{"identifier": "record_id", "display_name": "Record ID", "type": "INTEGER", "isUnique": true, "isRequired": true},
{"identifier": "message", "display_name": "Message", "type": "STRING", "isUnique": false, "isRequired": false}
]
}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Create a table with record_id and one text column.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "create_table",
"arguments": {
"folder_id": "FOLDER_ID",
"name": "Run log",
"description": "One row per run",
"columns": [
{"identifier": "record_id", "display_name": "Record ID", "type": "INTEGER", "isUnique": true, "isRequired": true},
{"identifier": "message", "display_name": "Message", "type": "STRING", "isUnique": false, "isRequired": false}
]
}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
describe_table
Get a table's columns and row count.
# Show a table's columns and row count.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "describe_table",
"arguments": {"table_id": "TABLE_ID"}
}}'
# Show a table's columns and row count.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "describe_table",
"arguments": {"table_id": "TABLE_ID"}
}},
)
print(response.text)
// Show a table's columns and row count.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "describe_table",
"arguments": {"table_id": "TABLE_ID"}
}}),
});
console.log(await response.text());
// Show a table's columns and row count.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "describe_table",
"arguments": {"table_id": "TABLE_ID"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Show a table's columns and row count.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "describe_table",
"arguments": {"table_id": "TABLE_ID"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
query_table
Run one SELECT, INSERT, UPDATE or DELETE. Name a table by its id in double quotes.
# Add a row. $$started$$ is a Postgres string, so the shell's quotes stay intact.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "INSERT INTO \"TABLE_ID\" (message) VALUES ($$started$$)"}
}}'
# Read the rows.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "SELECT * FROM \"TABLE_ID\""}
}}'
# Add a row.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "INSERT INTO \"TABLE_ID\" (message) VALUES ('started')"}
}},
)
print(response.text)
# Read the rows.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "SELECT * FROM \"TABLE_ID\""}
}},
)
print(response.text)
// Add a row.
let response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "INSERT INTO \"TABLE_ID\" (message) VALUES ('started')"}
}}),
});
console.log(await response.text());
// Read the rows.
response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "SELECT * FROM \"TABLE_ID\""}
}}),
});
console.log(await response.text());
// Add a row.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "INSERT INTO \"TABLE_ID\" (message) VALUES ('started')"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Read the rows.
request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "SELECT * FROM \"TABLE_ID\""}
}}
""", Encoding.UTF8, "application/json");
response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Add a row.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "INSERT INTO \\"TABLE_ID\\" (message) VALUES ('started')"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
// Read the rows.
request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "query_table",
"arguments": {"sql": "SELECT * FROM \\"TABLE_ID\\""}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
add_table_column
Add a column to a table.
# Add a text column.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "add_table_column",
"arguments": {"table_id": "TABLE_ID", "column": {
"identifier": "status", "display_name": "Status", "type": "STRING", "isUnique": false, "isRequired": false
}}
}}'
# Add a text column.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "add_table_column",
"arguments": {"table_id": "TABLE_ID", "column": {
"identifier": "status", "display_name": "Status", "type": "STRING", "isUnique": False, "isRequired": False
}}
}},
)
print(response.text)
// Add a text column.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "add_table_column",
"arguments": {"table_id": "TABLE_ID", "column": {
"identifier": "status", "display_name": "Status", "type": "STRING", "isUnique": false, "isRequired": false
}}
}}),
});
console.log(await response.text());
// Add a text column.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "add_table_column",
"arguments": {"table_id": "TABLE_ID", "column": {
"identifier": "status", "display_name": "Status", "type": "STRING", "isUnique": false, "isRequired": false
}}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Add a text column.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "add_table_column",
"arguments": {"table_id": "TABLE_ID", "column": {
"identifier": "status", "display_name": "Status", "type": "STRING", "isUnique": false, "isRequired": false
}}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
delete_table_column
Delete a column and all its data. It can't be undone.
# Delete a column and its data.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "delete_table_column",
"arguments": {"table_id": "TABLE_ID", "column_identifier": "status"}
}}'
# Delete a column and its data.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "delete_table_column",
"arguments": {"table_id": "TABLE_ID", "column_identifier": "status"}
}},
)
print(response.text)
// Delete a column and its data.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "delete_table_column",
"arguments": {"table_id": "TABLE_ID", "column_identifier": "status"}
}}),
});
console.log(await response.text());
// Delete a column and its data.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "delete_table_column",
"arguments": {"table_id": "TABLE_ID", "column_identifier": "status"}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Delete a column and its data.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "delete_table_column",
"arguments": {"table_id": "TABLE_ID", "column_identifier": "status"}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
unpack_file
Write a document or presentation out as files in a new temporary folder, to edit them with write_file and save a new version. The reply has the folder's id and the base_version to commit with. A bot can't unpack an app.
# Unpack the current version.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "unpack_file",
"arguments": {"file_id": "FILE_ID", "version": null}
}}'
# Unpack the current version.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "unpack_file",
"arguments": {"file_id": "FILE_ID", "version": None}
}},
)
print(response.text)
// Unpack the current version.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "unpack_file",
"arguments": {"file_id": "FILE_ID", "version": null}
}}),
});
console.log(await response.text());
// Unpack the current version.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "unpack_file",
"arguments": {"file_id": "FILE_ID", "version": null}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Unpack the current version.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "unpack_file",
"arguments": {"file_id": "FILE_ID", "version": null}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
commit_document
Save a temporary folder as a new document in a folder. Make the folder with mkdir and temporary: true, then write_file one HTML file per page and a config.json listing them into it. The folder is deleted once the document is saved.
# Save the temporary folder as a new document.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_document",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new", "folder_id": "FOLDER_ID", "name": "Weekly report"},
"release_notes": null
}
}}'
# Save the temporary folder as a new document.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_document",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new", "folder_id": "FOLDER_ID", "name": "Weekly report"},
"release_notes": None
}
}},
)
print(response.text)
// Save the temporary folder as a new document.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_document",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new", "folder_id": "FOLDER_ID", "name": "Weekly report"},
"release_notes": null
}
}}),
});
console.log(await response.text());
// Save the temporary folder as a new document.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_document",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new", "folder_id": "FOLDER_ID", "name": "Weekly report"},
"release_notes": null
}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Save the temporary folder as a new document.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_document",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new", "folder_id": "FOLDER_ID", "name": "Weekly report"},
"release_notes": null
}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
commit_presentation
It does the same for a presentation. This one saves a new version of a presentation you unpacked: pass the folder and the base_version from unpack_file, so the save fails rather than overwrite somebody who edited it meanwhile.
# Save an unpacked presentation as its next version.
curl -s https://mcp.anchor.cc/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_presentation",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new_version", "file_id": "FILE_ID", "base_version": 3},
"release_notes": "Updated by the nightly job"
}
}}'
# Save an unpacked presentation as its next version.
response = requests.post(
"https://mcp.anchor.cc/mcp",
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json, text/event-stream",
},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_presentation",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new_version", "file_id": "FILE_ID", "base_version": 3},
"release_notes": "Updated by the nightly job"
}
}},
)
print(response.text)
// Save an unpacked presentation as its next version.
const response = await fetch("https://mcp.anchor.cc/mcp", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json, text/event-stream",
},
body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_presentation",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new_version", "file_id": "FILE_ID", "base_version": 3},
"release_notes": "Updated by the nightly job"
}
}}),
});
console.log(await response.text());
// Save an unpacked presentation as its next version.
var request = new HttpRequestMessage(HttpMethod.Post, "https://mcp.anchor.cc/mcp");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.ParseAdd("application/json, text/event-stream");
request.Content = new StringContent("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_presentation",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new_version", "file_id": "FILE_ID", "base_version": 3},
"release_notes": "Updated by the nightly job"
}
}}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Save an unpacked presentation as its next version.
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcp.anchor.cc/mcp"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.POST(HttpRequest.BodyPublishers.ofString("""
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {
"name": "commit_presentation",
"arguments": {
"temporary_folder_id": "TEMPORARY_FOLDER_ID",
"target": {"as": "new_version", "file_id": "FILE_ID", "base_version": 3},
"release_notes": "Updated by the nightly job"
}
}}
"""))
.build();
System.out.println(http.send(request, HttpResponse.BodyHandlers.ofString()).body());
Security best practices
A bot key works from anywhere until it expires or is deleted, so treat it like a password.
- Never expose a key in client code. No browser, mobile app or anything you ship to users: keys run only on servers you control.
- Never commit a key to source control or GitHub, not even to a private repo.
- Never write a key to disk. No config files,
.envfiles or logs. - Keep it in a secret manager (AWS Secrets Manager, Google Secret Manager, Vault, GitHub Actions secrets) and hand it to the script as an environment variable, in memory.
- One key per script or environment, so you can delete one without stopping the rest. Give each an expiry, and rotate by adding the new key before deleting the old one.
- Ask for the shortest token that covers the run, and keep tokens in memory too.
- Share only what the bot needs, and as a viewer when it only reads.
- If a key leaks, delete it under Manage org → Membership → Bots. Its tokens stop working at once.
IP allowlisting
For enterprise customers, we can limit key exchange and other endpoints to the IP addresses you choose, so a key works only from your own network: an extra layer of network security on top of the key itself. This isn't available on the Free and Pro plans. Contact us to set it up.
Changes & announcements
The Anchor team may change these endpoints and tools, which can break a bot's script. If your organization has bots, we email its owners and managers about each change before it ships. Questions? Email support@anchor.cc.