@agentrica/mcp 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +93 -0
- package/README.md +92 -2
- package/agents/ai_business_product_development_agency/00-common-rules.md +39 -0
- package/agents/ai_business_product_development_agency/01-chief-business-product-officer.md +23 -0
- package/agents/ai_business_product_development_agency/02-senior-market-research-analyst.md +23 -0
- package/agents/ai_business_product_development_agency/03-senior-product-innovation-strategist.md +23 -0
- package/agents/ai_business_product_development_agency/04-senior-product-manager.md +23 -0
- package/agents/ai_business_product_development_agency/05-senior-business-analyst-requirements-strategist.md +23 -0
- package/agents/ai_business_product_development_agency/06-senior-business-financial-analyst.md +23 -0
- package/agents/ai_business_product_development_agency/07-senior-growth-monetization-manager.md +23 -0
- package/agents/ai_business_product_development_agency/08-senior-product-marketing-manager.md +23 -0
- package/agents/ai_business_product_development_agency/09-senior-sales-revenue-strategist.md +23 -0
- package/agents/ai_business_product_development_agency/10-senior-business-development-manager.md +23 -0
- package/agents/ai_business_product_development_agency/11-senior-customer-success-retention-strategist.md +23 -0
- package/agents/ai_business_product_development_agency/12-senior-product-portfolio-roadmap-manager.md +23 -0
- package/agents/ai_business_product_development_agency/README.md +38 -0
- package/agents/ai_cybersecurity_agency/00-common-rules.md +41 -0
- package/agents/ai_cybersecurity_agency/01-chief-information-security-officer.md +24 -0
- package/agents/ai_cybersecurity_agency/02-senior-security-architect.md +24 -0
- package/agents/ai_cybersecurity_agency/03-senior-application-security-engineer.md +24 -0
- package/agents/ai_cybersecurity_agency/04-senior-cloud-security-engineer.md +24 -0
- package/agents/ai_cybersecurity_agency/05-senior-network-security-engineer.md +24 -0
- package/agents/ai_cybersecurity_agency/06-senior-identity-access-management-engineer.md +24 -0
- package/agents/ai_cybersecurity_agency/07-senior-soc-threat-detection-analyst.md +24 -0
- package/agents/ai_cybersecurity_agency/08-senior-incident-response-forensics-specialist.md +24 -0
- package/agents/ai_cybersecurity_agency/09-senior-vulnerability-management-engineer.md +24 -0
- package/agents/ai_cybersecurity_agency/10-senior-security-risk-compliance-auditor.md +24 -0
- package/agents/ai_cybersecurity_agency/11-senior-authorized-penetration-testing-specialist.md +24 -0
- package/agents/ai_cybersecurity_agency/12-senior-security-awareness-engineer.md +24 -0
- package/agents/ai_cybersecurity_agency/README.md +41 -0
- package/agents/ai_privacy_compliance_agency/00-common-rules.md +26 -0
- package/agents/ai_privacy_compliance_agency/01-chief-privacy-compliance-officer.md +18 -0
- package/agents/ai_privacy_compliance_agency/02-gdpr-data-protection-specialist.md +18 -0
- package/agents/ai_privacy_compliance_agency/03-privacy-legal-specialist.md +17 -0
- package/agents/ai_privacy_compliance_agency/04-dpia-risk-assessment-specialist.md +17 -0
- package/agents/ai_privacy_compliance_agency/05-privacy-security-engineer.md +18 -0
- package/agents/ai_privacy_compliance_agency/06-data-governance-retention-specialist.md +18 -0
- package/agents/ai_privacy_compliance_agency/07-third-party-vendor-compliance-specialist.md +18 -0
- package/agents/ai_privacy_compliance_agency/08-data-subject-rights-specialist.md +18 -0
- package/agents/ai_privacy_compliance_agency/09-data-breach-incident-response-specialist.md +18 -0
- package/agents/ai_privacy_compliance_agency/10-privacy-compliance-auditor.md +15 -0
- package/agents/ai_privacy_compliance_agency/README.md +47 -0
- package/agents/ai_software_agency/00-common-rules.md +22 -0
- package/agents/ai_software_agency/01-software-agency-director-cto.md +7 -0
- package/agents/ai_software_agency/02-senior-software-architect.md +7 -0
- package/agents/ai_software_agency/03-senior-business-functional-analyst.md +7 -0
- package/agents/ai_software_agency/04-senior-backend-developer.md +7 -0
- package/agents/ai_software_agency/05-senior-frontend-developer.md +7 -0
- package/agents/ai_software_agency/06-senior-full-stack-developer.md +7 -0
- package/agents/ai_software_agency/07-senior-database-engineer-dba.md +7 -0
- package/agents/ai_software_agency/08-senior-qa-test-automation-engineer.md +7 -0
- package/agents/ai_software_agency/09-senior-application-security-engineer.md +7 -0
- package/agents/ai_software_agency/10-senior-devops-infrastructure-engineer.md +7 -0
- package/agents/ai_software_agency/11-senior-performance-engineer.md +7 -0
- package/agents/ai_software_agency/12-senior-code-reviewer-software-quality-architect.md +7 -0
- package/agents/ai_software_agency/README.md +41 -0
- package/agents/ai_web_design_agency/00-common-rules.md +72 -0
- package/agents/ai_web_design_agency/01-agency-director.md +37 -0
- package/agents/ai_web_design_agency/02-senior-ux-researcher.md +24 -0
- package/agents/ai_web_design_agency/03-senior-ux-designer.md +24 -0
- package/agents/ai_web_design_agency/04-senior-information-architect.md +21 -0
- package/agents/ai_web_design_agency/05-senior-ui-designer.md +24 -0
- package/agents/ai_web_design_agency/06-senior-design-system-specialist.md +24 -0
- package/agents/ai_web_design_agency/07-senior-dashboard-data-visualization-designer.md +21 -0
- package/agents/ai_web_design_agency/08-senior-accessibility-specialist.md +22 -0
- package/agents/ai_web_design_agency/09-senior-usability-auditor.md +32 -0
- package/agents/ai_web_design_agency/10-senior-ux-writer.md +21 -0
- package/agents/ai_web_design_agency/README.md +42 -0
- package/dist/catalog/src/departments.js +39 -0
- package/dist/catalog/src/index.js +77 -0
- package/dist/catalog/src/markdown.js +32 -0
- package/dist/mcp/src/prompt.js +41 -0
- package/dist/mcp/src/server.js +75 -0
- package/package.json +30 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Catalogo di Agentrica: reparti e agenti letti dai file di agents/.
|
|
2
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { DEPARTMENTS } from "./departments.js";
|
|
5
|
+
import { parseRole } from "./markdown.js";
|
|
6
|
+
export { DEPARTMENTS } from "./departments.js";
|
|
7
|
+
const WORKFLOW = "Flusso di lavoro";
|
|
8
|
+
const COLLABORATION = "Collaborazione con le altre agenzie";
|
|
9
|
+
const ROLE_FILE = /^(\d{2})-([a-z0-9-]+)\.md$/;
|
|
10
|
+
/**
|
|
11
|
+
* Cerca la cartella agents/ risalendo da `from`.
|
|
12
|
+
* ponytail: funziona dentro il repository (sito, test, sviluppo); il pacchetto MCP pubblicato (F5) dovrà
|
|
13
|
+
* portarsi dietro i file e passare la cartella a loadCatalog.
|
|
14
|
+
*/
|
|
15
|
+
export function findAgentsDir(from = process.cwd()) {
|
|
16
|
+
// turbopackIgnore: il sito legge il catalogo solo al build (pagine pre-generate), quindi Next non deve tracciare
|
|
17
|
+
// l'intero repository nel pacchetto server. Un MCP remoto in Next dovrà includere agents/ esplicitamente.
|
|
18
|
+
let dir = resolve(/*turbopackIgnore: true*/ from);
|
|
19
|
+
for (;;) {
|
|
20
|
+
const candidate = join(dir, "agents");
|
|
21
|
+
if (existsSync(join(candidate, DEPARTMENTS[0].folder)))
|
|
22
|
+
return candidate;
|
|
23
|
+
const parent = dirname(dir);
|
|
24
|
+
if (parent === dir)
|
|
25
|
+
throw new Error(`cartella agents/ non trovata risalendo da ${from}`);
|
|
26
|
+
dir = parent;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function loadCatalog(agentsDir = findAgentsDir()) {
|
|
30
|
+
return DEPARTMENTS.map((info) => loadDepartment(agentsDir, info));
|
|
31
|
+
}
|
|
32
|
+
function loadDepartment(agentsDir, info) {
|
|
33
|
+
const folder = join(agentsDir, info.folder);
|
|
34
|
+
const files = readdirSync(folder)
|
|
35
|
+
.map((file) => ROLE_FILE.exec(file))
|
|
36
|
+
.filter((match) => match !== null && match[1] !== "00")
|
|
37
|
+
.sort((a, b) => a[1].localeCompare(b[1]));
|
|
38
|
+
if (files.length !== info.stars.length) {
|
|
39
|
+
throw new Error(`${info.code}: ${files.length} file di ruolo ma ${info.stars.length} nomi in codice`);
|
|
40
|
+
}
|
|
41
|
+
const agents = files.map((match, index) => {
|
|
42
|
+
const number = Number(match[1]);
|
|
43
|
+
if (number !== index + 1)
|
|
44
|
+
throw new Error(`${info.code}: numerazione dei file non continua a ${match[0]}`);
|
|
45
|
+
const { title, intro, sections } = parseRole(readFileSync(join(folder, match[0]), "utf8"));
|
|
46
|
+
return {
|
|
47
|
+
id: `${info.code}-${match[1]}`,
|
|
48
|
+
star: info.stars[index],
|
|
49
|
+
number,
|
|
50
|
+
slug: match[2],
|
|
51
|
+
department: info.code,
|
|
52
|
+
role: title,
|
|
53
|
+
intro,
|
|
54
|
+
sections,
|
|
55
|
+
source: `agents/${info.folder}/${match[0]}`,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
const readme = parseRole(readFileSync(join(folder, "README.md"), "utf8"));
|
|
59
|
+
const readmeSection = (heading) => {
|
|
60
|
+
const body = readme.sections.find((s) => s.heading === heading)?.body;
|
|
61
|
+
if (!body)
|
|
62
|
+
throw new Error(`${info.code}: README.md senza «## ${heading}»`);
|
|
63
|
+
return body;
|
|
64
|
+
};
|
|
65
|
+
const { intro, sections } = parseRole(readFileSync(join(folder, "00-common-rules.md"), "utf8"));
|
|
66
|
+
const { stars: _stars, ...rest } = info;
|
|
67
|
+
return {
|
|
68
|
+
...rest,
|
|
69
|
+
slug: info.code.toLowerCase(),
|
|
70
|
+
mission: readme.intro,
|
|
71
|
+
workflow: readmeSection(WORKFLOW),
|
|
72
|
+
collaboration: readmeSection(COLLABORATION),
|
|
73
|
+
rules: { intro, sections },
|
|
74
|
+
agents,
|
|
75
|
+
director: agents[0],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Lettura minima dei file di ruolo: titolo (#), testo introduttivo e sezioni (##).
|
|
2
|
+
// ponytail: niente parser Markdown completo; i corpi restano Markdown grezzo. Quando il sito dovrà
|
|
3
|
+
// mostrarli formattati (F4) li rende il sito o una dipendenza approvata, non questo file.
|
|
4
|
+
export function parseRole(markdown) {
|
|
5
|
+
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
|
|
6
|
+
const titleIndex = lines.findIndex((line) => line.startsWith("# "));
|
|
7
|
+
if (titleIndex === -1)
|
|
8
|
+
throw new Error("file di ruolo senza titolo «# …»");
|
|
9
|
+
const title = lines[titleIndex].slice(2).trim();
|
|
10
|
+
const intro = [];
|
|
11
|
+
const sections = [];
|
|
12
|
+
let current = null;
|
|
13
|
+
for (const line of lines.slice(titleIndex + 1)) {
|
|
14
|
+
if (line.startsWith("## ")) {
|
|
15
|
+
if (current)
|
|
16
|
+
sections.push(close(current));
|
|
17
|
+
current = { heading: line.slice(3).trim(), lines: [] };
|
|
18
|
+
}
|
|
19
|
+
else if (current) {
|
|
20
|
+
current.lines.push(line);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
intro.push(line);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (current)
|
|
27
|
+
sections.push(close(current));
|
|
28
|
+
return { title, intro: intro.join("\n").trim(), sections };
|
|
29
|
+
}
|
|
30
|
+
function close(section) {
|
|
31
|
+
return { heading: section.heading, body: section.lines.join("\n").trim() };
|
|
32
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Versione del server, uguale a quella di package.json (lo controlla prompt.test.ts). */
|
|
2
|
+
export const VERSION = "0.1.0";
|
|
3
|
+
/** Cerca un agente per id, senza distinguere maiuscole e minuscole («aisa-02» o «AISA-02»). */
|
|
4
|
+
export function findAgent(catalog, id) {
|
|
5
|
+
const wanted = id.toUpperCase();
|
|
6
|
+
for (const department of catalog) {
|
|
7
|
+
const agent = department.agents.find((a) => a.id === wanted);
|
|
8
|
+
if (agent)
|
|
9
|
+
return { department, agent };
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
/** «AISA-02 · ALTAIR». */
|
|
14
|
+
export function codeName(agent) {
|
|
15
|
+
return `${agent.id} · ${agent.star}`;
|
|
16
|
+
}
|
|
17
|
+
/** Una riga per agente, per l'elenco dei prompt e il tool elenca_agenti. */
|
|
18
|
+
export function agentSummary({ department, agent }) {
|
|
19
|
+
const position = agent.number === 1 ? "direttore" : "specialista";
|
|
20
|
+
return `${agent.role}, ${position} del reparto ${department.code} (${department.name}).`;
|
|
21
|
+
}
|
|
22
|
+
export function agentText({ department, agent }, task) {
|
|
23
|
+
const parts = [
|
|
24
|
+
`# ${codeName(agent)} — ${agent.role}`,
|
|
25
|
+
`Sei ${codeName(agent)}, un agente IA di Agentrica: ${agentSummary({ department, agent })} ` +
|
|
26
|
+
"Lavori nel progetto dell'utente. Seguono le regole comuni del tuo reparto e il tuo file di ruolo: applicale al progetto così com'è, senza presumere stack, comandi o file che non hai verificato. " +
|
|
27
|
+
"Questi testi sono in italiano: rispondi nella lingua in cui ti scrive l'utente.",
|
|
28
|
+
"## Regole comuni del reparto",
|
|
29
|
+
...block(department.rules.intro, department.rules.sections),
|
|
30
|
+
`## Ruolo: ${agent.role}`,
|
|
31
|
+
...block(agent.intro, agent.sections),
|
|
32
|
+
];
|
|
33
|
+
const trimmed = task?.trim();
|
|
34
|
+
if (trimmed)
|
|
35
|
+
parts.push("## Compito", trimmed);
|
|
36
|
+
return parts.join("\n\n") + "\n";
|
|
37
|
+
}
|
|
38
|
+
// Le sezioni dei file sono «##»: qui scendono di un livello, sotto i titoli della cornice.
|
|
39
|
+
function block(intro, sections) {
|
|
40
|
+
return [intro, ...sections.map((s) => `### ${s.heading}\n\n${s.body}`)].filter((part) => part !== "");
|
|
41
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Server MCP di Agentrica su stdio: un prompt per agente e due tool (elenca_agenti, agente).
|
|
3
|
+
// Legge solo i file di agents/ all'avvio; non scrive file, non apre connessioni e non registra dati.
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { DEPARTMENTS, loadCatalog } from "../../catalog/src/index.js";
|
|
6
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { agentSummary, agentText, codeName, findAgent, VERSION } from "./prompt.js";
|
|
10
|
+
// agents/ è in un punto fisso rispetto a questo file, senza risalire le cartelle: la cartella corrente è il progetto
|
|
11
|
+
// dell'utente e non deve poter fornire un'altra agents/. Tre livelli sopra c'è agents/ sia da un clone
|
|
12
|
+
// (packages/mcp/src → la root del repository) sia nel pacchetto (dist/mcp/src → la root del pacchetto, dove prepack
|
|
13
|
+
// copia agents/). Il catalogo è importato per percorso relativo, così tsc lo compila dentro dist e il pacchetto non
|
|
14
|
+
// dipende da @agentrica/catalog.
|
|
15
|
+
const AGENTS_DIR = join(import.meta.dirname, "..", "..", "..", "agents");
|
|
16
|
+
let catalog;
|
|
17
|
+
try {
|
|
18
|
+
catalog = loadCatalog(AGENTS_DIR);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// Senza catalogo completo il server non parte: niente contenuti parziali. Una riga sola, il client la mostra nei log.
|
|
22
|
+
process.stderr.write(`agentrica: catalogo non leggibile in ${AGENTS_DIR}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const all = catalog.flatMap((department) => department.agents.map((agent) => ({ department, agent })));
|
|
26
|
+
const codes = DEPARTMENTS.map((d) => d.code);
|
|
27
|
+
const server = new McpServer({ name: "agentrica", version: VERSION }, {
|
|
28
|
+
instructions: `Agentrica: ${all.length} agenti IA specializzati in ${catalog.length} reparti (${codes.join(", ")}). ` +
|
|
29
|
+
"Per scegliere un agente usa elenca_agenti; per lavorare come quell'agente carica le sue istruzioni con agente. " +
|
|
30
|
+
"I prompt hanno il nome dell'id dell'agente, es. aisa-02.",
|
|
31
|
+
});
|
|
32
|
+
const TASK = z.string().max(20_000).optional().describe("Il compito da affidare all'agente nel progetto corrente.");
|
|
33
|
+
const READ_ONLY = { readOnlyHint: true, openWorldHint: false };
|
|
34
|
+
for (const found of all) {
|
|
35
|
+
const title = `${codeName(found.agent)} — ${found.agent.role}`;
|
|
36
|
+
server.registerPrompt(found.agent.id.toLowerCase(), { title, description: agentSummary(found), argsSchema: { compito: TASK } }, ({ compito }) => ({
|
|
37
|
+
description: title,
|
|
38
|
+
messages: [{ role: "user", content: { type: "text", text: agentText(found, compito) } }],
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
server.registerTool("elenca_agenti", {
|
|
42
|
+
title: "Elenca gli agenti di Agentrica",
|
|
43
|
+
description: "Elenca gli agenti di Agentrica con id, nome in codice, ruolo e reparto. Il reparto è facoltativo.",
|
|
44
|
+
inputSchema: { reparto: z.enum(codes).optional().describe("Sigla del reparto.") },
|
|
45
|
+
annotations: READ_ONLY,
|
|
46
|
+
}, ({ reparto }) => {
|
|
47
|
+
const lines = catalog
|
|
48
|
+
.filter((d) => !reparto || d.code === reparto)
|
|
49
|
+
.flatMap((d) => [
|
|
50
|
+
`## ${d.code} — ${d.name}`,
|
|
51
|
+
d.summary,
|
|
52
|
+
...d.agents.map((agent) => `- ${codeName(agent)}: ${agentSummary({ department: d, agent })}`),
|
|
53
|
+
"",
|
|
54
|
+
]);
|
|
55
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
56
|
+
});
|
|
57
|
+
server.registerTool("agente", {
|
|
58
|
+
title: "Istruzioni di un agente",
|
|
59
|
+
description: "Restituisce le istruzioni complete di un agente (regole comuni del reparto e file di ruolo), da seguire per lavorare come quell'agente.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
id: z.string().regex(/^[A-Za-z]{4,5}-\d{2}$/, "Formato dell'id: SIGLA-NN, es. AISA-02.").describe("Id dell'agente, es. AISA-02."),
|
|
62
|
+
compito: TASK,
|
|
63
|
+
},
|
|
64
|
+
annotations: READ_ONLY,
|
|
65
|
+
}, ({ id, compito }) => {
|
|
66
|
+
const found = findAgent(catalog, id);
|
|
67
|
+
if (!found) {
|
|
68
|
+
return {
|
|
69
|
+
isError: true,
|
|
70
|
+
content: [{ type: "text", text: "Agente non trovato: usa elenca_agenti per vedere gli id." }],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { content: [{ type: "text", text: agentText(found, compito) }] };
|
|
74
|
+
});
|
|
75
|
+
await server.connect(new StdioServerTransport());
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentrica/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "I 56 agenti IA di Agentrica come server MCP locale (stdio): un prompt per agente e due tool in sola lettura.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Giulio Simone Floresta",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/flgisimone/agentrica.git",
|
|
10
|
+
"directory": "packages/mcp"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["mcp", "model-context-protocol", "agents", "claude"],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"bin": {
|
|
15
|
+
"agentrica-mcp": "dist/mcp/src/server.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"agents",
|
|
20
|
+
"README.en.md"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"prepack": "rm -rf dist agents LICENSE && tsc -p tsconfig.build.json && cp -R ../../agents agents && cp ../../LICENSE LICENSE"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
30
|
+
"zod": "4.6.7"
|
|
31
|
+
}
|
|
32
|
+
}
|