chore: sync from fn-registry agent
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
---
|
||||
name: registry_mcp
|
||||
lang: go
|
||||
domain: infra
|
||||
description: "Servidor MCP (Model Context Protocol) que expone registry.db a clientes Claude (Code, Desktop). Tools read-only (search/show/code/list_domains/uses/doctor) y mutadoras (fn_run, fn_create_function) para iterar sobre el registry sin shellear sqlite3 ni fn CLI."
|
||||
tags: [service, mcp, registry, claude, ai-agents]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
framework: "mcp"
|
||||
entry_point: "main.go"
|
||||
dir_path: "apps/registry_mcp"
|
||||
repo_url: "https://gitea.organic-machine.com/dataforge/registry_mcp"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Servidor MCP que sirve `registry.db` como herramientas tipadas a Claude:
|
||||
|
||||
| Tool | Que hace |
|
||||
|---|---|
|
||||
| `fn_search` | FTS5 sobre functions + types con filtros (kind, lang, domain, purity) |
|
||||
| `fn_show` | Markdown card de una funcion/tipo (frontmatter + code fenced) |
|
||||
| `fn_code` | Solo la columna `code` de la entidad |
|
||||
| `fn_list_domains` | Agregados `(domain, kind, purity, lang)` |
|
||||
| `fn_uses` | uses_functions + uses_types + reverse lookup (consumed_by) |
|
||||
| `fn_doctor` | Subprocess `fn doctor <sub> --json` |
|
||||
| `fn_run` | Subprocess `fn run <id> [args...]` (require `--enable-run`) |
|
||||
| `fn_create_function` | Escribe `.go/.py/.sh/.ts` + `.md` y corre `fn index` (require `--enable-write`) |
|
||||
|
||||
## Transports
|
||||
|
||||
- **stdio** (default) — Claude Code/Desktop nativo.
|
||||
- **HTTP** opcional via `--http :7733` con basicAuth (`REGISTRY_API_TOKEN`). Bind a `127.0.0.1` salvo `--bind 0.0.0.0` explicito.
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
cd apps/registry_mcp
|
||||
CGO_ENABLED=1 go build -tags fts5 -o registry_mcp .
|
||||
```
|
||||
|
||||
## Instalar en Claude Code
|
||||
|
||||
Anadir a `.mcp.json` del repo:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"registry": {
|
||||
"command": "/abs/path/apps/registry_mcp/registry_mcp",
|
||||
"args": ["--enable-run", "--enable-write"],
|
||||
"env": { "FN_REGISTRY_ROOT": "/abs/path/fn_registry" }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Origen de datos
|
||||
|
||||
`registry.db` local. Resuelve via `FN_REGISTRY_ROOT` env, o sube directorios buscando `go.mod` desde el cwd. Read-only: abre con `?mode=ro&_query_only=1`.
|
||||
|
||||
## Riesgos y mitigaciones
|
||||
|
||||
- `fn_run` ejecuta codigo arbitrario en el host. **Off por defecto** (flag `--enable-run`).
|
||||
- `fn_create_function` escribe archivos. **Off por defecto** (flag `--enable-write`).
|
||||
- FTS5 quoting: el server sanitiza tokens con `-`, `.`, `:` envolviendo en comillas dobles (regla `CLAUDE.md`).
|
||||
- WAL drift: si `registry.db` se regenera durante una sesion, el server reabre la conexion al detectar `SQLITE_CORRUPT` o cambio de mtime.
|
||||
- Logs: TODO va a `stderr` (slog). Stdio JSON-RPC reservado para protocolo.
|
||||
Reference in New Issue
Block a user