@cyanheads/geonames-mcp-server 0.0.0-stage → 0.1.1

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.
Files changed (86) hide show
  1. package/AGENTS.md +438 -0
  2. package/CLAUDE.md +438 -0
  3. package/Dockerfile +177 -0
  4. package/LICENSE +201 -0
  5. package/README.md +316 -2
  6. package/changelog/0.1.x/0.1.0.md +9 -0
  7. package/changelog/0.1.x/0.1.1.md +22 -0
  8. package/changelog/template.md +151 -0
  9. package/dist/config/server-config.d.ts +13 -0
  10. package/dist/config/server-config.d.ts.map +1 -0
  11. package/dist/config/server-config.js +21 -0
  12. package/dist/config/server-config.js.map +1 -0
  13. package/dist/index.d.ts +8 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +30 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts +90 -0
  18. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts.map +1 -0
  19. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js +262 -0
  20. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js.map +1 -0
  21. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts +88 -0
  22. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts.map +1 -0
  23. package/dist/mcp-server/tools/definitions/get-children.tool.js +248 -0
  24. package/dist/mcp-server/tools/definitions/get-children.tool.js.map +1 -0
  25. package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts +90 -0
  26. package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts.map +1 -0
  27. package/dist/mcp-server/tools/definitions/get-countries.tool.js +217 -0
  28. package/dist/mcp-server/tools/definitions/get-countries.tool.js.map +1 -0
  29. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts +64 -0
  30. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts.map +1 -0
  31. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js +168 -0
  32. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js.map +1 -0
  33. package/dist/mcp-server/tools/definitions/get-place.tool.d.ts +108 -0
  34. package/dist/mcp-server/tools/definitions/get-place.tool.d.ts.map +1 -0
  35. package/dist/mcp-server/tools/definitions/get-place.tool.js +300 -0
  36. package/dist/mcp-server/tools/definitions/get-place.tool.js.map +1 -0
  37. package/dist/mcp-server/tools/definitions/index.d.ts +735 -0
  38. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  39. package/dist/mcp-server/tools/definitions/index.js +23 -0
  40. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  41. package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts +103 -0
  42. package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts.map +1 -0
  43. package/dist/mcp-server/tools/definitions/list-reference.tool.js +233 -0
  44. package/dist/mcp-server/tools/definitions/list-reference.tool.js.map +1 -0
  45. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts +134 -0
  46. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts.map +1 -0
  47. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js +381 -0
  48. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js.map +1 -0
  49. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts +133 -0
  50. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts.map +1 -0
  51. package/dist/mcp-server/tools/definitions/search-places.tool.js +348 -0
  52. package/dist/mcp-server/tools/definitions/search-places.tool.js.map +1 -0
  53. package/dist/mcp-server/tools/shared-inputs.d.ts +97 -0
  54. package/dist/mcp-server/tools/shared-inputs.d.ts.map +1 -0
  55. package/dist/mcp-server/tools/shared-inputs.js +156 -0
  56. package/dist/mcp-server/tools/shared-inputs.js.map +1 -0
  57. package/dist/services/geonames/feature-codes.d.ts +27 -0
  58. package/dist/services/geonames/feature-codes.d.ts.map +1 -0
  59. package/dist/services/geonames/feature-codes.js +723 -0
  60. package/dist/services/geonames/feature-codes.js.map +1 -0
  61. package/dist/services/geonames/geonames-service.d.ts +98 -0
  62. package/dist/services/geonames/geonames-service.d.ts.map +1 -0
  63. package/dist/services/geonames/geonames-service.js +555 -0
  64. package/dist/services/geonames/geonames-service.js.map +1 -0
  65. package/dist/services/geonames/response-cache.d.ts +24 -0
  66. package/dist/services/geonames/response-cache.d.ts.map +1 -0
  67. package/dist/services/geonames/response-cache.js +44 -0
  68. package/dist/services/geonames/response-cache.js.map +1 -0
  69. package/dist/services/geonames/response-parsers.d.ts +34 -0
  70. package/dist/services/geonames/response-parsers.d.ts.map +1 -0
  71. package/dist/services/geonames/response-parsers.js +350 -0
  72. package/dist/services/geonames/response-parsers.js.map +1 -0
  73. package/dist/services/geonames/types.d.ts +218 -0
  74. package/dist/services/geonames/types.d.ts.map +1 -0
  75. package/dist/services/geonames/types.js +10 -0
  76. package/dist/services/geonames/types.js.map +1 -0
  77. package/dist/services/geonames/upstream-errors.d.ts +54 -0
  78. package/dist/services/geonames/upstream-errors.d.ts.map +1 -0
  79. package/dist/services/geonames/upstream-errors.js +187 -0
  80. package/dist/services/geonames/upstream-errors.js.map +1 -0
  81. package/dist/utils/inline-text.d.ts +25 -0
  82. package/dist/utils/inline-text.d.ts.map +1 -0
  83. package/dist/utils/inline-text.js +60 -0
  84. package/dist/utils/inline-text.js.map +1 -0
  85. package/package.json +108 -4
  86. package/server.json +114 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,317 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <h1>@cyanheads/geonames-mcp-server</h1>
3
+ <p><b>Search GeoNames places, walk admin hierarchies, reverse geocode, get postal codes and country info via MCP. STDIO or Streamable HTTP.</b>
4
+ <div>8 Tools</div>
5
+ </p>
6
+ </div>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ <div align="center">
9
+
10
+ [![Version](https://img.shields.io/badge/Version-0.1.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/geonames-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.1.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/geonames-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/geonames-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.2-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
+
12
+ </div>
13
+
14
+ <div align="center">
15
+
16
+ [![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/geonames-mcp-server/releases/latest/download/geonames-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=geonames-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZ2VvbmFtZXMtbWNwLXNlcnZlciJdLCJlbnYiOnsiR0VPTkFNRVNfVVNFUk5BTUUiOiJ5b3VyX2dlb25hbWVzX3VzZXJuYW1lIn19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22geonames-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fgeonames-mcp-server%22%5D%2C%22env%22%3A%7B%22GEONAMES_USERNAME%22%3A%22your_geonames_username%22%7D%7D)
17
+
18
+ [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## Overview
25
+
26
+ The [GeoNames](https://www.geonames.org/) gazetteer: 13M+ places worldwide, each keyed by a stable integer `geonameId` and linked into an administrative tree from continent to neighborhood. Search places by name and filters, read a place's full record, climb or descend its admin hierarchy, reverse geocode a coordinate, look up postal codes, and read country facts. Runs as a stdio process or a local Streamable HTTP server.
27
+
28
+ ### Tools
29
+
30
+ | Tool | Description |
31
+ |:---|:---|
32
+ | `geonames_search_places` | Search places by name, country, feature class or code, population tier, and bounding box |
33
+ | `geonames_get_place` | Full record for one `geonameId`: admin chain, timezone, elevation, alternate names, postal codes, external identifiers |
34
+ | `geonames_get_hierarchy` | Parent chain from Earth and the continent down to the feature |
35
+ | `geonames_get_children` | Direct children of a feature in the administrative, tourism, geography, or dependency tree |
36
+ | `geonames_reverse_geocode` | Country and admin subdivisions (or the ocean) for a coordinate, plus the nearest places or features and an optional timezone |
37
+ | `geonames_find_postal_codes` | Postal codes by code, by place name, or near a coordinate |
38
+ | `geonames_get_countries` | Country facts: ISO and FIPS codes, `geonameId`, capital, population, area, languages, currency, postal-code format |
39
+ | `geonames_list_reference` | Feature classes, feature codes, and the countries with postal-code data |
40
+
41
+ ## Capability reference
42
+
43
+ ### `geonames_search_places` <sub>tool</sub>
44
+
45
+ - `query` (up to 200 characters) compared per `match`: `name_required` (default), `any_field`, `exact_name`, or `name_prefix`; filters `countries` (up to 10), `featureClasses`, `featureCodes` (up to 20), `cities` (`cities1000` / `cities5000` / `cities15000`), and `boundingBox`. A call needs `query` or at least one of `countries`, `featureClasses`, `featureCodes`, `boundingBox`
46
+ - `limit` 1–100 (default 10), `offset` 0–5000, `orderBy` `relevance` or `population`; reports `totalCount` and the `effectiveQuery` sent, and `nextOffset` names the next page
47
+ - Fails before any request with `query_or_filter_required`, `query_required`, `unknown_feature_code`, or `invalid_bounding_box`
48
+
49
+ ---
50
+
51
+ ### `geonames_get_place` <sub>tool</sub>
52
+
53
+ - One `geonameId`; an unknown id returns `found: false` with `guidance`
54
+ - `adminLevels` 1–5 with each level's code, name, and `geonameId`; timezone (UTC offsets on 1 January and 1 July), bounding box, recorded and DEM elevation, population, Wikipedia URL, `alternateNames`, `postalCodes`, `links`, and `identifiers` (IATA, ICAO, FAA, Transport Canada, UN/LOCODE, Wikidata)
55
+ - `nameLanguages` (up to 20 tags; `zh` also matches `zh-CN` and `zh-TW`) filters the alternate names only
56
+
57
+ ---
58
+
59
+ ### `geonames_get_hierarchy` <sub>tool</sub>
60
+
61
+ - One `geonameId`; `chain` runs from Earth and its continent through the country and admin divisions down to the feature, skipping levels it does not sit under
62
+ - Each level carries `geonameId`, feature class and code, country and first-level codes, coordinates, and population; an unknown id returns `found: false`
63
+
64
+ ---
65
+
66
+ ### `geonames_get_children` <sub>tool</sub>
67
+
68
+ - `hierarchy`: `administrative` (default), `tourism`, `geography`, or `dependency`; only admin divisions and populated places appear
69
+ - The child list (up to 1,000 per parent) is fetched once and cached, so `nameContains`, `limit` (1–500, default 100), and `offset` cost nothing more; a notice says when GeoNames lists more than 1,000
70
+ - An unknown id returns `found: false`; a leaf returns an empty `children` list with a notice
71
+
72
+ ---
73
+
74
+ ### `geonames_reverse_geocode` <sub>tool</sub>
75
+
76
+ - `lat` / `lng` resolve to `country` and `adminLevels` (down to ADM5, each with its `geonameId` and ISO 3166-2 subdivision code where one exists) or, offshore, the `ocean`
77
+ - `nearby` lists the nearest populated places (`nearbyLimit` 0–50, default 5; `radiusKm` up to 300, default 20; optional `cities` tier) or, when `featureClasses` / `featureCodes` is set, the nearest features of that type; `nearbyKind` says which. `cities` with a feature filter fails as `conflicting_filters`
78
+ - `includeTimezone` adds the IANA id, UTC offsets, local time, sunrise, and sunset (offsets only offshore)
79
+
80
+ ---
81
+
82
+ ### `geonames_find_postal_codes` <sub>tool</sub>
83
+
84
+ - `mode`: `code` (needs `postalCode`), `place_name` (needs `placeName`), or `nearby` (needs `lat` and `lng`; `radiusKm` up to 30, default 10); a missing field, or `countries` in `nearby`, fails as `mode_fields_mismatch`
85
+ - `countries` filter for `code` and `place_name`; `limit` 1–100 (default 10). GeoNames reports no total, so a full page is marked truncated
86
+ - Covers 122 countries; Ireland returns only Eircode routing keys and Malta only letter prefixes
87
+
88
+ ---
89
+
90
+ ### `geonames_get_countries` <sub>tool</sub>
91
+
92
+ - Up to 50 `countries` by ISO alpha-2, alpha-3, or numeric code, a `continent`, `nameContains`, or no filter for all 250; `limit` 1–250 (default 50) with `offset`
93
+ - Each row carries ISO and FIPS codes, the country's `geonameId` (the starting point for `geonames_get_children`), capital, population, area, continent, languages, currency, postal-code format, and mainland bounding box; unknown codes land in `notFound`
94
+
95
+ ---
96
+
97
+ ### `geonames_list_reference` <sub>tool</sub>
98
+
99
+ - `topic`: `feature_classes` (9), `feature_codes` (684, filterable by `featureClass`), or `postal_countries` (122, with each country's code range and count); `featureClass` with another topic fails as `filter_not_applicable`
100
+ - `nameContains`, `limit` 1–700 (default 100), and `offset`; feature classes and codes are bundled and spend no credits
101
+
102
+ ## Features
103
+
104
+ Built on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core): stdio and Streamable HTTP transports, pluggable auth (`none` / `jwt` / `oauth`), swappable storage (`in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`), structured logging with optional OpenTelemetry tracing.
105
+
106
+ GeoNames-specific:
107
+
108
+ - Data from [GeoNames](https://www.geonames.org/), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): results you pass on must credit GeoNames. This server is independent of GeoNames.
109
+ - Calls the GeoNames JSON web services at `secure.geonames.org` through a fixed parameter allowlist per endpoint, since GeoNames silently ignores a parameter it does not know
110
+ - Per-account pacing at 1,000 requests an hour, with a cooldown after a GeoNames quota error that holds only that account
111
+ - A response cache shared across callers and keyed without the account: searches for 1 hour, timezones never, every other lookup for 24 hours. A cache hit spends no credit
112
+ - Forgiving inputs: comma-separated lists, any-case enums and codes, `UK` for `GB`, a `P.PPLC` class prefix, and a geonames.org URL in place of a `geonameId`
113
+
114
+ Agent-friendly output:
115
+
116
+ - Typed failure reasons that separate the caller's account (`caller_account_rejected`) from the operator's (`server_account_rejected`), a spent quota (`quota_exhausted`, with `data.window` of `hour`, `day`, `week`, or `local`), and a value GeoNames rejected (`upstream_rejected_parameter`)
117
+ - Unknown ids return `found: false` with `guidance` rather than an error, and empty or partial pages carry a `notice` naming the next `offset` or the filter to loosen
118
+ - Placeholders GeoNames uses for "none" (`population: 0`, empty admin names, `geonameId: 0`) are dropped rather than reported as facts
119
+ - GeoNames-authored text (place, alternate, and admin names) is rendered as inline data in `content[]` and kept verbatim in `structuredContent`
120
+
121
+ Known limitations:
122
+
123
+ - **Shared quota on a shared deployment.** All callers without their own username share the server account's 1,000 credits an hour. A burst of reverse geocodes (up to 7 credits each) can exhaust it, and GeoNames does not say when the hourly window resets.
124
+ - **Search pages no further than offset 5000** on the free tier, and `limit` is capped at 100, so a result set is reachable up to its 5,100th row.
125
+ - **Children are capped at 1,000 per parent.** A notice says when GeoNames lists more than it returns.
126
+ - **Postal data covers 122 countries.** Ireland and Malta return only code prefixes. US nearby lookups place the first row at the query point rather than the ZIP centroid. GeoNames reports no total for postal searches, so truncation is inferred from a full page.
127
+ - **Coastal points can resolve to the ocean.** The subdivision lookup uses no coastal buffer, so a point just offshore returns the sea while its nearby places are on land.
128
+ - **Bounding boxes cannot cross the 180° meridian.** Split such an area into two searches.
129
+ - **Nearby radius tops out at 300 km** for places and features and 30 km for postal codes, GeoNames' free-tier ceilings.
130
+ - **Microstates and enclaves can resolve to the surrounding country.** The subdivision polygons do not always carve them out: a point inside Vatican City returns Italy.
131
+ - **Nearest populated places include sections and historical places.** In a dense city the nearest rows are often `PPLX` quarters or `PPLH` former districts; each row's `featureCode` says which, and `cities` restricts to places above a population tier.
132
+ - **Offshore timezones are offsets only.** No IANA id, local time, sunrise, or sunset is available at sea.
133
+ - **`exact_name` matches alternate and historical names**, so a result's `name` can differ from the query: "Springfield" can return Plattsburg or Palmyra, MO.
134
+ - **Data is community-edited and provided "as is".** Many features have no recorded population (reported as unavailable) or elevation.
135
+
136
+ ## Getting started
137
+
138
+ Add the following to your MCP client configuration file, with your GeoNames username in place of the placeholder.
139
+
140
+ ```json
141
+ {
142
+ "mcpServers": {
143
+ "geonames-mcp-server": {
144
+ "type": "stdio",
145
+ "command": "bunx",
146
+ "args": ["@cyanheads/geonames-mcp-server@latest"],
147
+ "env": {
148
+ "MCP_TRANSPORT_TYPE": "stdio",
149
+ "MCP_LOG_LEVEL": "info",
150
+ "GEONAMES_USERNAME": "your_geonames_username"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ Or with npx (no Bun required):
158
+
159
+ ```json
160
+ {
161
+ "mcpServers": {
162
+ "geonames-mcp-server": {
163
+ "type": "stdio",
164
+ "command": "npx",
165
+ "args": ["-y", "@cyanheads/geonames-mcp-server@latest"],
166
+ "env": {
167
+ "MCP_TRANSPORT_TYPE": "stdio",
168
+ "MCP_LOG_LEVEL": "info",
169
+ "GEONAMES_USERNAME": "your_geonames_username"
170
+ }
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ Or with Docker:
177
+
178
+ ```json
179
+ {
180
+ "mcpServers": {
181
+ "geonames-mcp-server": {
182
+ "type": "stdio",
183
+ "command": "docker",
184
+ "args": [
185
+ "run", "-i", "--rm",
186
+ "-e", "MCP_TRANSPORT_TYPE=stdio",
187
+ "-e", "GEONAMES_USERNAME=your_geonames_username",
188
+ "ghcr.io/cyanheads/geonames-mcp-server:latest"
189
+ ]
190
+ }
191
+ }
192
+ }
193
+ ```
194
+
195
+ For Streamable HTTP, set the transport and start the server:
196
+
197
+ ```sh
198
+ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 GEONAMES_USERNAME=your_geonames_username bun run start:http
199
+ # Server listens at http://localhost:3010/mcp
200
+ ```
201
+
202
+ ### Prerequisites
203
+
204
+ - [Bun v1.4.0](https://bun.sh/) or higher (or Node.js v24+).
205
+ - A free [GeoNames account](https://www.geonames.org/login) with free web services enabled on its [account page](https://www.geonames.org/manageaccount). GeoNames rejects calls from an account until they are enabled.
206
+
207
+ ### Installation
208
+
209
+ 1. **Clone the repository:**
210
+
211
+ ```sh
212
+ git clone https://github.com/cyanheads/geonames-mcp-server.git
213
+ ```
214
+
215
+ 2. **Navigate into the directory:**
216
+
217
+ ```sh
218
+ cd geonames-mcp-server
219
+ ```
220
+
221
+ 3. **Install dependencies:**
222
+
223
+ ```sh
224
+ bun install
225
+ ```
226
+
227
+ 4. **Configure environment:**
228
+
229
+ ```sh
230
+ cp .env.example .env
231
+ # edit .env and set GEONAMES_USERNAME
232
+ ```
233
+
234
+ ## Configuration
235
+
236
+ Every GeoNames call spends credits from a GeoNames account. `GEONAMES_USERNAME` is the server's account: a free GeoNames account with free web services enabled on its account page. Every tool also takes `geonamesUsername` (alias `username`), so a caller on a shared deployment can spend their own account instead of the server's. When neither is set, calls fail with `username_required`; only the bundled `feature_classes` and `feature_codes` topics of `geonames_list_reference` work without an account. The account name never appears in output, error text, logs, or cache keys.
237
+
238
+ A free account gets 1,000 credits an hour and 10,000 a day. Static lookups are cached, so a repeat call spends nothing.
239
+
240
+ | Tool | Credits per call |
241
+ |:---|:---|
242
+ | `geonames_search_places`, `geonames_get_place`, `geonames_get_hierarchy`, `geonames_get_children` | 1 |
243
+ | `geonames_find_postal_codes` | 1 (`code`, `place_name`); 2 (`nearby`) |
244
+ | `geonames_reverse_geocode` | 1 for containment, plus 3 for nearest populated places or 4 for nearest features, 1 for the ocean when no country contains the point, and 1 for the timezone |
245
+ | `geonames_get_countries` | 1 a day; the country table is cached |
246
+ | `geonames_list_reference` | 0 for `feature_classes` and `feature_codes`; 1 a day for `postal_countries` |
247
+
248
+ | Variable | Description | Default |
249
+ |:---|:---|:---|
250
+ | `GEONAMES_USERNAME` | GeoNames account used when a call passes no `geonamesUsername`. Free at geonames.org; enable free web services on its account page. | none |
251
+ | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
252
+ | `MCP_HTTP_PORT` | HTTP server port. | `3010` |
253
+ | `MCP_SESSION_MODE` | HTTP session mode: `stateless`, `stateful`, or `auto`. `.env.example` and the Docker image set `stateless`. | `auto` |
254
+ | `MCP_AUTH_MODE` | Authentication: `none`, `jwt`, or `oauth`. | `none` |
255
+ | `MCP_LOG_LEVEL` | Log level (`debug`, `info`, `warning`, `error`, etc.). | `info` |
256
+ | `LOGS_DIR` | Directory for log files (Node.js only). | `<app-root>/logs` |
257
+ | `LOG_TOOL_FAILURE_PAYLOADS` | Log each failed tool call's arguments and result, redacted by key name (`geonamesUsername` and `username` included). | `false` |
258
+ | `STORAGE_PROVIDER_TYPE` | Storage backend: `in-memory`, `filesystem`, `supabase`, `cloudflare-kv/r2/d1`. | `in-memory` |
259
+ | `OTEL_ENABLED` | Enable [OpenTelemetry](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
260
+
261
+ See [`.env.example`](./.env.example) for the full list of optional overrides.
262
+
263
+ ## Running the server
264
+
265
+ ### Local development
266
+
267
+ - **Build and run the production version**:
268
+
269
+ ```sh
270
+ # One-time build
271
+ bun run rebuild
272
+
273
+ # Run the built server
274
+ bun run start:http
275
+ # or
276
+ bun run start:stdio
277
+ ```
278
+
279
+ - **Run checks and tests**:
280
+ ```sh
281
+ bun run devcheck # Lints, formats, type-checks, and more
282
+ bun run test # Runs the test suite
283
+ ```
284
+
285
+ ## Project structure
286
+
287
+ | Directory | Purpose |
288
+ |:---|:---|
289
+ | `src/index.ts` | `createApp()` entry point: server instructions, tool registration, GeoNames service setup and teardown. |
290
+ | `src/config` | `GEONAMES_USERNAME` parsing and validation with Zod. |
291
+ | `src/mcp-server/tools` | The eight tool definitions (`*.tool.ts`) and the inputs they share (`shared-inputs.ts`). |
292
+ | `src/services/geonames` | GeoNames service: fetch boundary, status mapping, retry, per-account pacing, response cache, parsers, and the bundled feature-code table. |
293
+ | `src/utils` | Inline-text sanitizer for GeoNames-authored text in `format()` output. |
294
+ | `tests/` | Unit and integration tests, mirroring the `src/` structure. |
295
+ | `docs/design.md` | Design notes: tool surface, credential model, upstream behavior. |
296
+
297
+ ## Development guide
298
+
299
+ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
300
+
301
+ - Handlers throw, framework catches — no `try/catch` in tool logic
302
+ - Use `ctx.log` for logging, `ctx.state` for storage
303
+ - Register new tools in `src/mcp-server/tools/definitions/index.ts`
304
+ - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
305
+
306
+ ## Contributing
307
+
308
+ Issues are welcome. Run checks and tests before submitting:
309
+
310
+ ```sh
311
+ bun run devcheck
312
+ bun run test
313
+ ```
314
+
315
+ ## License
316
+
317
+ This project is licensed under the Apache 2.0 License. See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,9 @@
1
+ ---
2
+ summary: "Unpublished project scaffold from @cyanheads/mcp-ts-core — no package was released under this version."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.1.0 — 2026-09-29
8
+
9
+ Unpublished project scaffold from [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core). No package was released under this version.
@@ -0,0 +1,22 @@
1
+ ---
2
+ summary: "First published release — eight GeoNames tools for place search, full place records, admin hierarchies and children, reverse geocoding, postal codes, country facts, and reference vocabulary, spending the server's GeoNames account or the caller's own."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.1.1 — 2026-10-01
8
+
9
+ ## Added
10
+
11
+ - **`geonames_search_places`** — search 13M+ places by `query` (`match`: `name_required`, `any_field`, `exact_name`, `name_prefix`) and `countries`, `featureClasses`, `featureCodes`, `cities`, `boundingBox`; `orderBy` relevance or population, `limit` up to 100, `offset` up to 5000 with `nextOffset`. 1 credit, cached an hour.
12
+ - **`geonames_get_place`** — the full record for one `geonameId`: admin levels 1–5 with codes and ids, timezone with UTC offsets on 1 January and 1 July ([#1](https://github.com/cyanheads/geonames-mcp-server/issues/1)), elevations, alternate names (`nameLanguages` filter), postal codes, links, and airport, UN/LOCODE, and Wikidata identifiers.
13
+ - **`geonames_get_hierarchy`** — a feature's parent chain from Earth and its continent down to the feature, each level with `geonameId`, feature code, and coordinates.
14
+ - **`geonames_get_children`** — a feature's direct children in the `administrative` (default), `tourism`, `geography`, or `dependency` tree. Up to 1,000 children are fetched once and cached, so `nameContains`, `limit`, and `offset` spend no further credit.
15
+ - **`geonames_reverse_geocode`** — a coordinate's country and admin levels down to ADM5, or the ocean offshore, plus the nearest populated places or, with `featureClasses`/`featureCodes`, features; `includeTimezone` adds local time, sunrise, and sunset. 1 to 7 credits.
16
+ - **`geonames_find_postal_codes`** — `mode` `code`, `place_name`, or `nearby` (`radiusKm` up to 30) across the 122 countries with GeoNames postal data; a mode missing its fields fails as `mode_fields_mismatch`.
17
+ - **`geonames_get_countries`** — ISO alpha-2, alpha-3, numeric, and FIPS codes, `geonameId`, capital, population, area, languages, currency, and postal format, by code, `continent`, or `nameContains`; unknown codes land in `notFound`.
18
+ - **`geonames_list_reference`** — `topic` `feature_classes` (9) and `feature_codes` (684), bundled and free, or `postal_countries` (122, 1 credit a day).
19
+ - **`geonameId` inputs** accept a geonames.org URL and stop at 2147483647, the largest id GeoNames parses ([#2](https://github.com/cyanheads/geonames-mcp-server/issues/2)). List inputs also take a comma-separated string; codes match in any case, and `UK` reads as `GB`.
20
+ - **`GeoNamesService`** — one boundary to `secure.geonames.org`: per-endpoint parameter allowlists, a 20 s retry deadline, per-account pacing at 1,000 requests an hour, single-flight, and a cross-caller cache keyed without the account. GeoNames' absence placeholders (`population: 0`, `geonameId: 0`, `adminCode1: "00"`) are dropped.
21
+ - **`GEONAMES_USERNAME`** — the server's GeoNames account, optional; every tool also takes `geonamesUsername` (alias `username`) to spend the caller's own. Account failures are typed (`username_required`, `caller_account_rejected`, `server_account_rejected`, `quota_exhausted`), and the name never reaches logs, output, or cache keys.
22
+ - **Data terms** — GeoNames data is CC BY 4.0, and the server instructions tell callers to credit GeoNames when passing results on; community-edited names render as inline data in `content[]`.