@riv-lc/areacode-mcp 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 +77 -0
- package/dist/index.js +96 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Reindex Ventures LLC
|
|
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,77 @@
|
|
|
1
|
+
# areacode-mcp
|
|
2
|
+
|
|
3
|
+
**North American (NANP) area-code & phone-number intelligence for AI agents.**
|
|
4
|
+
|
|
5
|
+
An [MCP](https://modelcontextprotocol.io) server that gives Claude, Cursor, and
|
|
6
|
+
other agents a small, trusted reference for US & Canada phone numbering — area
|
|
7
|
+
codes, NANP validation, local time, city/state coverage, overlays, and
|
|
8
|
+
scam/spoofing context. Backed by [**areacode.fyi**](https://areacode.fyi), which
|
|
9
|
+
publishes directly from the official NANPA numbering database. Every result
|
|
10
|
+
includes a canonical `areacode.fyi` URL and the source date.
|
|
11
|
+
|
|
12
|
+
> **Scope.** This is area-code-level **reference and education** — not a
|
|
13
|
+
> carrier/identity API. It does **not** return a caller's identity, exact
|
|
14
|
+
> location, or live/ported carrier, and caller ID can be spoofed, so a number's
|
|
15
|
+
> area code never proves who is calling. For caller identity you need a
|
|
16
|
+
> carrier-grade (LRN/HLR) provider.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
Run it with `npx` (no install needed) — add it to your client's MCP config.
|
|
21
|
+
|
|
22
|
+
**Claude Desktop** (`claude_desktop_config.json`) / **Cursor** (`~/.cursor/mcp.json`):
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"mcpServers": {
|
|
27
|
+
"areacode": {
|
|
28
|
+
"command": "npx",
|
|
29
|
+
"args": ["-y", "@riv-lc/areacode-mcp"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
That's it — restart your client and the tools below are available.
|
|
36
|
+
|
|
37
|
+
## Tools
|
|
38
|
+
|
|
39
|
+
| Tool | What it does |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `lookup_area_code` | Country, state/province, cities, time zone, current local time, overlays, nearby codes |
|
|
42
|
+
| `lookup_phone_number` | Parse/validate a NANP number → area code, region, local time, E.164 |
|
|
43
|
+
| `area_codes_for_city` | Area codes serving a city (optionally disambiguated by state) |
|
|
44
|
+
| `area_codes_for_state` | Every area code in a US state or Canadian province |
|
|
45
|
+
| `is_scam_area_code` | Whether an area code is associated with scams + spoofing context |
|
|
46
|
+
| `check_number_reputation` | Unverified, crowd-sourced community signal (low / mid / high) for a number |
|
|
47
|
+
| `explain_area_code_topic` | Source-backed explainers: neighbor spoofing, overlays vs splits, toll-free, area-code-vs-country-code, temporary numbers |
|
|
48
|
+
|
|
49
|
+
## Example prompts
|
|
50
|
+
|
|
51
|
+
- *"A lead entered phone number +1 702-555-0199. Where are they likely located and what time is it there?"*
|
|
52
|
+
- *"I got a call from 469 — is that area code suspicious?"*
|
|
53
|
+
- *"Which area codes cover Las Vegas?"*
|
|
54
|
+
- *"Normalize this list of US/Canada numbers and flag any that are invalid or toll-free."*
|
|
55
|
+
- *"Explain neighbor spoofing for a help-center article."*
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
| Env var | Default | Purpose |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| `AREACODE_API_BASE` | `https://areacode.fyi` | Point at a different host (e.g. a self-hosted or staging API) |
|
|
62
|
+
|
|
63
|
+
## Data & sourcing
|
|
64
|
+
|
|
65
|
+
Tools call the public `https://areacode.fyi/api/v1` JSON API, which reads the
|
|
66
|
+
same dataset the site renders — sourced from the official **North American
|
|
67
|
+
Numbering Plan Administrator (NANPA)** database and refreshed monthly. Each
|
|
68
|
+
response carries `source`, `canonical_url`, and `data_date` so answers can cite
|
|
69
|
+
where the data came from.
|
|
70
|
+
|
|
71
|
+
The `check_number_reputation` signal is **unverified and crowd-sourced**
|
|
72
|
+
(`low` = people looked the number up; `mid`/`high` = it has user reports). It is
|
|
73
|
+
never proof that a specific number is fraudulent.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT © Reindex Ventures. Built for [areacode.fyi](https://areacode.fyi).
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* areacode-mcp — North American (NANP) area-code & phone-number intelligence
|
|
4
|
+
* for AI agents. A thin MCP server over the areacode.fyi public API
|
|
5
|
+
* (https://areacode.fyi/api/v1). Every result carries a canonical areacode.fyi
|
|
6
|
+
* URL + the NANPA source date.
|
|
7
|
+
*
|
|
8
|
+
* Scope: area-code-level reference + education. It does NOT return a caller's
|
|
9
|
+
* identity, exact location, or live/ported carrier — and caller ID can be
|
|
10
|
+
* spoofed, so a number's area code never proves who is calling.
|
|
11
|
+
*
|
|
12
|
+
* Config: set AREACODE_API_BASE to point at a different host (default
|
|
13
|
+
* https://areacode.fyi).
|
|
14
|
+
*/
|
|
15
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
const API_BASE = (process.env.AREACODE_API_BASE || "https://areacode.fyi").replace(/\/+$/, "") + "/api/v1";
|
|
19
|
+
const enc = encodeURIComponent;
|
|
20
|
+
/** Fetch an API path and return it as an MCP tool result (raw JSON text). */
|
|
21
|
+
async function api(path) {
|
|
22
|
+
try {
|
|
23
|
+
const res = await fetch(API_BASE + path, {
|
|
24
|
+
headers: { accept: "application/json", "user-agent": "areacode-mcp" },
|
|
25
|
+
});
|
|
26
|
+
const text = await res.text();
|
|
27
|
+
return { content: [{ type: "text", text }], isError: !res.ok };
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: JSON.stringify({ error: `Request to ${API_BASE} failed: ${e.message}` }),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
isError: true,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const server = new McpServer({ name: "areacode-mcp", version: "0.1.0" });
|
|
42
|
+
server.registerTool("lookup_area_code", {
|
|
43
|
+
title: "Look up an area code",
|
|
44
|
+
description: "Look up a North American (NANP) area code: country, state/province, principal city and served cities, time zone, current local time, 10-digit-dialing flag, overlay codes, and nearby codes. Returns a canonical areacode.fyi URL and the NANPA source date.",
|
|
45
|
+
inputSchema: { code: z.string().describe('A 3-digit area code, e.g. "702".') },
|
|
46
|
+
}, ({ code }) => api(`/area-code/${enc(code)}`));
|
|
47
|
+
server.registerTool("lookup_phone_number", {
|
|
48
|
+
title: "Look up a phone number",
|
|
49
|
+
description: "Parse and validate a US/Canada (NANP) phone number. Returns whether the format is valid, the E.164 form, the area code, the likely region and time zone, and the current local time there. Area-code level only — NOT the caller's identity, exact location, or live carrier; caller ID can be spoofed.",
|
|
50
|
+
inputSchema: { number: z.string().describe('A phone number in any format, e.g. "+1 702-555-0199".') },
|
|
51
|
+
}, ({ number }) => api(`/phone/${enc(number)}`));
|
|
52
|
+
server.registerTool("area_codes_for_city", {
|
|
53
|
+
title: "Area codes for a city",
|
|
54
|
+
description: "List the area codes that serve a US or Canadian city. Optionally pass a state/province to disambiguate cities that share a name.",
|
|
55
|
+
inputSchema: {
|
|
56
|
+
city: z.string().describe('City name, e.g. "Las Vegas".'),
|
|
57
|
+
state: z
|
|
58
|
+
.string()
|
|
59
|
+
.optional()
|
|
60
|
+
.describe('Optional state/province name or 2-letter code to disambiguate, e.g. "NV".'),
|
|
61
|
+
},
|
|
62
|
+
}, ({ city, state }) => api(`/area-codes?city=${enc(city)}${state ? `&state=${enc(state)}` : ""}`));
|
|
63
|
+
server.registerTool("area_codes_for_state", {
|
|
64
|
+
title: "Area codes for a state/province",
|
|
65
|
+
description: "List every area code in a US state or Canadian province.",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
state: z.string().describe('State/province name or 2-letter code, e.g. "Nevada" or "ON".'),
|
|
68
|
+
},
|
|
69
|
+
}, ({ state }) => api(`/area-codes?state=${enc(state)}`));
|
|
70
|
+
server.registerTool("is_scam_area_code", {
|
|
71
|
+
title: "Is an area code a scam?",
|
|
72
|
+
description: "Explain whether an area code is associated with scams. An area code is never a scam by itself; this returns that context plus spoofing notes — caller ID can be faked, so judge calls by what they ask for, not the area code.",
|
|
73
|
+
inputSchema: { code: z.string().describe('A 3-digit area code, e.g. "702".') },
|
|
74
|
+
}, ({ code }) => api(`/scam/${enc(code)}`));
|
|
75
|
+
server.registerTool("check_number_reputation", {
|
|
76
|
+
title: "Check a number's community reputation",
|
|
77
|
+
description: "Return the UNVERIFIED, crowd-sourced community signal for a US/Canada number from areacode.fyi: 'low' (people have looked it up), 'mid'/'high' (it has user reports). Caller ID can be spoofed — this is never proof a specific number is fraudulent.",
|
|
78
|
+
inputSchema: { number: z.string().describe('A US/Canada phone number, e.g. "702-555-0199".') },
|
|
79
|
+
}, ({ number }) => api(`/reputation/${enc(number)}`));
|
|
80
|
+
server.registerTool("explain_area_code_topic", {
|
|
81
|
+
title: "Explain a phone / area-code topic",
|
|
82
|
+
description: "Source-backed explanation of a phone-numbering topic, suitable for answering end users.",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
topic: z
|
|
85
|
+
.enum([
|
|
86
|
+
"neighbor_spoofing",
|
|
87
|
+
"overlays",
|
|
88
|
+
"toll_free",
|
|
89
|
+
"country_code_vs_area_code",
|
|
90
|
+
"temporary_phone_numbers",
|
|
91
|
+
])
|
|
92
|
+
.describe("The topic to explain."),
|
|
93
|
+
},
|
|
94
|
+
}, ({ topic }) => api(`/explain/${enc(topic)}`));
|
|
95
|
+
const transport = new StdioServerTransport();
|
|
96
|
+
await server.connect(transport);
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@riv-lc/areacode-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "North American (NANP) area-code & phone-number intelligence for AI agents — an MCP server backed by areacode.fyi.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"areacode-mcp": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public",
|
|
14
|
+
"registry": "https://registry.npmjs.org"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"prepare": "npm run build",
|
|
22
|
+
"start": "node dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"mcp",
|
|
26
|
+
"model-context-protocol",
|
|
27
|
+
"modelcontextprotocol",
|
|
28
|
+
"area-code",
|
|
29
|
+
"nanp",
|
|
30
|
+
"phone-number",
|
|
31
|
+
"telephony",
|
|
32
|
+
"claude",
|
|
33
|
+
"ai-agents",
|
|
34
|
+
"areacode.fyi"
|
|
35
|
+
],
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"author": "Reindex Ventures",
|
|
38
|
+
"homepage": "https://areacode.fyi",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/riv-lc/areacode-mcp.git"
|
|
42
|
+
},
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/riv-lc/areacode-mcp/issues"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
48
|
+
"zod": "^4.4.3"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^26.0.0",
|
|
52
|
+
"typescript": "^6.0.3"
|
|
53
|
+
}
|
|
54
|
+
}
|