@pipeworx/mcp-data-economie-fr 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 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-data-economie-fr
2
+
3
+ France Economy & Finance Open Data (data.economie.gouv.fr) — OpenDataSoft MCP.
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1118+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+ | `search_datasets` | Search France Economy & Finance Open Data for datasets by keyword (public finance, companies, taxation, procurement & economic indicators). Returns dataset_ids (pass to query/dataset_info), titles, themes and record counts. |
12
+ | `dataset_info` | Get metadata for one France Economy & Finance Open Data dataset (fields/schema, themes, record count) — call before query to learn the column names. |
13
+ | `query` | Query records from a France Economy & Finance Open Data dataset with ODSQL. Filter (where), aggregate (group_by/select), sort (order_by), paginate (limit/offset). |
14
+
15
+ ## Quick Start
16
+
17
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "data-economie-fr": {
23
+ "url": "https://gateway.pipeworx.io/data-economie-fr/mcp"
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ Or connect to the full Pipeworx gateway for access to all 1118+ 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 Data Economie Fr 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-data-economie-fr",
3
+ "version": "0.1.0",
4
+ "description": "France Economy & Finance Open Data (data.economie.gouv.fr) — OpenDataSoft MCP.",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "data-economie-fr"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-data-economie-fr"
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/data-economie-fr",
4
+ "title": "Data Economie Fr",
5
+ "description": "France Economy & Finance Open Data (data.economie.gouv.fr) — OpenDataSoft MCP.",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/data-economie-fr",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-data-economie-fr",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/data-economie-fr/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,100 @@
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
+ * France Economy & Finance Open Data (data.economie.gouv.fr) — OpenDataSoft MCP.
21
+ *
22
+ * France Economy & Finance Open Data — open data for the French Ministry of the Economy & Finance via the OpenDataSoft Explore v2.1 API: public finance, companies, taxation, procurement & economic indicators. Keyless.
23
+ * Use `search_datasets` (find a dataset_id) -> `dataset_info` (schema) -> `query` (ODSQL records).
24
+ */
25
+
26
+
27
+ const BASE = 'https://data.economie.gouv.fr';
28
+ const UA = 'pipeworx-mcp-data-economie-fr/1.0 (+https://pipeworx.io)';
29
+
30
+ const tools: McpToolExport['tools'] = [
31
+ {
32
+ name: 'search_datasets',
33
+ description: 'Search France Economy & Finance Open Data for datasets by keyword (public finance, companies, taxation, procurement & economic indicators). Returns dataset_ids (pass to query/dataset_info), titles, themes and record counts.',
34
+ inputSchema: { type: 'object', properties: {
35
+ query: { type: 'string', description: 'Keyword(s) to search dataset titles/descriptions.' },
36
+ limit: { type: 'number', description: 'Max datasets (1-100, default 20).' },
37
+ offset: { type: 'number', description: 'Pagination offset (default 0).' },
38
+ } },
39
+ },
40
+ {
41
+ name: 'dataset_info',
42
+ description: 'Get metadata for one France Economy & Finance Open Data dataset (fields/schema, themes, record count) — call before query to learn the column names.',
43
+ inputSchema: { type: 'object', properties: {
44
+ dataset_id: { type: 'string', description: 'Dataset id from search_datasets.' },
45
+ }, required: ['dataset_id'] },
46
+ },
47
+ {
48
+ name: 'query',
49
+ description: 'Query records from a France Economy & Finance Open Data dataset with ODSQL. Filter (where), aggregate (group_by/select), sort (order_by), paginate (limit/offset).',
50
+ inputSchema: { type: 'object', properties: {
51
+ dataset_id: { type: 'string', description: 'Dataset id from search_datasets.' },
52
+ query: { type: 'string', description: 'Free-text keyword across all fields (optional).' },
53
+ where: { type: 'string', description: 'ODSQL filter, e.g. `year >= 2020 AND city = "Paris"` (overrides query).' },
54
+ select: { type: 'string', description: 'ODSQL select/aggregation, e.g. `count(*) as n, sum(amount)`.' },
55
+ group_by: { type: 'string', description: 'ODSQL group_by field(s).' },
56
+ order_by: { type: 'string', description: 'Sort, e.g. `date desc`.' },
57
+ limit: { type: 'number', description: 'Max records (1-100, default 20).' },
58
+ offset: { type: 'number', description: 'Pagination offset (default 0).' },
59
+ }, required: ['dataset_id'] },
60
+ },
61
+ ];
62
+
63
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
64
+ switch (name) {
65
+ case 'search_datasets': {
66
+ const p = new URLSearchParams();
67
+ if (args.query) p.set('where', `search(*, "${esc(String(args.query))}")`);
68
+ p.set('limit', String(clamp(numArg(args.limit, 20), 1, 100)));
69
+ p.set('offset', String(Math.max(0, numArg(args.offset, 0))));
70
+ return get(`/api/explore/v2.1/catalog/datasets?${p}`);
71
+ }
72
+ case 'dataset_info':
73
+ return get(`/api/explore/v2.1/catalog/datasets/${encodeURIComponent(reqStr(args, 'dataset_id', '"<id>"'))}`);
74
+ case 'query': {
75
+ const id = reqStr(args, 'dataset_id', '"<id>"');
76
+ const p = new URLSearchParams();
77
+ if (args.where) p.set('where', String(args.where));
78
+ else if (args.query) p.set('where', `search(*, "${esc(String(args.query))}")`);
79
+ if (args.select) p.set('select', String(args.select));
80
+ if (args.group_by) p.set('group_by', String(args.group_by));
81
+ if (args.order_by) p.set('order_by', String(args.order_by));
82
+ p.set('limit', String(clamp(numArg(args.limit, 20), 1, 100)));
83
+ p.set('offset', String(Math.max(0, numArg(args.offset, 0))));
84
+ return get(`/api/explore/v2.1/catalog/datasets/${encodeURIComponent(id)}/records?${p}`);
85
+ }
86
+ default: throw new Error(`Unknown tool: ${name}`);
87
+ }
88
+ }
89
+
90
+ async function get(path: string): Promise<unknown> {
91
+ const res = await fetch(`${BASE}${path}`, { headers: { Accept: 'application/json', 'User-Agent': UA } });
92
+ if (!res.ok) throw new Error(`France Economy & Finance Open Data: ${res.status} ${await res.text().then((t) => t.slice(0, 160))}`);
93
+ return res.json();
94
+ }
95
+ function esc(s: string): string { return s.replace(/"/g, '\\"'); }
96
+ function reqStr(args: Record<string, unknown>, k: string, ex: string): string { const v = args[k]; if (typeof v !== 'string' || !v.trim()) throw new Error(`Required argument "${k}" is missing. Pass a string like ${ex} (from search_datasets).`); return v; }
97
+ function numArg(v: unknown, d: number): number { const n = typeof v === 'number' ? v : typeof v === 'string' ? Number(v) : NaN; return Number.isFinite(n) ? n : d; }
98
+ function clamp(n: number, lo: number, hi: number): number { return Math.max(lo, Math.min(hi, Math.trunc(n))); }
99
+
100
+ 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
+ }