You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=api&page=69&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=api
Returns an array of strings in format "username" or "username/projectName"
Found 19668 results for "api"(2723ms)
1516export interface AppConfig {
17anthropicApiKey: string;
18mcpServers: MCPServerConfig[];
19selectedModel: string;
40export default function App() {
41const [config, setConfig] = useState<AppConfig>({
42anthropicApiKey: "",
43mcpServers: [],
44selectedModel: "claude-3-5-sonnet-20241022",
55// Load config from localStorage on mount
56useEffect(() => {
57const savedApiKey = localStorage.getItem("anthropic_api_key");
58const savedMcpServers = localStorage.getItem("mcp_servers");
59const savedMessages = localStorage.getItem("chat_messages");
64let mcpServers = savedMcpServers ? JSON.parse(savedMcpServers) : DEFAULT_MCP_SERVERS;
65setConfig({
66anthropicApiKey: savedApiKey || "",
67mcpServers: mcpServers,
68selectedModel: savedModel || "claude-3-5-sonnet-20241022",
81}
8283// Show settings if no API key is configured
84if (!savedApiKey) {
85setShowSettings(true);
86}
89// Save config to localStorage when it changes
90useEffect(() => {
91if (config.anthropicApiKey) {
92localStorage.setItem("anthropic_api_key", config.anthropicApiKey);
93}
94localStorage.setItem("mcp_servers", config.mcpServers?.length ? JSON.stringify(config.mcpServers) : "");
1# Anthropic Streaming Chat with MCP
23A mobile-optimized single page chat application that uses the Anthropic Messages API with **real-time streaming** and MCP (Model Context Protocol) server support, featuring **centralized client management** and **performance optimizations**.
45Source: https://www.val.town/x/c15r/Chat
38const clientPool = new MCPClientPool(connectedClients, serverConfigs);
3940// Unified API across all components
41await clientPool.testServer(serverName);
42await clientPool.fetchTools();
116117The app stores configuration and chat history in localStorage:
118- `anthropic_api_key`: Your Anthropic API key
119- `selected_model`: The chosen Claude model (defaults to claude-3-5-sonnet-20241022)
120- `mcp_servers`: Array of configured MCP servers
144For detailed testing information, see [TESTING.md](./TESTING.md).
145146### API Endpoints
147148- `GET /` - Main application (serves frontend)
1551561. Open the app at the provided URL
1572. Click "Settings" in the footer to configure your Anthropic API key and select your preferred Claude model
1583. Add/remove/toggle MCP servers as needed
1594. Use the "Test" button next to each MCP server to verify connectivity (shows ✅ for success, ❌ for errors)
200- **Auto-scroll**: Messages automatically scroll to bottom during streaming
201- **Auto-resize**: Input field grows with content
202- **Error Handling**: Clear error messages for API issues with stream recovery
203- **Loading States**: Visual feedback during API calls and streaming
204- **Structured Responses**: MCP tool use and results are displayed in organized, collapsible sections
205- **Clean Interface**: Maximized chat area with no header, footer contains all controls