Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The server is a bridge between the Telegram API and the AI assistants and is bas
- [Configuration](#configuration)
- [Authorization](#authorization)
- [Client Configuration](#client-configuration)
- [JSON Schema Version](#json-schema-version)
- [Star History](#star-history)

## What is MCP?
Expand Down Expand Up @@ -263,6 +264,16 @@ Example of Configuring Claude Desktop to recognize the Telegram MCP server.
}
```

### JSON Schema Version

Some MCP clients (e.g. VS Code) do not support JSON Schema Draft 2020-12 and will reject tools that use it. You can override the JSON Schema version by setting the `--schema-version` flag or the `TG_SCHEMA_VERSION` environment variable.

Common values:
| Version | URL |
|---------|-----|
| Draft-07 (recommended for VS Code) | `https://json-schema.org/draft-07/schema#` |
| Draft 2020-12 (default) | `https://json-schema.org/draft/2020-12/schema` |

## Star History

<a href="https://www.star-history.com/#chaindead/telegram-mcp&Date">
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.24

require (
github.com/gotd/td v0.121.0
github.com/invopop/jsonschema v0.12.0
github.com/metoro-io/mcp-golang v0.8.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.34.0
Expand All @@ -28,7 +29,6 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/gotd/ige v0.2.2 // indirect
github.com/gotd/neo v0.1.5 // indirect
github.com/invopop/jsonschema v0.12.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func main() {
Value: sesionPath,
Sources: cli.EnvVars("TG_SESSION_PATH"),
},
&cli.StringFlag{
Name: "schema-version",
Usage: "JSON Schema version URL (e.g. https://json-schema.org/draft-07/schema#)",
Sources: cli.EnvVars("TG_SCHEMA_VERSION"),
},
&cli.BoolFlag{
Name: "dry",
Usage: "Test configuration",
Expand Down
5 changes: 5 additions & 0 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"

"github.com/chaindead/telegram-mcp/internal/tg"
"github.com/invopop/jsonschema"

mcp "github.com/metoro-io/mcp-golang"
"github.com/metoro-io/mcp-golang/transport/stdio"
Expand All @@ -20,6 +21,10 @@ func serve(ctx context.Context, cmd *cli.Command) error {
sessionPath := cmd.String("session")
dryRun := cmd.Bool("dry")

if schemaURL := cmd.String("schema-version"); schemaURL != "" {
jsonschema.Version = schemaURL
}

_, err := os.Stat(sessionPath)
if err != nil {
return fmt.Errorf("session file not found(%s): %w", sessionPath, err)
Expand Down
Loading