atproto—crates

Tl.

An MCP server for the AT Protocol · 0.15.0 · MIT

atpmcp

atpmcp gives an AI assistant thirteen tools for working with the AT Protocol. It resolves identities, fetches records and lexicons, computes CIDs, validates requests, moves blobs, and calls XRPC methods as your account. It runs on your machine over stdio, and starts and stops with the assistant that uses it.

Your client needs MCP 2026-07-28

atpmcp 0.15.0 speaks MCP 2026-07-28 and no earlier revision. That revision dropped the initialize handshake, so every request carries its own protocol version. A client on an older revision gets an error that names the version it needs.

If your client hasn't moved to 2026-07-28 yet, install atpmcp 0.14.5. A requirement of "0.15" resolves to 0.15.0, so pin =0.14.5.

§ 01

Install

Homebrew has builds for macOS and Linux on arm64 and amd64. Cargo builds it from crates.io with the toolchain the workspace pins, Rust 1.97 or later.

Install from the Homebrew tap, or from crates.ioListing 1
brew tap ngerakines/tap
brew install atpmcp

# or
cargo install atpmcp --version 0.15.0

§ 02

Connect a client

The client starts atpmcp as a child process and talks to it over stdin and stdout. In Claude Code, one command adds it.

Claude CodeListing 2
claude mcp add atpmcp -- atpmcp

Other clients take a server entry like this one. Use the full path to the binary if the client doesn't start with your shell's PATH.

An MCP server entryListing 3
{
  "mcpServers": {
    "atpmcp": {
      "command": "/opt/homebrew/bin/atpmcp"
    }
  }
}

§ 03

Sign in

Reads work without an account. invoke_xrpc and upload_blob need one, and so does generate_bsky_post when it uploads a thumbnail or images. Log in once with an app password. Sessions refresh on their own, and the new tokens are written back to the store.

Store an accountListing 4
atpmcp login alice.bsky.social

atpmcp and atpxrpc share one account store, so logging in with either one works for both. The store keeps each account's app password, access token, and refresh token in plain text. On Unix it's written with mode 0600, and a failure to set that mode is an error. On Windows the file is as private as its directory. Delete the file to remove a machine's copy.

PlatformDefault location
Linux~/.config/atpxrpc/config.json
macOS~/Library/Application Support/atpxrpc/config.json
Windows%APPDATA%\atpxrpc\config.json

ATPXRPC_CONFIG moves it. atpmcp login prints the path it used when it finishes, which is the reliable way to find it.

§ 04

The thirteen tools

Every tool carries MCP annotations, so a client can tell which ones write and ask you first. Three write. Only invoke_xrpc is marked destructive, because it calls whatever method it's given, deletes and overwrites included.

ToolWritesNetworkWhat it does
create_record_cidNoNoComputes the DAG-CBOR CID of a JSON record
validate_lexicon_schemaNoNoChecks a lexicon schema document
generate_tidNoNoGenerates timestamp identifiers, now or from a time you give it
resolve_handle_to_didNoYesResolves a handle and checks that the DID claims it back
resolve_identityNoYesFetches a full DID document
parse_facetsNoYesFinds mentions, links, and hashtags with byte offsets, and resolves mentions to DIDs
get_recordNoYesFetches a record by AT-URI
get_lexiconNoYesFetches a lexicon schema by NSID
validate_xrpcNoYesChecks XRPC parameters and a body against a method's lexicon
download_blobNoYesFetches a blob, checks it against its CID, and saves it to the cache
generate_bsky_postUploads onlyYesBuilds and validates a Bluesky post with facets and an optional link card or images. It doesn't publish the post.
upload_blobYesYesUploads bytes to your PDS
invoke_xrpcYes, can deleteYesCalls any XRPC method as a query or a procedure

§ 05

Example prompts

Each listing shows a prompt, the tool call it led to, and what the tool returned. The read-only ones were run against the live network with atpmcp 0.15.0 on 2026-12-01. Long results are trimmed where marked.

Resolve a handle

resolve_handle_to_didListing 5
> What DID does ngerakines.me point at? Make sure it's really theirs.

resolve_handle_to_did  handle: "ngerakines.me"
{"did":"did:plc:cbkjy5n7bk3ax2wplmtjofq2","handle":"ngerakines.me","verified":true}

verified is true when the DID document lists the handle in its alsoKnownAs. Anyone who controls a domain can point it at any DID, so treat the pair as one account only when it's true.

Read a DID document

resolve_identity, trimmedListing 6
> Which PDS hosts did:plc:cbkjy5n7bk3ax2wplmtjofq2, and what other names does it go by?

resolve_identity  did: "did:plc:cbkjy5n7bk3ax2wplmtjofq2"
{
  "id": "did:plc:cbkjy5n7bk3ax2wplmtjofq2",
  "alsoKnownAs": ["at://ngerakines.me", "at://nick.gerakines.net", "at://nick.thegem.city",
                  "https://github.com/ngerakines", "https://ngerakines.me/", "dns:ngerakines.me"],
  "service": [{"id": "#atproto_pds", "type": "AtprotoPersonalDataServer",
               "serviceEndpoint": "https://vesuvius.pyroclastic.cloud"}],
  ...
}

Fetch a record

get_record, trimmedListing 7
> Show me the post at at://did:plc:cbkjy5n7bk3ax2wplmtjofq2/app.bsky.feed.post/3mgn37sytoc2c

get_record  uri: "at://did:plc:cbkjy5n7bk3ax2wplmtjofq2/app.bsky.feed.post/3mgn37sytoc2c"
{
  "$type": "app.bsky.feed.post",
  "createdAt": "2026-03-09T14:34:06.694Z",
  "text": "atpmcp is a local MCP server that is part of the atproto-crates project. ...",
  "embed": {"$type": "app.bsky.embed.external",
            "external": {"title": "atpmcp", "uri": "https://ngerakines.me/atpmcp.html", ...}},
  ...
}

Compute a CID

create_record_cidListing 8
> What's the CID of {"$type": "app.bsky.feed.post", "text": "Hello world", "createdAt": "2024-01-01T00:00:00Z"}?

create_record_cid  record: {"$type":"app.bsky.feed.post","text":"Hello world","createdAt":"2024-01-01T00:00:00Z"}
bafyreigdbtyg3kz4i3ci4zaym5uphiixi5dwca7ddfop2xlvx3m7rpjzxe

Make record keys

generate_tidListing 9
> Give me three TIDs I can use as record keys.

generate_tid  count: 3
3n3medlj2urxk
3n3medlj2v2oz
3n3medlj2v2p2

Find the facets in a post

parse_facetsListing 10
> Parse the facets in: Reading @ngerakines.me's notes on https://atproto-crates.com #atdev

parse_facets  text: "Reading @ngerakines.me's notes on https://atproto-crates.com #atdev"
[{"index":{"byteStart":8,"byteEnd":22},
  "features":[{"$type":"app.bsky.richtext.facet#mention","did":"did:plc:cbkjy5n7bk3ax2wplmtjofq2"}]},
 {"index":{"byteStart":34,"byteEnd":60},
  "features":[{"$type":"app.bsky.richtext.facet#link","uri":"https://atproto-crates.com"}]},
 {"index":{"byteStart":61,"byteEnd":67},
  "features":[{"$type":"app.bsky.richtext.facet#tag","tag":"atdev"}]}]

The offsets count UTF-8 bytes, not characters, which is what the facet lexicon asks for.

Read a lexicon before writing a record

get_lexiconListing 11
> What fields does a community.lexicon.bookmarks.bookmark record need?

get_lexicon  nsid: "community.lexicon.bookmarks.bookmark"
{"id":"community.lexicon.bookmarks.bookmark","lexicon":1,
 "defs":{"main":{"type":"record","key":"tid",
   "description":"Record bookmarking a link to come back to later.",
   "record":{"type":"object","required":["subject","createdAt"],
     "properties":{"subject":{"type":"string","format":"uri"},
                   "createdAt":{"type":"string","format":"datetime"},
                   "tags":{"type":"array","items":{"type":"string"}, ...}}}}}}

Catch a bad request before sending it

validate_xrpcListing 12
> Check com.atproto.identity.resolveHandle with an empty handle before I call it.

validate_xrpc  nsid: "com.atproto.identity.resolveHandle"  params: {"handle": ""}
error-atpmcp-tool-9 XRPC validation failed: params: error-atproto-lexicon-data-validation-18
Invalid handle format for '': handle cannot be empty

Draft a Bluesky post

generate_bsky_postListing 13
> Draft a post that says atpmcp has a new home at https://atproto-crates.com/tools/atpmcp/,
  with the link shortened the way the Bluesky app shows it. Don't post it.

generate_bsky_post  text: "atpmcp has a new home: https://atproto-crates.com/tools/atpmcp/"  shorten_links: true
{"record":{"$type":"app.bsky.feed.post","langs":["en"],
  "text":"atpmcp has a new home: atproto-crates.com/tools/atpmcp/",
  "facets":[{"index":{"byteStart":23,"byteEnd":55},
    "features":[{"$type":"app.bsky.richtext.facet#link","uri":"https://atproto-crates.com/tools/atpmcp/"}]}],
  "createdAt":"2026-12-01T13:33:41.599Z"},
 "notes":[]}

The record comes back checked against the post lexicon and ready to publish. With embed_external and an auth_handle, the page's image is uploaded as the link card's thumbnail, with its EXIF and other metadata removed.

Publish it

invoke_xrpc, a writeListing 14
> Post that as alice.bsky.social.

invoke_xrpc  nsid: "com.atproto.repo.createRecord"  auth_handle: "alice.bsky.social"
             body: {"repo":"alice.bsky.social","collection":"app.bsky.feed.post","record":{...}}

This one writes, so it isn't run here. Your client should ask before it runs, and the answer is the new record's AT-URI and CID. Other prompts that write follow the same shape: "upload this image to my PDS" calls upload_blob, and "delete that post" calls invoke_xrpc with com.atproto.repo.deleteRecord.

§ 06

Blobs

Blobs are also resources, at atpmcp://public/blob/{did}/{cid}. Reading one resolves the DID to its PDS, fetches the bytes, checks them against the CID, and caches them. The check matters because the PDS address comes from the DID's own document. A hostile host can refuse or stall, and it can't swap the content.

A 16 MiB blob is about 22 MB of base64, which is far too much for a model's context. So download_blob saves the blob to the cache and returns its path and a resource link. Returning the bytes inline is opt-in, and capped at 256 KiB. An image under the cap comes back as image content.

§ 07

Configuration

Everything is an environment variable, set where the client starts the server. A value that doesn't parse stops the server at startup with an error that names the variable. A client usually hides a server's stderr, so running on a default you didn't choose would go unnoticed.

VariableDefaultWhat it sets
PLC_HOSTNAMEplc.directoryThe PLC directory for every did:plc lookup. A bare hostname means HTTPS. A value with a scheme is used as written.
DNS_NAMESERVERSThe system'sNameservers for handle lookups, separated by ;
ATPMCP_BLOB_CACHE_DIRPlatform cache directoryWhere verified blobs are kept
ATPMCP_BLOB_CACHE_MAX_BYTES536870912Cache ceiling, 512 MiB. 0 turns the cache off and clears it.
ATPMCP_BLOB_MAX_UPLOAD_BYTES16777216Largest blob sent to a PDS
ATPMCP_BLOB_MAX_DOWNLOAD_BYTES16777216Largest blob fetched from a repository
ATPMCP_BLOB_MAX_INLINE_BYTES262144Largest blob returned as base64. 0 means never.
ATPMCP_ALLOW_INSECURE_ENDPOINTSOffLifts the host policy for local development. See below.
ATPMCP_PRESERVE_EXIFOffKeeps image metadata on uploaded thumbnails and images
ATPMCP_MAX_MESSAGE_BYTES33554432Largest inbound message
ATPMCP_MAX_CONCURRENT_REQUESTS16Requests handled at once
ATPMCP_MAX_QUEUED_REQUESTS1024Requests accepted and waiting
ATPXRPC_CONFIGSee § 03The account store shared with atpxrpc

§ 08

Hosts a prompt can name

download_blob and invoke_xrpc take an endpoint, and the identity tools take a plc_directory_hostname. The caller is a model, so an unchecked host would let a prompt reach anything on your network. Each one has to be HTTPS on the default port, with a public DNS name, no address literal, and no credentials in the URL. Names that resolve only to loopback, private, or link-local addresses are refused when the connection is made.

That also refuses http://127.0.0.1:4800, where the workspace's own PDS listens. Set ATPMCP_ALLOW_INSECURE_ENDPOINTS=1 to develop against one. It's an environment variable on purpose, so the person running the server can widen the policy and a prompt can't. It never covers an endpoint read from a DID document during a tool call.