mcp-telegram: Instructions file for Codex

AGENTS.md

mcp-telegram AGENTS.md is an instructions file for Codex, OpenCode from tolmachov/mcp-telegram. It costs 1,302 tokens per session, scanned A, original, MIT.

A set of instructions for working on a Go server that connects coding agents to Telegram. Telegram is a messaging service; this server mainly searches, extracts, loads context from, and summarises Telegram content.

In plain words
What is it for?
It helps maintain the Telegram connection, add or update tools, handle local or HTTP access, and work with message research and summaries.
Why use it?
It gives an agent the project layout, commands, login details, and rules for adding tools, so the agent can work in the repository without guessing.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

This is tolmachov/mcp-telegram's own configuration. It tells Codex and OpenCode how to work on mcp-telegram itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mcp-telegram configures →

Reuse

Borrowing it

Nothing to install: this file belongs to tolmachov/mcp-telegram. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tolmachov/mcp-telegram/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/tolmachov/mcp-telegram

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mcp-telegram AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/tolmachov/mcp-telegram/agents-md/github.svg)](https://agentmods.dev/instructions/tolmachov/mcp-telegram/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/tolmachov/mcp-telegram/agents-md"><img src="https://agentmods.dev/badge/instructions/tolmachov/mcp-telegram/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mcp-telegram AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/tolmachov/mcp-telegram/agents-md"><img src="https://agentmods.dev/badge/instructions/tolmachov/mcp-telegram/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,302 This file is loaded in full into every session.
When invoked 1,302 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01302 $0.01302
Opus 5.5 $0.00521 $0.00521
Sonnet 5 $0.00260 $0.00260
Haiku 4.5 $0.00130 $0.00130

Measured yesterday against content hash d2134035de57, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-26, from the pricing page.

Security

Grade A, and why

mcp-telegram AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

Guidance for coding agents working in this repository. User-facing docs live in README.md; this file only covers what isn't obvious from the code.

What this is

A Go MCP server for Telegram, built on gotd/td. It is primarily a read-heavy research/summarisation assistant (search, extraction, context loading); admin and posting features are secondary. Two transports:

  • stdio — single local account;
  • streamable HTTP — embedded OAuth 2.1 server, per-user QR login, multi-user, deployable to Cloud Run (deploy/).

Layout

  • main.go → internal/app.go — CLI entry (run, login, logout, config).
  • internal/tools — MCP tools, one file per tool (Handler with Register).
  • internal/tgdata, internal/messages — Telegram data access and message formatting shared by tools.
  • internal/server, internal/authsrv — HTTP transport and OAuth.
  • internal/tgclient, internal/sessionstore, internal/secret, internal/config — Telegram client and credential/session storage: macOS Keychain on darwin, file store in *_other.go (//go:build !darwin).
  • internal/keyring — the MCP_AUTH_TOKEN_KEYS master keys shared by the token sealer and the session cipher; internal/keyedlimit — per-key token-bucket limiter (auth endpoints, user pool); internal/xdg — state directory, atomic file writes and the file-backed gotd session.
  • internal/tgid, internal/presentation, internal/logging, internal/flags — shared id type, MCP-facing formats, the slog handler, CLI flags.
  • internal/summarize, internal/prompts, internal/resources, internal/completion.
  • internal/testutil/telegram — the scripted Telegram RPC fake for tests.
  • test/ — integration tests (build tag integration).

Adding a tool

  1. New file in internal/tools: an input struct (descriptions go in jsonschema tags; closed value sets via inputSchemaWithEnums) and a Register method.
  2. Register with tools.AddTool — never plain mcp.AddTool: it keeps error results from reaching the client as an empty structured output. Use tools.AddContentTool only for tools with no typed output (e.g. GetMedia).
  3. A tool that takes a chat ID takes the assembly's *tgclient.Resolver and wraps the RPC that uses the peer in tgclient.WithPeer (WithPeers, WithPeersFrom for several or for @usernames mixed with IDs): that is where a stale access hash is dropped from the cache and the call retried.
  4. Return ErrResult only for input validation. Return every other failure as the handler's Go error via failed(op, err) / failedHint: the registration helpers classify it (dead session, a stopped client, flood wait, a problem with the chat named — tgclient.IsPeerSpecific), render the text the model sees and log it under the tool's name. They also give the call its flood-wait budget (tgclient.WithWaitBudget). A call that got part of its work done is no failure: its output embeds partialOutcome and says what it lacks with warn / warnCause, which AddTool flags for the request log.
  5. Add the handler to buildHandlers in internal/server/server.go: research for read-only tools, mutating for anything that changes state. The split drives the server variants (see README "Server Variants").
  6. Make the first sentence of Description self-contained: the compact and research variants keep only that sentence.
  7. Update the tool list and tool counts in README.md.

Read the full file on GitHub · 97 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · +24 lines · +455 tokens per session d2134035de57
  2. 6d ago First seen · 73 lines · 847 tokens per session scan A d4aca3efaa8a

Subscribe to this mod's changes

mcp-telegram AGENTS.md is an instructions file published in the GitHub repository tolmachov/mcp-telegram (0 stars, last pushed yesterday), licensed MIT. It adds 1,302 tokens to every session, about $0.0052 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-20.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,406 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 6,985 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,980 tokens