Add stdio MCP server for token-scoped ticket access.
Expose tm mcp tools against the local daemon, document agent setup, and ignore workspace .tm_token files. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+25
-2
@@ -12,6 +12,7 @@ import (
|
||||
"task/internal/daemon"
|
||||
"task/internal/daemon/api"
|
||||
"task/internal/daemon/client"
|
||||
mcpserver "task/internal/mcp"
|
||||
"task/internal/ui"
|
||||
"task/internal/version"
|
||||
)
|
||||
@@ -215,7 +216,29 @@ func runSync(args []string) error {
|
||||
}
|
||||
|
||||
func runMCP() error {
|
||||
return fmt.Errorf("mcp server not implemented yet — coming in phase 2")
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tf, err := mcpserver.FindTokenFile(cwd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cfg, err := loadConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
paths, err := daemon.Ensure(cfg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("daemon: %w", err)
|
||||
}
|
||||
cli := client.Dial(client.Options{
|
||||
Socket: paths.Socket,
|
||||
Kind: api.ClientMCP,
|
||||
Token: tf.Token,
|
||||
Project: tf.Project,
|
||||
})
|
||||
return mcpserver.ServeStdio(cli, tf)
|
||||
}
|
||||
|
||||
func printHelp() {
|
||||
@@ -238,7 +261,7 @@ Env:
|
||||
|
||||
The TUI talks to a per-DataDir background daemon over a Unix socket so multiple
|
||||
instances stay consistent. Create an MCP token from the project list (key g);
|
||||
place it in a repo as .tm_token for AI access.
|
||||
place project= and token= in a repo .tm_token file, then run: tm mcp
|
||||
|
||||
`, config.CliName, config.CliName, config.CliName, config.CliName, config.CliName, config.CliName, config.CliName, config.CliName, config.CliName, config.CliName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user