@pipeworx/mcp-open-corporates 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,55 @@
1
+ # mcp-open-corporates
2
+
3
+ OpenCorporates MCP — Global company registry data (free, no auth, rate limited)
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 965+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+
12
+ ## Quick Start
13
+
14
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "open-corporates": {
20
+ "url": "https://gateway.pipeworx.io/open-corporates/mcp"
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ Or connect to the full Pipeworx gateway for access to all 965+ data sources:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "pipeworx": {
32
+ "url": "https://gateway.pipeworx.io/mcp"
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Using with ask_pipeworx
39
+
40
+ Instead of calling tools directly, you can ask questions in plain English:
41
+
42
+ ```
43
+ ask_pipeworx({ question: "your question about Open Corporates data" })
44
+ ```
45
+
46
+ The gateway picks the right tool and fills the arguments automatically.
47
+
48
+ ## More
49
+
50
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
51
+ - [pipeworx.io](https://pipeworx.io)
52
+
53
+ ## License
54
+
55
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-open-corporates",
3
+ "version": "0.1.0",
4
+ "description": "OpenCorporates MCP — Global company registry data (free, no auth, rate limited)",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "open-corporates"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-open-corporates"
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/open-corporates",
4
+ "title": "Open Corporates",
5
+ "description": "OpenCorporates MCP — Global company registry data (free, no auth, rate limited)",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/open-corporates",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-open-corporates",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/open-corporates/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,235 @@
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
+ * OpenCorporates MCP — Global company registry data (free, no auth, rate limited)
21
+ *
22
+ * Tools:
23
+ * - search_companies: search companies by name and country
24
+ * - get_company: get company details by jurisdiction and company number
25
+ * - search_officers: search company officers/directors by name
26
+ */
27
+
28
+
29
+ const BASE = 'https://api.opencorporates.com/v0.4';
30
+
31
+ // ── Types ─────────────────────────────────────────────────────────────
32
+
33
+ type OCCompany = {
34
+ name?: string | null;
35
+ company_number?: string | null;
36
+ jurisdiction_code?: string | null;
37
+ incorporation_date?: string | null;
38
+ dissolution_date?: string | null;
39
+ company_type?: string | null;
40
+ registry_url?: string | null;
41
+ opencorporates_url?: string | null;
42
+ current_status?: string | null;
43
+ registered_address_in_full?: string | null;
44
+ industry_codes?: { code?: string; description?: string }[] | null;
45
+ source?: { publisher?: string; url?: string } | null;
46
+ alternative_names?: { company_name?: string; type?: string }[] | null;
47
+ agent_name?: string | null;
48
+ agent_address?: string | null;
49
+ previous_names?: { company_name?: string }[] | null;
50
+ branch_status?: string | null;
51
+ };
52
+
53
+ type OCOfficer = {
54
+ id?: number | null;
55
+ name?: string | null;
56
+ position?: string | null;
57
+ start_date?: string | null;
58
+ end_date?: string | null;
59
+ opencorporates_url?: string | null;
60
+ occupation?: string | null;
61
+ nationality?: string | null;
62
+ company?: {
63
+ name?: string | null;
64
+ company_number?: string | null;
65
+ jurisdiction_code?: string | null;
66
+ opencorporates_url?: string | null;
67
+ } | null;
68
+ };
69
+
70
+ type OCSearchResponse<T> = {
71
+ api_version?: string;
72
+ results: {
73
+ companies?: { company: T }[];
74
+ officers?: { officer: T }[];
75
+ total_pages?: number;
76
+ total_count?: number;
77
+ page?: number;
78
+ per_page?: number;
79
+ };
80
+ };
81
+
82
+ type OCCompanyResponse = {
83
+ results: {
84
+ company: OCCompany;
85
+ };
86
+ };
87
+
88
+ function formatCompany(c: OCCompany) {
89
+ return {
90
+ name: c.name ?? null,
91
+ company_number: c.company_number ?? null,
92
+ jurisdiction: c.jurisdiction_code ?? null,
93
+ status: c.current_status ?? null,
94
+ type: c.company_type ?? null,
95
+ incorporation_date: c.incorporation_date ?? null,
96
+ dissolution_date: c.dissolution_date ?? null,
97
+ registered_address: c.registered_address_in_full ?? null,
98
+ agent_name: c.agent_name ?? null,
99
+ registry_url: c.registry_url ?? null,
100
+ opencorporates_url: c.opencorporates_url ?? null,
101
+ industry_codes: (c.industry_codes ?? []).map((ic) => ({
102
+ code: ic.code ?? null,
103
+ description: ic.description ?? null,
104
+ })),
105
+ previous_names: (c.previous_names ?? []).map((pn) => pn.company_name ?? null).filter(Boolean),
106
+ branch_status: c.branch_status ?? null,
107
+ };
108
+ }
109
+
110
+ function formatOfficer(o: OCOfficer) {
111
+ return {
112
+ id: o.id ?? null,
113
+ name: o.name ?? null,
114
+ position: o.position ?? null,
115
+ start_date: o.start_date ?? null,
116
+ end_date: o.end_date ?? null,
117
+ occupation: o.occupation ?? null,
118
+ nationality: o.nationality ?? null,
119
+ company_name: o.company?.name ?? null,
120
+ company_number: o.company?.company_number ?? null,
121
+ company_jurisdiction: o.company?.jurisdiction_code ?? null,
122
+ opencorporates_url: o.opencorporates_url ?? null,
123
+ };
124
+ }
125
+
126
+ // ── Tool definitions ──────────────────────────────────────────────────
127
+
128
+ const tools: McpToolExport['tools'] = [
129
+ {
130
+ name: 'search_companies',
131
+ description:
132
+ 'Search global company registries by name. Returns company name, jurisdiction, status, type, incorporation date, and registered address. Covers 140+ jurisdictions worldwide. Example: search_companies("Tesla", country="us")',
133
+ inputSchema: {
134
+ type: 'object',
135
+ properties: {
136
+ query: { type: 'string', description: 'Company name to search (e.g., "Acme Corp")' },
137
+ country: { type: 'string', description: 'ISO 2-letter country code (e.g., "us", "gb", "de")' },
138
+ },
139
+ required: ['query'],
140
+ },
141
+ },
142
+ {
143
+ name: 'get_company',
144
+ description:
145
+ 'Get full details for a specific company by jurisdiction and company number. Returns registration details, officers, filings, and industry codes. Example: get_company("us_de", "4483789") for a Delaware company.',
146
+ inputSchema: {
147
+ type: 'object',
148
+ properties: {
149
+ jurisdiction: { type: 'string', description: 'Jurisdiction code (e.g., "us_de" for Delaware, "gb" for UK, "ca_on" for Ontario)' },
150
+ number: { type: 'string', description: 'Company registration number' },
151
+ },
152
+ required: ['jurisdiction', 'number'],
153
+ },
154
+ },
155
+ {
156
+ name: 'search_officers',
157
+ description:
158
+ 'Search company officers and directors by name. Returns officer name, position, company, start/end dates, and nationality. Example: search_officers("Elon Musk")',
159
+ inputSchema: {
160
+ type: 'object',
161
+ properties: {
162
+ query: { type: 'string', description: 'Officer name to search (e.g., "John Smith")' },
163
+ },
164
+ required: ['query'],
165
+ },
166
+ },
167
+ ];
168
+
169
+ // ── callTool dispatcher ───────────────────────────────────────────────
170
+
171
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
172
+ switch (name) {
173
+ case 'search_companies':
174
+ return searchCompanies(args.query as string, args.country as string | undefined);
175
+ case 'get_company':
176
+ return getCompany(args.jurisdiction as string, args.number as string);
177
+ case 'search_officers':
178
+ return searchOfficers(args.query as string);
179
+ default:
180
+ throw new Error(`Unknown tool: ${name}`);
181
+ }
182
+ }
183
+
184
+ // ── Tool implementations ─────────────────────────────────────────────
185
+
186
+ async function searchCompanies(query: string, country?: string) {
187
+ const params = new URLSearchParams({ q: query, format: 'json' });
188
+ if (country) params.set('country_code', country);
189
+
190
+ const res = await fetch(`${BASE}/companies/search?${params}`, {
191
+ headers: { Accept: 'application/json' },
192
+ });
193
+ if (!res.ok) throw new Error(`OpenCorporates API error: ${res.status}`);
194
+
195
+ const data = (await res.json()) as OCSearchResponse<OCCompany>;
196
+ const companies = (data.results.companies ?? []).map((c) => formatCompany(c.company));
197
+
198
+ return {
199
+ query,
200
+ total: data.results.total_count ?? companies.length,
201
+ returned: companies.length,
202
+ companies,
203
+ };
204
+ }
205
+
206
+ async function getCompany(jurisdiction: string, number: string) {
207
+ const res = await fetch(`${BASE}/companies/${jurisdiction}/${number}?format=json`, {
208
+ headers: { Accept: 'application/json' },
209
+ });
210
+ if (!res.ok) throw new Error(`OpenCorporates API error (${res.status}): company ${jurisdiction}/${number} not found`);
211
+
212
+ const data = (await res.json()) as OCCompanyResponse;
213
+ return formatCompany(data.results.company);
214
+ }
215
+
216
+ async function searchOfficers(query: string) {
217
+ const params = new URLSearchParams({ q: query, format: 'json' });
218
+
219
+ const res = await fetch(`${BASE}/officers/search?${params}`, {
220
+ headers: { Accept: 'application/json' },
221
+ });
222
+ if (!res.ok) throw new Error(`OpenCorporates API error: ${res.status}`);
223
+
224
+ const data = (await res.json()) as OCSearchResponse<OCOfficer>;
225
+ const officers = (data.results.officers ?? []).map((o) => formatOfficer(o.officer));
226
+
227
+ return {
228
+ query,
229
+ total: data.results.total_count ?? officers.length,
230
+ returned: officers.length,
231
+ officers,
232
+ };
233
+ }
234
+
235
+ 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
+ }