@pipeworx/mcp-ai-incident-db 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.md +58 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +171 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# mcp-ai-incident-db
|
|
2
|
+
|
|
3
|
+
AI Incident Database (AIID) MCP
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 250+ live data sources.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `get_incident` | Fetch full incident record with linked reports. |
|
|
12
|
+
| `list_recent` | Most recently added incidents. |
|
|
13
|
+
| `list_taxonomies` | Taxonomies used to classify incidents (CSET-AIID, GMF, RAIC). |
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"ai-incident-db": {
|
|
23
|
+
"url": "https://gateway.pipeworx.io/ai-incident-db/mcp"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or connect to the full Pipeworx gateway for access to all 250+ data sources:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"pipeworx": {
|
|
35
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Using with ask_pipeworx
|
|
42
|
+
|
|
43
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
ask_pipeworx({ question: "your question about Ai Incident Db data" })
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
50
|
+
|
|
51
|
+
## More
|
|
52
|
+
|
|
53
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
54
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-ai-incident-db",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI Incident Database (AIID) MCP",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "ai-incident-db"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-ai-incident-db"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/ai-incident-db",
|
|
4
|
+
"title": "Ai Incident Db",
|
|
5
|
+
"description": "AI Incident Database (AIID) MCP",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/ai-incident-db",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-ai-incident-db",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/ai-incident-db/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
meter?: { credits: number };
|
|
15
|
+
cost?: Record<string, unknown>;
|
|
16
|
+
provider?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* AI Incident Database (AIID) MCP
|
|
21
|
+
*
|
|
22
|
+
* The AIID is a community-curated record of harms caused by deployed AI
|
|
23
|
+
* systems. Each incident links to news reports, classifications, and
|
|
24
|
+
* impacted parties.
|
|
25
|
+
*
|
|
26
|
+
* Auth: none.
|
|
27
|
+
* Underlying API is GraphQL-backed; we expose a small REST-shaped surface
|
|
28
|
+
* via the public discover endpoints + Algolia search.
|
|
29
|
+
*
|
|
30
|
+
* Public site: https://incidentdatabase.ai/
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const GRAPHQL = 'https://incidentdatabase.ai/api/graphql';
|
|
35
|
+
|
|
36
|
+
const tools: McpToolExport['tools'] = [
|
|
37
|
+
{
|
|
38
|
+
name: 'search_incidents',
|
|
39
|
+
description:
|
|
40
|
+
'Search the AI Incident Database. Combines free-text with date range filters. Returns incident IDs, titles, dates, and a short blurb.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
query: { type: 'string', description: 'Free-text — title / description' },
|
|
45
|
+
start_date: { type: 'string', description: 'YYYY-MM-DD lower bound on incident date' },
|
|
46
|
+
end_date: { type: 'string', description: 'YYYY-MM-DD upper bound' },
|
|
47
|
+
limit: { type: 'number', description: '1-200 (default 25)' },
|
|
48
|
+
offset: { type: 'number', description: '0-based offset' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'get_incident',
|
|
54
|
+
description: 'Fetch full incident record with linked reports.',
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
incident_id: { type: 'number', description: 'Numeric AIID incident id' },
|
|
59
|
+
},
|
|
60
|
+
required: ['incident_id'],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'list_recent',
|
|
65
|
+
description: 'Most recently added incidents.',
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties: { limit: { type: 'number', description: '1-50 (default 10)' } },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'list_taxonomies',
|
|
73
|
+
description: 'Taxonomies used to classify incidents (CSET-AIID, GMF, RAIC).',
|
|
74
|
+
inputSchema: { type: 'object', properties: {} },
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
79
|
+
switch (name) {
|
|
80
|
+
case 'search_incidents':
|
|
81
|
+
return searchIncidents(args);
|
|
82
|
+
case 'get_incident':
|
|
83
|
+
return getIncident(reqNum(args, 'incident_id', '42'));
|
|
84
|
+
case 'list_recent':
|
|
85
|
+
return listRecent(Math.min(50, Math.max(1, (args.limit as number) ?? 10)));
|
|
86
|
+
case 'list_taxonomies':
|
|
87
|
+
return listTaxonomies();
|
|
88
|
+
default:
|
|
89
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function searchIncidents(args: Record<string, unknown>) {
|
|
94
|
+
const filter: Record<string, unknown> = {};
|
|
95
|
+
if (args.query) filter['title'] = { CONTAINS: String(args.query) };
|
|
96
|
+
if (args.start_date) filter['date'] = { ...(filter.date as object ?? {}), GTE: String(args.start_date) };
|
|
97
|
+
if (args.end_date) filter['date'] = { ...(filter.date as object ?? {}), LTE: String(args.end_date) };
|
|
98
|
+
const limit = Math.min(200, Math.max(1, (args.limit as number) ?? 25));
|
|
99
|
+
const skip = Math.max(0, (args.offset as number) ?? 0);
|
|
100
|
+
const query = `query SearchIncidents($filter: IncidentFilterType, $pagination: PaginationType, $sort: IncidentSortType) {
|
|
101
|
+
incidents(filter: $filter, pagination: $pagination, sort: $sort) {
|
|
102
|
+
incident_id title date description editors_notes
|
|
103
|
+
}
|
|
104
|
+
}`;
|
|
105
|
+
return graphql(query, {
|
|
106
|
+
filter,
|
|
107
|
+
pagination: { limit, skip },
|
|
108
|
+
sort: { date: 'DESC' },
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function getIncident(id: number) {
|
|
113
|
+
const query = `query GetIncident($filter: IncidentFilterType) {
|
|
114
|
+
incident(filter: $filter) {
|
|
115
|
+
incident_id title date description editors_notes
|
|
116
|
+
AllegedDeployerOfAISystem AllegedDeveloperOfAISystem AllegedHarmedOrNearlyHarmedParties
|
|
117
|
+
reports { report_number title url source_domain date_published authors language }
|
|
118
|
+
editors { userId }
|
|
119
|
+
}
|
|
120
|
+
}`;
|
|
121
|
+
return graphql(query, { filter: { incident_id: { EQ: id } } });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function listRecent(limit: number) {
|
|
125
|
+
const query = `query Recent($pagination: PaginationType, $sort: IncidentSortType) {
|
|
126
|
+
incidents(pagination: $pagination, sort: $sort) {
|
|
127
|
+
incident_id title date description
|
|
128
|
+
}
|
|
129
|
+
}`;
|
|
130
|
+
return graphql(query, { pagination: { limit, skip: 0 }, sort: { date: 'DESC' } });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function listTaxonomies() {
|
|
134
|
+
const query = `query Taxonomies {
|
|
135
|
+
taxas { namespace description weight }
|
|
136
|
+
}`;
|
|
137
|
+
return graphql(query, {});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function graphql(query: string, variables: Record<string, unknown>) {
|
|
141
|
+
const res = await fetch(GRAPHQL, {
|
|
142
|
+
method: 'POST',
|
|
143
|
+
headers: {
|
|
144
|
+
'Content-Type': 'application/json',
|
|
145
|
+
Accept: 'application/json',
|
|
146
|
+
'User-Agent': 'pipeworx-mcp-ai-incident-db/1.0 (+https://pipeworx.io)',
|
|
147
|
+
// AIID's GraphQL endpoint checks Origin against an allow-list.
|
|
148
|
+
Origin: 'https://incidentdatabase.ai',
|
|
149
|
+
},
|
|
150
|
+
body: JSON.stringify({ query, variables }),
|
|
151
|
+
});
|
|
152
|
+
if (!res.ok) {
|
|
153
|
+
const t = await res.text();
|
|
154
|
+
throw new Error(`AIID error: ${res.status} ${t.slice(0, 200)}`);
|
|
155
|
+
}
|
|
156
|
+
const data = (await res.json()) as { data?: unknown; errors?: { message: string }[] };
|
|
157
|
+
if (data.errors?.length) {
|
|
158
|
+
throw new Error(`AIID GraphQL error: ${data.errors.map((e) => e.message).join('; ')}`);
|
|
159
|
+
}
|
|
160
|
+
return data.data;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function reqNum(args: Record<string, unknown>, key: string, example: string): number {
|
|
164
|
+
const v = args[key];
|
|
165
|
+
if (typeof v !== 'number' || !Number.isFinite(v)) {
|
|
166
|
+
throw new Error(`Required argument "${key}" must be a number. Example: ${example}.`);
|
|
167
|
+
}
|
|
168
|
+
return v;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|