verae-mcp-timestamping-serv.../internal/tools/welcome.go
George Lambert 3ec1f0516b
Some checks failed
test-and-deploy / test (push) Failing after 12m55s
test-and-deploy / deploy-138 (push) Has been cancelled
feat(mcp): optional receipt_format on stamp/verify (text/PDF/JSON/MD/CSV/TSV)
Add receipt_format to stamp and verify. Omitted → text; receipt|PDF-Receipt → PDF;
JSON-Receipt → JSON; MD|MD-Receipt; CSV|CSV-Receipt; TSV|TSV-Receipt.

Stamp always returns receipts[] and adds artifacts[] in the chosen format.
Stdio writes ~/.verae/receipts (0600); public MCP returns content_text/content_base64 only.
Verify accepts inline receipt or receipt_path (stdio), parses id, and re-emits an artifact.

Vendors pdfcert (+ slim statuslang, gofpdf) for CERT-01 PDF. Also lands welcome tool
and email-username helpers already wired into register/public paths.
2026-10-20 16:02:20 -04:00

70 lines
4.3 KiB
Go

package tools
import (
"context"
"github.com/modelcontextprotocol/go-sdk/mcp"
)
// Welcome message shown on connect (via instructions) and by the welcome tool.
// Keep this the source of truth for onboarding copy.
const welcomeMessage = `Welcome to Verae.
Account and auth are required for use of this MCP. Before stamp, verify, hash_report, or session, you must create an account or sign in and attach your access_token.
Verae Timestamping proves that a specific digital object existed at a point in time. You hash the file (or data) locally — Verae never needs the file bytes, only the digest — then commit that digest. The result is a receipt you can verify later (and share) without revealing the original content.
This MCP server is how AI clients (Grok, Claude, Cursor, and others) and local tools talk to Verae:
• welcome — onboarding (no account required)
• signup / login — create an account or sign in; you receive an access_token (required next)
• stamp / stamp_batch — commit one or many SHA-256 digests (local ledger or global VeraeTime)
• verify / hash_report — check a receipt or list history for a digest
• session — confirm your bearer is still valid
Public HTTP (mcp.verae.ai): every tool except welcome, signup, and login needs Authorization: Bearer (VeraeTime JWT or xVerae- API key). There is no host-login fallback. Put access_token in your client's bearer file (Grok: bearer_token_file → ~/.verae/mcp-bearer) or send Authorization on each tools/call. Do not paste tokens into chat.
Important: the username must be an email address (welcome mail is sent there on signup).
Next step — create or sign in to your account:
1. New here? Call tool signup with your email as username and a password. It creates the account, emails a Welcome to Verae message, and returns access_token.
2. Already registered? Call tool login with your email and password to receive access_token.
3. Save the token in your MCP client, call session to confirm, then stamp or verify.
Global stamps may meter prepaid credits when edge billing is enabled.`
const instructions = "Welcome to Verae Timestamping MCP (mcp.verae.ai). " +
"Account and auth are required for use. Username must be an email address. " +
"On first connect, or whenever the user has no Verae account / bearer, greet them warmly: " +
"welcome them to Verae, briefly explain digests-only timestamping (hash locally; stamp digests; get a verifiable receipt), " +
"explain that this MCP requires signup or login before stamp/verify/session, " +
"tell them the username must be an email address (a Welcome to Verae email is sent on signup), " +
"then ask them to sign in (tool login) or create an account (tool signup). " +
"Prefer calling tool welcome to show the full onboarding text, then guide signup or login. " +
"Only welcome, signup, and login work without a bearer. " +
"After signup/login, save access_token to the client's bearer file (Grok: ~/.verae/mcp-bearer via bearer_token_file) or Authorization header — never paste tokens into chat. " +
"When VERAE_MCP_EDGE_URL is set, global stamps meter on zap.verae.ai. " +
"Admin create_user is for operators only."
// WelcomeOut is returned by the welcome tool.
type WelcomeOut struct {
Title string `json:"title"`
Message string `json:"message"`
NextSteps []string `json:"next_steps"`
ToolsHint []string `json:"tools_hint"`
HasAccount string `json:"ask"`
}
func (d *Deps) welcome(_ context.Context, _ *mcp.CallToolRequest, _ EmptyArgs) (*mcp.CallToolResult, WelcomeOut, error) {
return nil, WelcomeOut{
Title: "Welcome to Verae",
Message: welcomeMessage,
NextSteps: []string{
"New user: call tool signup with your email as username and a password → receive access_token (Welcome email is sent)",
"Existing user: call tool login with your email and password → receive access_token",
"Save access_token to your MCP bearer file or Authorization header (do not paste into chat)",
"Call tool session to confirm, then stamp a SHA-256 digest",
},
ToolsHint: []string{"welcome", "signup", "login", "session", "stamp", "stamp_batch", "verify", "hash_report"},
HasAccount: "Account and auth are required for use. The username must be an email address. Do you already have a Verae account? Sign in with login, or create one with signup.",
}, nil
}