frihet-mcp
AGENTS.md13 starsChanged 5 days agoMITView on GitHub
Open-source MCP server for Frihet ERP. TypeScript, Node ^22.23.4 || ^24.22.1 || ^26.12.1, MIT license. Distributed via npm + Cloudflare Worker (mcp.frihet.io) + Smithery + Anthropic registry. Pre-commit: npm run build must succeed. npm test must pass. The Cloudflare Worker serving mcp.frihet.io MUST also serve: - /llms.txt (200, plain text, brief overview) - /llms-full.txt (200, plain text, full reference) - /robots.txt (200, allow AI crawlers explicit) - /sitemap.xml (200, single URL or full) - /openapi.json (200, mirror of api.frihet.io v1)…
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository11 other files it gives its agents.
- rules/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- clientesSkill
- cobrosSkill
- documentosSkill
- frihet-mcpSkill
- gastosSkill
- frihet-mcpSkill
- operacionesSkill
- revision-mensualSkill
- tesoreriaSkill
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Commit messages: feat(tools): add <family> CRUD / fix(invoices): handle null totals
- Distinctive: line 34
Update README.md tool count badge when adding tools
- Very specific: line 36
Test fixtures in src/__tests__/fixtures/
- Distinctive: line 40
Every mutating tool must have at least 1 idempotency test
- Distinctive: line 41
Every tool must have at least 1 schema rejection test (bad input)
- Distinctive: line 42
Every tool must have at least 1 happy path test
- Distinctive: line 58
No third-party HTTP outside Frihet API + Langfuse
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Frihet MCP Server
Open-source MCP server for Frihet ERP. TypeScript, Node ^22.23.4 || ^24.22.1 || ^26.12.1, MIT license. Distributed via npm + Cloudflare Worker (mcp.frihet.io) + Smithery + Anthropic registry.
Build & Test
npm install # Install deps
npm run build # tsc → dist/
npm test # Run native node test suite
npm start # Run server via stdio (local debug)Pre-commit: npm run build must succeed. npm test must pass.
Code Style
- TypeScript strict mode (
strict: true) - ES2022 target, NodeNext module resolution
- Tools use the established canonical snake_case names, such as
create_invoice - Return human-readable MCP
contentplus outputSchema-validstructuredContent - Zod schemas on
inputSchema(strict) - Preserve actionable, sanitized API errors through the shared error helpers
- One tool per logical operation — no batching unless explicit
- Async/await throughout, no callbacks
- Logger from
src/logger.ts— neverconsole.login tool code - Observability: every tool wrapped via
src/observability.ts(Langfuse)
Conventions
- Commit messages:
feat(tools): add <family> CRUD/fix(invoices): handle null totals - Branch names:
feat/<descriptive-slug> - Atomic commits — one tool family per commit minimum
- Update README.md tool count badge when adding tools
- Tool descriptions are concise and bilingual (English / Spanish)
- Test fixtures in
src/__tests__/fixtures/
Testing standards
- Every mutating tool must have at least 1 idempotency test
- Every tool must have at least 1 schema rejection test (bad input)
- Every tool must have at least 1 happy path test
- Coverage target: > 80% lines, 100% on auth/scope branches
Gotchas
- NEVER mutate
process.env— read once into config object - API client must respect
Idempotency-Key— propagate from tool input when present - Don't log full request bodies — PII (NIF/IBAN/email). Use
mask()from logger - Cloudflare Worker is a separate deployment surface — pinging the Worker is not a substitute for testing the npm package locally
- MCP SDK breaking changes — pin
@modelcontextprotocol/sdkminor; major bumps require manual review - Postinstall script —
node scripts/postinstall.js || trueruns harmlessly. Do not make required
Security
- API key (
FRIHET_API_KEY) read from env at server start, never logged - Bearer token sent only to
https://api.frihet.io/v1 - No third-party HTTP outside Frihet API + Langfuse
- Worker (mcp.frihet.io) handles OAuth + key exchange separately
- Errors use bounded, sanitized remediation and never echo credentials or raw provider bodies
Worker-side static surface (Cloudflare Worker)
The Cloudflare Worker serving mcp.frihet.io MUST also serve:
/llms.txt(200, plain text, brief overview)/llms-full.txt(200, plain text, full reference)/robots.txt(200, allow AI crawlers explicit)/sitemap.xml(200, single URL or full)/openapi.json(200, mirror of api.frihet.io v1)/mcp.json(200, MCP server manifest)/.well-known/mcp(200, well-known endpoint discovery)/.well-known/ai-plugin.json(200, ChatGPT plugin spec)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

