Skip to content

Commit 97ee73e

Browse files
committed
fix: correctly get the ai keys from the option apiKeys
1 parent 3e3b040 commit 97ee73e

22 files changed

Lines changed: 130 additions & 267 deletions

File tree

.cursor/rules/000-project-purpose.mdc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,9 @@ export default defineNuxtConfig({
3434
],
3535
ai: {
3636
// Module options (e.g., Vercel AI provider config)
37-
keys: {
38-
openaiApiKey: process.env.OPENAI_API_KEY,
39-
},
40-
options: {
37+
devOptions: {
4138
rules: true, // Default is true
42-
mcp: {
43-
documentation: {
44-
enabled: true, // Default is true
45-
path: '/docs'
46-
}
47-
}
4839
},
49-
mcpServers: ['nuxt-ai-docs-mcp'] // Enabling tools from the plugin
5040
}
5141
})
5242

docs/content/docs/1.getting-started/1.index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,5 @@ The module is actively being developed with the following capabilities:
4343
- ✅ Generate Nuxt rules from examples for different AI clients
4444
- ✅ Generate MCP server to help with developer experience
4545
- ✅ Implement auto-imported AI helpers
46-
- 🚧 Generate MCP server to help with managing documentation for Nuxt Project
4746

4847
We're constantly working to improve and expand the functionality of Nuxt AI.

docs/content/docs/1.getting-started/2.installation.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,9 @@ You can add additional configuration to enable specific features and providers:
4343
export default defineNuxtConfig({
4444
modules: ['@josephanson/nuxt-ai'],
4545
ai: {
46-
// Module options (e.g., Vercel AI provider config)
47-
apiKeys: {
48-
openaiApiKey: process.env.OPENAI_API_KEY,
49-
},
5046
devOptions: {
5147
client: 'cursor', // Default AI client to use
5248
rules: true, // Default is true
53-
mcp: {
54-
documentation: {
55-
enabled: true, // Default is true
56-
path: '/docs'
57-
}
58-
}
5949
}
6050
}
6151
})

docs/content/docs/1.getting-started/3.configuration.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Configure API keys for various AI providers. It's recommended to use environment
2323
export default defineNuxtConfig({
2424
ai: {
2525
keys: {
26-
openaiApiKey: process.env.OPENAI_API_KEY,
27-
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
26+
openaiApiKey: import.meta.env.OPENAI_API_KEY,
27+
anthropicApiKey: import.meta.env.ANTHROPIC_API_KEY,
2828
// Add other provider keys as needed
2929
}
3030
}
@@ -40,12 +40,6 @@ export default defineNuxtConfig({
4040
ai: {
4141
options: {
4242
rules: true, // Enable AI assistant rules
43-
mcp: {
44-
documentation: {
45-
enabled: true, // Enable documentation tools
46-
path: '/docs' // Documentation path
47-
}
48-
}
4943
}
5044
}
5145
})
@@ -55,20 +49,6 @@ export default defineNuxtConfig({
5549

5650
The Model Context Protocol (MCP) server provides additional development tools and can be configured with the `mcp` option.
5751

58-
### `mcpServers`
59-
60-
You can enable specific MCP server plugins:
61-
62-
```ts [nuxt.config.ts]
63-
export default defineNuxtConfig({
64-
ai: {
65-
mcpServers: [
66-
'josephanson/nuxt-ai-docs-mcp' // Enable documentation helper mcp plugin
67-
]
68-
}
69-
})
70-
```
71-
7252
### `mcp.enabled`
7353

7454
Toggle the MCP server on or off. Default is `true` in development and `false` in production.

docs/content/docs/1.getting-started/4.basic-usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ import { defineEventHandler } from 'h3'
9090
import OpenAI from 'openai'
9191

9292
const openai = new OpenAI({
93-
apiKey: process.env.OPENAI_API_KEY!,
93+
apiKey: import.meta.env.OPENAI_API_KEY!,
9494
})
9595

9696
export default defineEventHandler(async (event) => {
@@ -117,7 +117,7 @@ import Anthropic from '@anthropic-ai/sdk'
117117
import { defineEventHandler } from 'h3'
118118

119119
const anthropic = new Anthropic({
120-
apiKey: process.env.ANTHROPIC_API_KEY!,
120+
apiKey: import.meta.env.ANTHROPIC_API_KEY!,
121121
})
122122

123123
export default defineEventHandler(async (event) => {

docs/content/docs/2.ai-sdk/1.index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ Secure handling of API keys through Nuxt configuration:
4141
export default defineNuxtConfig({
4242
ai: {
4343
keys: {
44-
openaiApiKey: process.env.OPENAI_API_KEY,
45-
anthropicApiKey: process.env.ANTHROPIC_API_KEY
44+
openaiApiKey: import.meta.env.OPENAI_API_KEY,
45+
anthropicApiKey: import.meta.env.ANTHROPIC_API_KEY
4646
}
4747
}
4848
})

docs/content/docs/3.mcp-server/2.configuration.md

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ export default defineNuxtConfig({
1616
devOptions: {
1717
mcp: {
1818
enabled: true, // Enable MCP server
19-
documentation: {
20-
enabled: true,
21-
path: '/docs'
22-
},
23-
servers: ['nuxt-ai-docs-mcp'] // Enable MCP server plugins
2419
}
2520
}
2621
}
@@ -43,26 +38,7 @@ export default defineNuxtConfig({
4338
ai: {
4439
devOptions: {
4540
mcp: {
46-
enabled: process.env.NODE_ENV === 'development'
47-
}
48-
}
49-
}
50-
})
51-
```
52-
53-
### `documentation`
54-
55-
Configuration for the documentation tools provided by the MCP server.
56-
57-
```ts [nuxt.config.ts]
58-
export default defineNuxtConfig({
59-
ai: {
60-
devOptions: {
61-
mcp: {
62-
documentation: {
63-
enabled: true, // Enable documentation tools
64-
path: '/docs' // Path to documentation
65-
}
41+
enabled: import.meta.env.NODE_ENV === 'development'
6642
}
6743
}
6844
}
@@ -106,16 +82,7 @@ export default defineNuxtConfig({
10682
ai: {
10783
devOptions: {
10884
mcp: {
109-
enabled: process.env.NODE_ENV === 'development',
110-
// Only enable documentation tools in development
111-
documentation: {
112-
enabled: process.env.NODE_ENV === 'development',
113-
path: '/docs'
114-
},
115-
// Only load plugins in development
116-
servers: process.env.NODE_ENV === 'development'
117-
? ['nuxt-ai-docs-mcp']
118-
: []
85+
enabled: import.meta.env.NODE_ENV === 'development',
11986
}
12087
}
12188
}

docs/content/docs/4.ai-rules/2.custom-rules.md

Lines changed: 0 additions & 137 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"docs": "nuxi dev docs",
1010
"docs:build": "nuxi build docs",
1111
"lint": "eslint",
12+
"lint:fix": "eslint --fix",
1213
"release": "bumpp -r && pnpm -r publish",
1314
"test": "vitest",
1415
"inspect": "npx @modelcontextprotocol/inspector",
@@ -17,6 +18,7 @@
1718
"publish": "pnpm -r publish --access public"
1819
},
1920
"devDependencies": {
21+
"@ai-sdk/openai": "catalog:ai",
2022
"@antfu/eslint-config": "catalog:cli",
2123
"@antfu/ni": "catalog:cli",
2224
"@antfu/utils": "catalog:utils",

0 commit comments

Comments
 (0)