An advanced, fully customizable customer support chat interface powered by Claude.
- AI-powered chat using Anthropic's Claude model
- Built-in knowledge base with TF-IDF based search
- Real-time thinking & debug information display
- User mood detection & appropriate agent redirection
- Context viewing - click the context status to see full RAG context
- Highly customizable UI with shadcn/ui components
git clone https://github.com/anthropic-krzim/claude-code-mcp-demo.git
cd claude-code-mcp-demo
Before running the application, you need to set up your API key.
- Visit console.anthropic.com
- Sign up or log in to your account
- Click on "Get API keys"
- Copy the key and save it for the next step
Create a .env.local
file in the root directory with the following:
ANTHROPIC_API_KEY=your_anthropic_api_key_here
Important: Never commit your .env.local
file to version control.
To enable GitHub integration with Claude via MCP (Model Context Protocol):
-
Get a GitHub Personal Access Token:
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token (classic)" or use "Fine-grained personal access tokens" for better security
- Give it a descriptive name (e.g., "Claude MCP")
For Classic Token, select these scopes:
repo
- Full control of private repositories
For Fine-grained Token (Recommended):
-
Repository access: Select only this specific repository
-
Repository permissions:
- Read access to: metadata, commit statuses
- Read and Write access to: code, issues, pull requests
-
Generate and copy the token
-
Add the token to your
.env.local
:GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token_here
-
Run the setup script:
./setup-github-mcp.sh
This will configure Claude to access your GitHub repositories through the MCP server, enabling features like code search, issue management, and pull request operations directly from Claude.
- Clone this repository
- Ensure you've created the
.env.local
file with your API key (see Configuration above) - Install dependencies:
npm install
- Run the development server:
npm run dev
- Open http://localhost:3000 in your browser
npm run dev
- Start development server with left sidebar onlynpm run dev:full
- Start with both sidebars enablednpm run dev:left
- Start with left sidebar onlynpm run dev:right
- Start with right sidebar onlynpm run dev:chat
- Start with chat interface only (no sidebars)npm run build
- Build for productionnpm run lint
- Run ESLint
This project supports multiple Claude models. The currently configured models are:
- Claude 3 Haiku - Fast and efficient for quick responses
- Claude 3.5 Sonnet (Default) - Balanced performance and capabilities
To switch between models:
- In
ChatArea.tsx
, themodels
array defines available models:
const models: Model[] = [
{ id: "claude-3-haiku-20240307", name: "Claude 3 Haiku" },
{ id: "claude-3-5-sonnet-20240620", name: "Claude 3.5 Sonnet" },
// Add more models as needed
];
- The
selectedModel
state variable controls the currently selected model:
const [selectedModel, setSelectedModel] = useState("claude-3-5-sonnet-20240620");
- Users can switch models using the dropdown in the chat interface.
This project leverages shadcn/ui components, offering a high degree of customization:
- Modify the UI components in the
components/ui
directory - Adjust the theme in
app/globals.css
- Customize the layout and functionality in individual component files
Modify the theme colors and styles by editing the styles/themes.js
file:
// styles/themes.js
export const themes = {
neutral: {
light: {
// Light mode colors for neutral theme
},
dark: {
// Dark mode colors for neutral theme
}
},
// Add more themes here
};
The knowledge base is stored in app/lib/knowledgebase.json
. You can:
- Add new documents to expand the knowledge base
- Modify existing documents to update information
- The search uses TF-IDF for efficient document retrieval
/app
- Next.js app directory containing the main application logic/components
- React components including UI elements/lib
- Utility functions and shared code/public
- Static assets/styles
- Global styles and theme configurations
Click the "Context: ✅" button in the left sidebar to view:
- The full context provided to Claude
- Retrieved documents with relevance scores
- The exact information used to generate responses
The system automatically detects user mood (positive, negative, curious, frustrated, confused, neutral) and displays it in the left sidebar.
Automatically detects when queries should be escalated to human agents based on complexity or content.
Contributions are welcome! Please feel free to submit a Pull Request.