@adityanair98/api-oracle 0.5.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.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -0
  3. package/dist/cli.d.ts +11 -0
  4. package/dist/cli.js +74 -0
  5. package/dist/dashboard/public/app.js +1004 -0
  6. package/dist/dashboard/public/index.html +142 -0
  7. package/dist/dashboard/public/public/app.js +1004 -0
  8. package/dist/dashboard/public/public/index.html +142 -0
  9. package/dist/dashboard/public/public/styles.css +1464 -0
  10. package/dist/dashboard/public/styles.css +1464 -0
  11. package/dist/dashboard/routes/api.d.ts +7 -0
  12. package/dist/dashboard/routes/api.js +245 -0
  13. package/dist/dashboard/server.d.ts +9 -0
  14. package/dist/dashboard/server.js +45 -0
  15. package/dist/index.d.ts +5 -0
  16. package/dist/index.js +23 -0
  17. package/dist/knowledge/db.d.ts +22 -0
  18. package/dist/knowledge/db.js +182 -0
  19. package/dist/knowledge/schema.d.ts +275 -0
  20. package/dist/knowledge/schema.js +135 -0
  21. package/dist/knowledge/scorer.d.ts +63 -0
  22. package/dist/knowledge/scorer.js +314 -0
  23. package/dist/knowledge/search.d.ts +37 -0
  24. package/dist/knowledge/search.js +111 -0
  25. package/dist/knowledge/synonyms.d.ts +36 -0
  26. package/dist/knowledge/synonyms.js +523 -0
  27. package/dist/knowledge/tfidf.d.ts +42 -0
  28. package/dist/knowledge/tfidf.js +138 -0
  29. package/dist/server.d.ts +9 -0
  30. package/dist/server.js +40 -0
  31. package/dist/tools/check-freshness.d.ts +9 -0
  32. package/dist/tools/check-freshness.js +95 -0
  33. package/dist/tools/compare-apis.d.ts +8 -0
  34. package/dist/tools/compare-apis.js +149 -0
  35. package/dist/tools/find-api.d.ts +9 -0
  36. package/dist/tools/find-api.js +120 -0
  37. package/dist/tools/get-setup-guide.d.ts +8 -0
  38. package/dist/tools/get-setup-guide.js +127 -0
  39. package/dist/updater/linter.d.ts +31 -0
  40. package/dist/updater/linter.js +219 -0
  41. package/dist/updater/report.d.ts +29 -0
  42. package/dist/updater/report.js +96 -0
  43. package/dist/updater/staleness.d.ts +39 -0
  44. package/dist/updater/staleness.js +66 -0
  45. package/dist/updater/version-tracker.d.ts +28 -0
  46. package/dist/updater/version-tracker.js +50 -0
  47. package/dist/utils/config.d.ts +11 -0
  48. package/dist/utils/config.js +13 -0
  49. package/dist/utils/logger.d.ts +20 -0
  50. package/dist/utils/logger.js +32 -0
  51. package/package.json +56 -0
  52. package/src/entries/ai/anthropic.json +95 -0
  53. package/src/entries/ai/eleven-labs.json +90 -0
  54. package/src/entries/ai/openai.json +95 -0
  55. package/src/entries/ai/replicate.json +87 -0
  56. package/src/entries/ai/resemble-ai.json +88 -0
  57. package/src/entries/ai/stability-ai.json +89 -0
  58. package/src/entries/analytics/posthog.json +88 -0
  59. package/src/entries/analytics/sentry.json +84 -0
  60. package/src/entries/auth/auth0.json +90 -0
  61. package/src/entries/auth/clerk.json +95 -0
  62. package/src/entries/cms/contentful.json +92 -0
  63. package/src/entries/cms/sanity.json +92 -0
  64. package/src/entries/cms/strapi.json +93 -0
  65. package/src/entries/commerce/medusa.json +91 -0
  66. package/src/entries/commerce/shopify-api.json +91 -0
  67. package/src/entries/communication/sendbird.json +85 -0
  68. package/src/entries/communication/stream-chat.json +94 -0
  69. package/src/entries/database/firebase.json +88 -0
  70. package/src/entries/database/neon.json +94 -0
  71. package/src/entries/database/planetscale.json +95 -0
  72. package/src/entries/database/supabase.json +94 -0
  73. package/src/entries/database/upstash.json +94 -0
  74. package/src/entries/devops/fly-io.json +90 -0
  75. package/src/entries/devops/netlify.json +90 -0
  76. package/src/entries/devops/railway.json +90 -0
  77. package/src/entries/devops/vercel.json +90 -0
  78. package/src/entries/email/mailgun.json +91 -0
  79. package/src/entries/email/postmark.json +91 -0
  80. package/src/entries/email/resend.json +89 -0
  81. package/src/entries/email/sendgrid.json +90 -0
  82. package/src/entries/forms/formspark.json +85 -0
  83. package/src/entries/forms/typeform.json +98 -0
  84. package/src/entries/infrastructure/aws-s3.json +104 -0
  85. package/src/entries/infrastructure/cloudflare-r2.json +92 -0
  86. package/src/entries/infrastructure/cloudflare-workers.json +92 -0
  87. package/src/entries/infrastructure/digital-ocean-spaces.json +87 -0
  88. package/src/entries/integration/nango.json +90 -0
  89. package/src/entries/integration/zapier.json +92 -0
  90. package/src/entries/maps/google-maps.json +89 -0
  91. package/src/entries/maps/mapbox.json +87 -0
  92. package/src/entries/media/deepgram.json +84 -0
  93. package/src/entries/media/imgix.json +84 -0
  94. package/src/entries/media/mux.json +94 -0
  95. package/src/entries/messaging/ably.json +94 -0
  96. package/src/entries/messaging/pusher.json +94 -0
  97. package/src/entries/messaging/twilio.json +94 -0
  98. package/src/entries/messaging/vonage.json +89 -0
  99. package/src/entries/notifications/knock.json +84 -0
  100. package/src/entries/notifications/novu.json +84 -0
  101. package/src/entries/notifications/onesignal.json +84 -0
  102. package/src/entries/payments/lemonsqueezy.json +91 -0
  103. package/src/entries/payments/paddle.json +90 -0
  104. package/src/entries/payments/paypal.json +91 -0
  105. package/src/entries/payments/razorpay.json +85 -0
  106. package/src/entries/payments/square.json +91 -0
  107. package/src/entries/payments/stripe.json +96 -0
  108. package/src/entries/scheduling/cal-com.json +90 -0
  109. package/src/entries/scheduling/calendly.json +90 -0
  110. package/src/entries/search/algolia.json +96 -0
  111. package/src/entries/security/arcjet.json +89 -0
  112. package/src/entries/security/snyk.json +90 -0
  113. package/src/entries/storage/cloudinary.json +93 -0
  114. package/src/entries/storage/uploadthing.json +90 -0
  115. package/src/entries/testing/browserstack.json +86 -0
  116. package/src/entries/testing/checkly.json +89 -0
  117. package/src/entries/workflow/inngest.json +88 -0
  118. package/src/entries/workflow/temporal.json +90 -0
  119. package/src/entries/workflow/trigger-dev.json +89 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 API Oracle contributors
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,216 @@
1
+ # API Oracle
2
+
3
+ An MCP server that gives Claude Code the ability to find, evaluate, and recommend the best API for any programming task.
4
+
5
+ When a developer asks *"what should I use to send emails?"* — API Oracle returns a structured recommendation with working code, honest gotchas, pricing details, and everything needed to get started immediately.
6
+
7
+ [![CI](https://github.com/adityanair/api-oracle/actions/workflows/ci.yml/badge.svg)](https://github.com/adityanair/api-oracle/actions/workflows/ci.yml)
8
+
9
+ ---
10
+
11
+ ## MCP Tools
12
+
13
+ | Tool | What it does |
14
+ |------|-------------|
15
+ | `find_best_api` | Recommends the best API for a task with quick-start code |
16
+ | `compare_apis` | Side-by-side comparison of 2–5 APIs |
17
+ | `get_api_setup_guide` | Full setup instructions for a specific API |
18
+ | `check_api_freshness` | Staleness report showing which entries need re-verification |
19
+
20
+ ## Knowledge Base — 68 APIs across 23 categories
21
+
22
+ | Category | APIs |
23
+ |----------|------|
24
+ | AI | Anthropic, OpenAI, Replicate, Resemble AI, Stability AI, ElevenLabs |
25
+ | Analytics | PostHog, Sentry |
26
+ | Auth | Auth0, Clerk |
27
+ | CMS | Contentful, Sanity, Strapi |
28
+ | Commerce | Medusa, Shopify API |
29
+ | Communication | Sendbird, Stream Chat |
30
+ | Database | Firebase, Neon, PlanetScale, Supabase, Upstash |
31
+ | DevOps | Fly.io, Netlify, Railway, Vercel |
32
+ | Email | Mailgun, Postmark, Resend, SendGrid |
33
+ | Forms | Formspark, Typeform |
34
+ | Infrastructure | AWS S3, Cloudflare R2, Cloudflare Workers, DigitalOcean Spaces |
35
+ | Integration | Nango, Zapier |
36
+ | Maps | Google Maps, Mapbox |
37
+ | Media | Deepgram, imgix, Mux |
38
+ | Messaging | Ably, Pusher, Twilio, Vonage |
39
+ | Notifications | Knock, Novu, OneSignal |
40
+ | Payments | LemonSqueezy, Paddle, PayPal, Razorpay, Square, Stripe |
41
+ | Scheduling | Cal.com, Calendly |
42
+ | Search | Algolia |
43
+ | Security | Arcjet, Snyk |
44
+ | Storage | Cloudinary, UploadThing |
45
+ | Testing | BrowserStack, Checkly |
46
+ | Workflow | Inngest, Temporal, Trigger.dev |
47
+
48
+ ---
49
+
50
+ ## Quick Start
51
+
52
+ ### Option A — npx (no install)
53
+
54
+ ```bash
55
+ npx @adityanair98/api-oracle serve
56
+ ```
57
+
58
+ ### Option B — global install
59
+
60
+ ```bash
61
+ npm install -g @adityanair98/api-oracle
62
+ api-oracle serve
63
+ ```
64
+
65
+ ### Connect to Claude Code
66
+
67
+ Add to `~/.claude/claude_desktop_config.json` under `mcpServers`:
68
+
69
+ ```json
70
+ {
71
+ "mcpServers": {
72
+ "api-oracle": {
73
+ "command": "npx",
74
+ "args": ["@adityanair98/api-oracle", "serve"]
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ Restart Claude Code. The `api-oracle` server will appear in your MCP servers list.
81
+
82
+ ---
83
+
84
+ ## Web Dashboard
85
+
86
+ API Oracle includes a local web dashboard to browse, search, and manage the knowledge base.
87
+
88
+ ```bash
89
+ api-oracle dashboard
90
+ # Opens at http://localhost:3737
91
+ ```
92
+
93
+ Dashboard features:
94
+ - Browse all 68 APIs with search and category filtering
95
+ - Quality scores, staleness indicators, pricing info
96
+ - Detail modal with full entry: code examples, gotchas, rate limits
97
+ - Refresh report — shows which entries need re-verification
98
+ - Quality linter — content quality checks beyond schema validation
99
+ - Search test tool — inspect score breakdowns for any query
100
+
101
+ ---
102
+
103
+ ## From Source
104
+
105
+ ### 1. Clone and install
106
+
107
+ ```bash
108
+ git clone https://github.com/adityanair/api-oracle.git
109
+ cd api-oracle
110
+ npm install
111
+ ```
112
+
113
+ ### 2. Build and seed
114
+
115
+ ```bash
116
+ npm run build
117
+ npm run seed
118
+ ```
119
+
120
+ ### 3. Run
121
+
122
+ ```bash
123
+ # MCP server (stdio)
124
+ node dist/cli.js serve
125
+
126
+ # Web dashboard
127
+ node dist/cli.js dashboard
128
+ ```
129
+
130
+ ### Development scripts
131
+
132
+ ```bash
133
+ npm run dev # Run MCP server with tsx (no build needed)
134
+ npm test # Run all tests (160 tests)
135
+ npm run validate # Validate all JSON entries + cross-references
136
+ npm run lint-entries # Content quality linter (0 errors, 15 warnings)
137
+ npm run e2e # End-to-end query scenarios (43 assertions)
138
+ npm run dashboard # Start dashboard with tsx
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Environment Variables
144
+
145
+ | Variable | Default | Description |
146
+ |----------|---------|-------------|
147
+ | `DB_PATH` | `./data/api-oracle.db` | SQLite database path |
148
+ | `PORT` | `3737` | Dashboard server port |
149
+ | `LOG_LEVEL` | `info` | Log level: debug \| info \| warn \| error |
150
+
151
+ ---
152
+
153
+ ## Adding New APIs
154
+
155
+ 1. Create `src/entries/<category>/<slug>.json`
156
+ 2. Fill in all schema fields (see `docs/adding-apis.md`)
157
+ 3. `npm run validate` — verify schema and cross-references
158
+ 4. `npm run seed` — load into database
159
+ 5. `npm test` — run tests
160
+
161
+ See [docs/adding-apis.md](docs/adding-apis.md) for the full guide and JSON template.
162
+
163
+ ---
164
+
165
+ ## Architecture
166
+
167
+ ```
168
+ src/
169
+ ├── cli.ts # CLI entry point (api-oracle serve|dashboard)
170
+ ├── index.ts # MCP server entry point
171
+ ├── server.ts # McpServer setup + tool registration
172
+ ├── tools/ # MCP tool handlers
173
+ │ ├── find-api.ts # find_best_api
174
+ │ ├── compare-apis.ts # compare_apis
175
+ │ ├── get-setup-guide.ts# get_api_setup_guide
176
+ │ └── check-freshness.ts# check_api_freshness
177
+ ├── knowledge/ # Core logic
178
+ │ ├── schema.ts # Zod schema + TypeScript types
179
+ │ ├── db.ts # SQLite CRUD (better-sqlite3)
180
+ │ ├── search.ts # Search pipeline orchestration
181
+ │ ├── scorer.ts # Weighted multi-factor ranking engine
182
+ │ ├── synonyms.ts # Query expansion + category detection
183
+ │ └── tfidf.ts # TF-IDF in-memory search index
184
+ ├── updater/ # Freshness and quality system
185
+ │ ├── staleness.ts # Staleness level detection
186
+ │ ├── report.ts # Freshness report builder
187
+ │ ├── linter.ts # Content quality linter
188
+ │ └── version-tracker.ts# Entry version management
189
+ ├── dashboard/ # Web dashboard
190
+ │ ├── server.ts # Express server
191
+ │ ├── routes/api.ts # REST API routes
192
+ │ └── public/ # Vanilla HTML/CSS/JS frontend
193
+ ├── entries/ # 68 JSON API entries
194
+ │ └── <category>/<slug>.json
195
+ └── utils/
196
+ ├── logger.ts # Structured stderr logger
197
+ └── config.ts # Environment config
198
+ ```
199
+
200
+ ## How Search Works
201
+
202
+ 1. **Phrase detection** — extracts `preferFree`, `preferOpenSource`, etc. from natural language
203
+ 2. **Synonym expansion** — "crashes" → error tracking; "log in" → auth; "billing" → payments
204
+ 3. **Category detection** — maps query to a category with confidence score
205
+ 4. **TF-IDF candidate selection** — field-weighted index pre-ranks all 68 entries
206
+ 5. **Multi-factor scoring** — useCaseFit (40%) + quality (25%) + devExperience (20%) + pricingFit (15%)
207
+ 6. **Category boost** — entries in the detected category receive up to 12% score boost
208
+ 7. **Confidence** — top result gets a 0–1 confidence score
209
+
210
+ See [docs/scoring-logic.md](docs/scoring-logic.md) for full details.
211
+
212
+ ---
213
+
214
+ ## License
215
+
216
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * API Oracle CLI entry point.
4
+ *
5
+ * Usage:
6
+ * api-oracle serve — Start the MCP server (default)
7
+ * api-oracle dashboard — Start the web dashboard
8
+ * api-oracle --help — Print usage
9
+ * api-oracle --version — Print version
10
+ */
11
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * API Oracle CLI entry point.
4
+ *
5
+ * Usage:
6
+ * api-oracle serve — Start the MCP server (default)
7
+ * api-oracle dashboard — Start the web dashboard
8
+ * api-oracle --help — Print usage
9
+ * api-oracle --version — Print version
10
+ */
11
+ import { createRequire } from "module";
12
+ import { initDb } from "./knowledge/db.js";
13
+ import { config } from "./utils/config.js";
14
+ const require = createRequire(import.meta.url);
15
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports
16
+ const pkg = require("../package.json");
17
+ const HELP = `
18
+ API Oracle — MCP server for API discovery and recommendations
19
+
20
+ Usage:
21
+ api-oracle [command]
22
+
23
+ Commands:
24
+ serve Start the MCP server on stdio (default)
25
+ dashboard Start the web dashboard at http://localhost:3737
26
+
27
+ Options:
28
+ --help, -h Show this help message
29
+ --version Show version
30
+
31
+ Environment variables:
32
+ DB_PATH Path to SQLite database (default: ./data/api-oracle.db)
33
+ PORT Dashboard port (default: 3737)
34
+ LOG_LEVEL Log level: debug | info | warn | error (default: info)
35
+
36
+ Example Claude Code configuration (~/.claude/claude_desktop_config.json):
37
+ {
38
+ "api-oracle": {
39
+ "command": "npx",
40
+ "args": ["@adityanair98/api-oracle", "serve"]
41
+ }
42
+ }
43
+ `.trimStart();
44
+ async function main() {
45
+ const args = process.argv.slice(2);
46
+ const command = args[0] ?? "serve";
47
+ if (command === "--help" || command === "-h") {
48
+ process.stdout.write(HELP);
49
+ process.exit(0);
50
+ }
51
+ if (command === "--version") {
52
+ process.stdout.write(`${pkg.name} v${pkg.version}\n`);
53
+ process.exit(0);
54
+ }
55
+ if (command === "dashboard") {
56
+ initDb(config.dbPath);
57
+ const { startDashboard } = await import("./dashboard/server.js");
58
+ startDashboard();
59
+ return;
60
+ }
61
+ if (command === "serve" || command === "") {
62
+ // Default: MCP server on stdio
63
+ initDb(config.dbPath);
64
+ const { startServer } = await import("./server.js");
65
+ await startServer();
66
+ return;
67
+ }
68
+ process.stderr.write(`Unknown command: ${command}\n${HELP}`);
69
+ process.exit(1);
70
+ }
71
+ main().catch((err) => {
72
+ process.stderr.write(`Fatal error: ${String(err)}\n`);
73
+ process.exit(1);
74
+ });