talk-to-girlfriend-ai
CLAUDE.md546 starsChanged 20 months agoApache-2.0View on GitHub
Telegram MCP Server - a full-featured Telegram integration for Claude, Cursor, and MCP-compatible clients. Uses Telethon for Telegram API access and exposes 60+ tools via the Model Context Protocol. Required in .env: - TELEGRAM_API_ID - from my.telegram.org/apps - TELEGRAM_API_HASH - from my.telegram.org/apps - TELEGRAM_SESSION_STRING (preferred) or TELEGRAM_SESSION_NAME (file-based) For TypeScript agent: - AI_GATEWAY_API_KEY - Vercel AI Gateway key - NIA_API_KEY - Nia API key - TELEGRAM_API_URL - HTTP bridge URL (default: http://localhost:8765)
- Reads credentials
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 65
All functions accept flexible ID formats:
- Very specific: line 74
Use Union[int, str] for ID parameters
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Telegram MCP Server - a full-featured Telegram integration for Claude, Cursor, and MCP-compatible clients. Uses Telethon for Telegram API access and exposes 60+ tools via the Model Context Protocol.
Commands
MCP Server (Python)
# Install dependencies
uv sync
# Run the MCP server
uv run main.py
# Generate Telegram session string
uv run session_string_generator.py
# Format code
black .
# Lint code
flake8 .Run Tests
# Run validation tests
pytest test_validation.py -vTypeScript Agent (in agent/)
cd agent
bun install
bun run devDocker
docker build -t telegram-mcp:latest .
docker compose up --buildArchitecture
MCP Server (main.py)
Single-file MCP server exposing Telegram functionality as tools. Key components:
FastMCP("telegram")- MCP server instanceTelegramClient- Telethon client (supports both string and file-based sessions)@mcp.tool()decorated functions - 60+ tools for chat, messaging, contacts, admin, media operations@validate_id()decorator - validates chat_id/user_id parameters (accepts int, string int, or @username)log_and_format_error()- centralized error handling with error codes logged tomcp_errors.log
TypeScript Agent (agent/)
CLI agent using Claude Sonnet via Vercel AI Gateway. Communicates with Telegram through an HTTP bridge:
telegram_api.py- FastAPI HTTP bridge exposing Telethon via REST (runs on port 8765)agent/src/agent.ts- AI agent using @ai-sdk/gatewayagent/src/tools/- Tool definitions (telegram.ts, nia.ts, aiify.ts)
ID Validation
All functions accept flexible ID formats:
- Integer ID:
123456789or-1001234567890 - String ID:
"123456789" - Username:
"@username"or"username"
Code Style
- Python: Black formatter (line-length 99), Flake8 linter
- Target Python version: 3.10+
- Use
Union[int, str]for ID parameters - Error codes follow pattern:
{CATEGORY}-ERR-{hash}
Environment Variables
Required in .env:
TELEGRAM_API_ID- from my.telegram.org/appsTELEGRAM_API_HASH- from my.telegram.org/appsTELEGRAM_SESSION_STRING(preferred) orTELEGRAM_SESSION_NAME(file-based)
For TypeScript agent:
AI_GATEWAY_API_KEY- Vercel AI Gateway keyNIA_API_KEY- Nia API keyTELEGRAM_API_URL- HTTP bridge URL (default: http://localhost:8765)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

