T15: MCP tools search/describe/read/call + smoke test #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "t15-mcp-tools"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
T15: MCP tools
search/describe/read/call+ smoke testStacked on #13 (
t14-mcp-oauth) → … → #1. Merge those first.What
src/mcp/tools.ts(pure, tested without a transport):search({ query, limit? }): ranked registry search (English or Czech) with a "describe next" hint.describe({ paths ≤ 20 }): docs, JSON schemas and examples. Unknown paths are listed separately instead of failing.call({ path, args? }): runs a registry function as the signed-in user. Errors come back asisErrorresults with{ error: { code, message } }fromtoErrorPayload, so upstream bodies and credentials never appear. The user context is only built once the path is known to be valid.read({ uri }):fit://help(overview of namespaces, functions and resources),fit://functionsandfit://functions/{path}.courses://…returns a clear "not available yet" until T18. Anything else is rejected.src/server/mcp-handler.ts: registers the tools with serverinstructions. All tools are annotatedreadOnlyHint: true, destructiveHint: false, idempotentHint: true, so ChatGPT and Claude don't ask for confirmation.search,describeandreadareopenWorldHint: false.src/server/mcp-context.ts: per-requestFnContextfor the grant'suserId, with D1 + the keyring (cached per isolate) + the token store with the FIT refresher. The user comes only from the OAuth grant props. Tool input can't choose it.bun run mcp:smoke(scripts/mcp-smoke.ts): checks discovery, the 401 challenge, DCR and the anonymous/authorizeredirect.--loginruns the full OAuth flow (PKCE, state, a local 127.0.0.1 callback), theninitializeandtools/list, plussearch,describe,readandcallon 5 functions.docs/mcp.md: tools, error codes, the smoke test, and MCP Inspector instructions.Verified
bun run lint && bun run typecheck && bun run test: 192 tests.callsuccess, safe errors (upstream, unknown, invalid), no context for unknown paths, context failure → generic error,readresources and rejections, truncation.tools/list(four tools, all read-only) andtools/call→fit.statusas the signed-in user, with no upstream tokens in the response.bun run dev+bun run mcp:smoke: all checks pass.--loginneeds a real browser login, which is still waiting on the human (see T7).Astra review (gpt-6-astra)
callchecks as passing on HTTP or JSON-RPC errors. It now rejects transport and protocol errors and requires a real tool result.🤖 Generated with Claude Code