- Changed root directory in tsconfig.json to include all source files. - Updated server.json to include npm package configuration for claude-code-explorer-mcp. - Enhanced x402 command to support non-interactive mode. - Refactored x402 command call function to simplify argument handling. - Introduced .mcp.json for MCP server configuration. - Added bunfig.toml for Bun development mode configuration. - Created bridge.md documentation for IDE integration and architecture overview. - Added .npmignore to exclude unnecessary files from npm package. - Implemented build-bundle script for production and development builds. - Developed bun-plugin-shims for Bun preload plugin. - Created ci-build.sh for CI/CD build pipeline. - Added dev.ts for development launcher using Bun's TS runtime. - Implemented package-npm.ts to generate a publishable npm package. - Created test-auth.ts to verify API key configuration. - Developed test-mcp.ts for MCP client/server roundtrip testing. - Implemented test-services.ts to ensure all services initialize correctly. - Added stub.ts for bridge functionality when BRIDGE_MODE is disabled.
27 lines
774 B
TypeScript
27 lines
774 B
TypeScript
// scripts/test-auth.ts
|
|
// Quick test that the API key is configured and can reach Anthropic
|
|
// Usage: bun scripts/test-auth.ts
|
|
|
|
import Anthropic from '@anthropic-ai/sdk'
|
|
|
|
const client = new Anthropic({
|
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
})
|
|
|
|
async function main() {
|
|
try {
|
|
const msg = await client.messages.create({
|
|
model: process.env.ANTHROPIC_MODEL || 'claude-sonnet-4-20250514',
|
|
max_tokens: 50,
|
|
messages: [{ role: 'user', content: 'Say "hello" and nothing else.' }],
|
|
})
|
|
console.log('✅ API connection successful!')
|
|
console.log('Response:', msg.content[0].type === 'text' ? msg.content[0].text : msg.content[0])
|
|
} catch (err: any) {
|
|
console.error('❌ API connection failed:', err.message)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
main()
|