From 340f1478f47e8e7880115dac7d33417b60f3f197 Mon Sep 17 00:00:00 2001 From: John Doe Date: Tue, 1 Apr 2025 18:06:07 +0300 Subject: [PATCH] init github --- README.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ auth.go | 3 +- cmd/test/main.go | 3 +- go.mod | 2 +- serve.go | 3 +- 5 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b738d7 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# Telegram MCP server + +The server is a bridge between the Telegram API and the AI assistants and is based on the [Model Context Protocol](https://modelcontextprotocol.io). + +> [!IMPORTANT] +> Ensure that you have read and understood the [Telegram API Terms of Service](https://core.telegram.org/api/terms) before using this server. +> Any misuse of the Telegram API may result in the suspension of your account. + +## What is MCP? + +The Model Context Protocol (MCP) is a system that lets AI apps, like Claude Desktop or Cursor, connect to external tools and data sources. It gives a clear and safe way for AI assistants to work with local services and APIs while keeping the user in control. + +## What does this server do? + +- [x] Get current user data +- [ ] Get the list of dialogs (chats, channels, groups) +- [ ] Get the list of (unread) messages in the given dialog +- [ ] Mark chanel as read +- [ ] Retrieve messages by date and time +- [ ] Download media files +- [ ] Get the list of contacts +- [ ] Draft a message + +## Installation + +```bash +go install github.com/chaindead/telegram-mcp +``` + +## Configuration + +### Telegram API Configuration + +Before you can use the server, you need to connect to the Telegram API. + +1. Get the API ID and hash from [Telegram API](https://my.telegram.org/auth) +2. Run the following command: + + ```bash + telegram-mcp auth --app-id --api-hash --phone + ``` + + Enter the code you received from Telegram to connect to the API. + + The password may be required if you have two-factor authentication enabled. + +### Claude Desktop Configuration + +Configure Claude Desktop to recognize the Exa MCP server. + +1. Open the Claude Desktop configuration file: + - in MacOS, the configuration file is located at `~/Library/Application Support/Claude/claude_desktop_config.json` + - in Windows, the configuration file is located at `%APPDATA%\Claude\claude_desktop_config.json` + + > __Note:__ + > You can also find claude_desktop_config.json inside the settings of Claude Desktop app + +2. Add the server configuration + + ```json + { + "mcpServers": { + "telegram-mcp": { + "command": "telegram-mcp", + "env": { + "TG_APP_ID": "", + "TG_API_HASH": "" + } + } + } + } + ``` \ No newline at end of file diff --git a/auth.go b/auth.go index 7129e6d..f1a8ab1 100644 --- a/auth.go +++ b/auth.go @@ -4,7 +4,8 @@ import ( "context" "encoding/json" "fmt" - "telegram-mcp/internal/tg" + + "github.com/chaindead/telegram-mcp/internal/tg" "github.com/rs/zerolog/log" "github.com/urfave/cli/v3" diff --git a/cmd/test/main.go b/cmd/test/main.go index 20e3643..3ed10b2 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -6,8 +6,7 @@ import ( "os/signal" "strconv" - "telegram-mcp/internal/tg" - + "github.com/chaindead/telegram-mcp/internal/tg" "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/rs/zerolog/log" diff --git a/go.mod b/go.mod index 0d25591..3478591 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module telegram-mcp +module github.com/chaindead/telegram-mcp go 1.24 diff --git a/serve.go b/serve.go index babfdad..ae5cae1 100644 --- a/serve.go +++ b/serve.go @@ -5,7 +5,8 @@ import ( "encoding/json" "fmt" "os" - "telegram-mcp/internal/tg" + + "github.com/chaindead/telegram-mcp/internal/tg" mcp "github.com/metoro-io/mcp-golang" "github.com/metoro-io/mcp-golang/transport/stdio"