bug: fix json schema
This commit is contained in:
parent
ba919808e0
commit
764883677e
4 changed files with 22 additions and 1 deletions
11
README.md
11
README.md
|
|
@ -30,6 +30,7 @@ The server is a bridge between the Telegram API and the AI assistants and is bas
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Authorization](#authorization)
|
- [Authorization](#authorization)
|
||||||
- [Client Configuration](#client-configuration)
|
- [Client Configuration](#client-configuration)
|
||||||
|
- [JSON Schema Version](#json-schema-version)
|
||||||
- [Star History](#star-history)
|
- [Star History](#star-history)
|
||||||
|
|
||||||
## What is MCP?
|
## What is MCP?
|
||||||
|
|
@ -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
|
## Star History
|
||||||
|
|
||||||
<a href="https://www.star-history.com/#chaindead/telegram-mcp&Date">
|
<a href="https://www.star-history.com/#chaindead/telegram-mcp&Date">
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -4,6 +4,7 @@ go 1.24
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gotd/td v0.121.0
|
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/metoro-io/mcp-golang v0.8.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/rs/zerolog v1.34.0
|
github.com/rs/zerolog v1.34.0
|
||||||
|
|
@ -28,7 +29,6 @@ require (
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gotd/ige v0.2.2 // indirect
|
github.com/gotd/ige v0.2.2 // indirect
|
||||||
github.com/gotd/neo v0.1.5 // 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/klauspost/compress v1.18.0 // indirect
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
github.com/mailru/easyjson v0.7.7 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||||
|
|
|
||||||
5
main.go
5
main.go
|
|
@ -59,6 +59,11 @@ func main() {
|
||||||
Value: sesionPath,
|
Value: sesionPath,
|
||||||
Sources: cli.EnvVars("TG_SESSION_PATH"),
|
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{
|
&cli.BoolFlag{
|
||||||
Name: "dry",
|
Name: "dry",
|
||||||
Usage: "Test configuration",
|
Usage: "Test configuration",
|
||||||
|
|
|
||||||
5
serve.go
5
serve.go
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/chaindead/telegram-mcp/internal/tg"
|
"github.com/chaindead/telegram-mcp/internal/tg"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
|
||||||
mcp "github.com/metoro-io/mcp-golang"
|
mcp "github.com/metoro-io/mcp-golang"
|
||||||
"github.com/metoro-io/mcp-golang/transport/stdio"
|
"github.com/metoro-io/mcp-golang/transport/stdio"
|
||||||
|
|
@ -20,6 +21,10 @@ func serve(ctx context.Context, cmd *cli.Command) error {
|
||||||
sessionPath := cmd.String("session")
|
sessionPath := cmd.String("session")
|
||||||
dryRun := cmd.Bool("dry")
|
dryRun := cmd.Bool("dry")
|
||||||
|
|
||||||
|
if schemaURL := cmd.String("schema-version"); schemaURL != "" {
|
||||||
|
jsonschema.Version = schemaURL
|
||||||
|
}
|
||||||
|
|
||||||
_, err := os.Stat(sessionPath)
|
_, err := os.Stat(sessionPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("session file not found(%s): %w", sessionPath, err)
|
return fmt.Errorf("session file not found(%s): %w", sessionPath, err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue