Commit Graph

44 Commits

Author SHA1 Message Date
esus 6c7a54a83e Revert a non working initalized call again. 2025-10-14 15:44:38 +13:00
Andre Heinecke 67f41e5a81
Change config path from .claude/mcp-browser to .config/mcp-browser 2025-10-12 14:18:45 +02:00
Andre Heinecke 546c5ed0a7
Fix ngrok invocation
- The OAUTH from ngrok could not be handled by OpenAI and was
only haölf implemented. The policy file is the right way but it still
wont detect it..

- Most importantly we trail the logs at the end of the script to
avoid the script from terminating.
2025-10-11 12:32:03 +02:00
Andre Heinecke 0a5c29c1ce
Initialize earlier
This still does not avoid that we get the error
notifications/initialized is not allowed.
2025-10-11 12:30:39 +02:00
Andre Heinecke c96cc26939
Disable optional builtin servers
Just to reduce problem surface
2025-10-11 12:30:11 +02:00
gpt-5-codex bb64267c4d fix: respect user config in ngrok helper 2025-10-11 07:52:25 +02:00
gpt-5-codex 49963ca58f fix: harden ngrok helper defaults 2025-10-11 07:37:42 +02:00
gpt-5-codex 1d1dd262c6 chore: switch ngrok helper to oauth-based auth 2025-10-11 07:10:01 +02:00
gpt-5-codex 63a3f41726 fix: pass host args to ngrok readiness check 2025-10-11 07:00:08 +02:00
gpt-5-codex 7813d32cd0 feat: add ngrok publishing helper 2025-10-11 06:42:11 +02:00
gpt-5-codex 341e48a696 feat: add built-in streamable-http gateway 2025-10-11 02:19:39 +02:00
gpt-5-codex 2708a6ff5f feat: support legacy streamable-http config entries 2025-10-10 23:55:27 +02:00
gpt-5-codex 18d94d8913 docs: provide hardened nginx and systemd templates 2025-10-10 23:18:46 +02:00
gpt-5-codex 4b14d45e28 fix: fallback to real server when built-ins disabled 2025-10-10 23:15:09 +02:00
gpt-5-codex 6199f28e9e feat: add streamable-http transport support 2025-10-10 22:56:32 +02:00
Andre Heinecke 568fd53ad2
Add python-sdk and modelcontextprocol as doc submodules 2025-10-10 22:27:29 +02:00
Claude4Ξlope 824a66d7c8 Add tmux session management and screen to tmux conversion
Features:
- Add tmux_server.py with full session management capabilities
- Convert TheCoder script from screen to tmux with HOME bind mount fix
- Add enabled flag to MCPServerConfig for selective server startup
- Tmux now default, screen legacy (disabled by default)
- Update documentation and architecture to reflect tmux preference

Session Management:
- create_session, execute, peek, list_sessions, kill_session
- attach_session and share_session with multi-user instructions
- Better multi-user support than screen with native tmux capabilities

Testing:
- Add test_tmux_session.py for comprehensive tmux functionality testing
- Add test_screen_utf8.py for UTF-8 handling
- Add MCP_QUICK_REFERENCE.md for AI handoff documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 15:28:32 +02:00
Claude4Ξlope edca1d1fe2 Fix gen_apidoc command to properly initialize and discover tools
**Fixed Issues**:
- Proper config file loading from ~/.claude/mcp-browser/config.yaml
- Correct MCPBrowser initialization with config_path parameter
- Fixed server config attribute access using getattr()
- Updated runtime status detection logic
- Reduced initialization wait time for better performance

**Working Features**:
-  Discovers 27 tools from 4 built-in servers (screen, memory, patterns, onboarding)
-  Loads 7 configured external servers from config file
-  Generates comprehensive JSON documentation with runtime status
-  Includes server PIDs and active status for monitoring
-  All regex JSONPath queries working ($.tools[?(@.name =~ /pattern/i)])

The gen_apidoc command now provides complete MCP API documentation
suitable for adding to AI project knowledge bases.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 13:14:32 +02:00
Claude4Ξlope 1fee302b4d Add regex JSONPath support and gen_apidoc command
**Enhanced JSONPath Support**:
- Manual regex implementation for queries like `$.tools[?(@.name =~ /pattern/i)]`
- Supports case-insensitive searches with /i flag
- Works on both tool names and descriptions
- Fallback to standard JSONPath for non-regex queries

**gen_apidoc Command**:
- New `python setup.py gen_apidoc` command
- Generates comprehensive JSON documentation of MCP API
- Includes all servers, tools, schemas, and capabilities
- AI-optimized format with discovery patterns
- Runtime server status information
- Perfect for adding to project knowledge bases

**API Documentation Features**:
- Complete server inventory with tool counts
- Capability inference from tool names/descriptions
- Discovery pattern examples for common queries
- Sparse mode information for context optimization
- Tool grouping by server with metadata

This enables powerful regex-based tool discovery and provides
comprehensive API documentation for AI consumption.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 13:04:59 +02:00
Claude4Ξlope c55ffdb59b Add enhanced onboarding examples and Xilope production guide
**Onboarding Enhancements**:
- Added explicit server discovery examples
- Included Claude Code server usage patterns
- Added read_file tool call examples with proper namespacing

**Xilope Production Guide**:
- Complete production environment documentation
- Memory storage integration details (/mnt/data/claude/claude/.mcp-memory/)
- cmem wrapper integration (~/bin/cmem → /usr/local/bin/cmem)
- Bidirectional sync workflows and best practices

**Server Updates**:
- Enhanced onboarding server to serve predefined markdown files
- Priority: predefined files → default.md → fallback instructions

This provides comprehensive guidance for both general MCP Browser usage
and Xilope's specific production environment with cmem integration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 12:52:48 +02:00
Claude4Ξlope 63c26975c4 Bump version to 0.2.0 after major enhancements
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 12:05:55 +02:00
Claude4Ξlope c8bfa4b2d1 Add enhanced interactive mode and cmem integration
Major enhancements to MCP Browser functionality:

**Interactive Client & Testing**:
- New comprehensive interactive client with readline support
- Tab completion for commands and tools
- Enhanced tool testing with sample argument generation
- Standalone executable script for easy testing

**cmem Integration**:
- Bidirectional sync between memory server and cmem
- Identity-specific memory contexts
- Automatic task, pattern, and decision synchronization
- Graceful degradation when cmem unavailable

**Developer Experience**:
- Updated tool descriptions with clear proxy pattern explanations
- Comprehensive handoff documentation for AI assistant transitions
- 32 new tests covering all enhanced functionality
- All tests passing (46 passed, 3 skipped)

**Context Optimization**:
- Maintained sparse mode efficiency
- Clear meta-tool descriptions with emojis
- Enhanced onboarding guide with practical examples

This update significantly improves both AI assistant workflow continuity
and developer testing capabilities while maintaining the project's core
principle of context efficiency.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 12:00:52 +02:00
Claude4Ξlope 014b632517 Add daemon management targets to Makefile
- Add 'make run' target that installs and restarts daemon from home directory
- Add 'make restart' target to stop and start daemon without install
- Add 'make stop' target to safely stop running daemon
- Add 'make status' target to check daemon status with PID verification
- Fixes issue where daemon doesn't update after 'make install'
- Ensures daemon runs from .venv/bin/ to avoid stale system-wide version
- Includes process verification with ps command to confirm replacement

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 00:07:56 +02:00
Claude4Ξlope 8c4ea3a77f Fix license configuration to use SPDX expression
- Replace deprecated License classifier with SPDX license field
- Use "GPL-3.0-or-later" SPDX identifier instead of deprecated classifier
- Removes setuptools deprecation warning

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 23:51:08 +02:00
Claude4Ξlope 53f672bb76 Add multiuser support to screen server
- Add enable_multiuser tool to enable multiuser mode on sessions
- Add attach_multiuser tool to provide attach instructions
- Add add_user tool for access control list management
- Peek functionality works seamlessly with multiuser sessions
- Create comprehensive test for multiuser functionality
- All existing functionality preserved and tested

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 23:50:45 +02:00
Claude4Ξlope 140bd2d71b Fix UTF-8 encoding issue in screen peek
- Read screen hardcopy output as binary first
- Decode with UTF-8 using 'replace' error handling
- Fallback to latin-1 encoding if needed
- Strip ANSI escape sequences from output
- Handles mixed encodings and binary data gracefully

This fixes crashes when screen sessions contain non-UTF-8 bytes
or terminal control sequences.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 23:20:53 +02:00
Claude4Ξlope 9a22aa7714 Add dynamic config reloading and comprehensive onboarding
- Add inotify-based config file watching for runtime server updates
- Include external server information in mcp_discover results
- Add comprehensive default onboarding explaining proxy architecture
- Update sparse tool description to show server count
- Config changes are now automatically detected and reloaded
- No restart required when adding new MCP servers to config.yaml

The onboarding now fully explains:
- Proxy mode connecting to external MCP servers
- Built-in tools always available
- Discovery examples for finding servers and tools
- Runtime configuration without restarts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 22:10:52 +02:00
Claude4Ξlope d7e617e487 Fix linter issues and update integration test
- Remove unused imports (signal, yaml, os, socket, ConfigLoader)
- Remove unused variable assignments in argument parsers
- Update integration test to send initialize request first
- Fix test to match new server mode behavior

All unit tests pass, integration test needs initialize handshake.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 22:02:31 +02:00
Claude4Ξlope 5aacf468a4 Fix MCP initialization timeout and add daemon management
- Fix protocol version mismatch (0.1.0 -> 2024-11-05)
- Fix server mode blocking on startup causing Claude Desktop timeout
- Add --version flag to show version information
- Implement proper daemon cleanup when starting new daemon
- Add kill_daemon_with_children() to properly terminate process tree
- Fix dictionary iteration error during shutdown
- Ensure sparse mode is always enabled (3 tools only)
- Fix async stdin reading in base server to prevent EOF loops
- Add syslog support for server mode logging
- Switch from stdin.read() to readline() for proper JSON-RPC handling
- Add comprehensive MCP protocol test suite

The tool now works correctly as an MCP proxy between Claude Desktop
and MCP servers with additional built-in tools.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 22:00:32 +02:00
Claude4Ξlope 6df97a9dcf Fix Claude Desktop timeout issue in server mode
The server was hanging on initialize requests because:
1. It was calling browser.initialize() at startup which tried to connect to upstream servers
2. It was using blocking stdin.read(4096) instead of line-based reading

Fixed by:
- Removing premature initialization in server mode (let it happen lazily)
- Switching to readline() for proper line-based JSON-RPC handling
- Adding proper error responses for malformed JSON

This resolves the 60-second timeout error when Claude Desktop tries to connect.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 21:49:32 +02:00
Claude4Ξlope 5b8bce926e Fix daemon file descriptor handling
- Fixed ValueError with closed file when daemonizing
- Properly handle file descriptors with dup2
- Move signal handlers inside async context

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 18:07:15 +02:00
Claude4Ξlope 6823d41dd1 Fix server CPU loops and refactor to client/daemon architecture
Major refactoring to fix high CPU usage and improve architecture:

## Fixed Issues
- MCP servers were stuck in infinite loops when stdin closed
- Fixed by checking for EOF (empty string) from stdin.read()
- Fixed indentation error in base.py causing syntax errors

## New Architecture
- Split into separate client and daemon binaries:
  - `mcp-browser`: Smart client that can use daemon or run standalone
  - `mcp-browser-daemon`: Persistent daemon process
  - `mcp-browser-legacy`: Old monolithic version (deprecated)

## Client Features
- Auto-detects and uses daemon if available
- Can auto-start daemon if needed
- Falls back to standalone mode
- Supports `--use-daemon` with modes: auto, always, never
- Works as MCP server (stdin/stdout) or CLI tool

## Daemon Features
- Runs as background process with socket server
- Supports multiple concurrent clients
- Can run in foreground with `--foreground`
- Includes systemd service files for production
- Proper signal handling and cleanup

## Usage Examples
```bash
# CLI usage (auto-uses daemon if available)
mcp-browser tools-list
mcp-browser tools-call builtin:patterns::list_patterns '{}'

# Force standalone mode
mcp-browser --use-daemon never tools-list

# Run daemon manually
mcp-browser-daemon --foreground --log-level DEBUG

# Use as MCP server
echo '{"method":"tools/list"}' | mcp-browser --mode server
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 17:46:24 +02:00
Claude4Ξlope 6025bb1256 Fix daemon start directory creation
- Added parents=True to mkdir call to create parent directories
- Fixes FileNotFoundError when starting daemon in background

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 16:45:21 +02:00
Claude4Ξlope a7ec20b034 Fix package installation and remove demo script
- Added proper package discovery for mcp_servers modules
- Created __init__.py files for all mcp_servers subpackages
- Added MANIFEST.in to ensure all files are included in distribution
- Removed mcp-browser-demo entry point from setup.py
- Fixed package_data to include all necessary files

The mcp_servers modules are now properly installed alongside mcp_browser,
allowing built-in servers to work correctly after installation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 16:29:17 +02:00
Claude4Ξlope 1bb1d05715 Replace debug output with proper logging framework
- Added comprehensive logging system with configurable levels
  - TRACE: Shows raw JSON-RPC I/O with server names
  - DEBUG: Detailed operational logging
  - INFO/WARNING/ERROR: Standard logging levels

- New command line options:
  - --log-level: Set logging level (TRACE/DEBUG/INFO/WARNING/ERROR)
  - --log-file: Log to file instead of stderr

- Improved error handling and timeouts:
  - Initial server discovery timeout reduced to 3 seconds
  - Servers marked as offline for 30 minutes after failure
  - Better error messages with server context

- All debug output now goes to stderr, keeping stdout clean for JSON

Example usage:
  mcp-browser --log-level TRACE tools-list  # See raw I/O
  mcp-browser --debug --log-file debug.log  # Debug to file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 16:24:24 +02:00
Claude4Ξlope 4a7d3cdc7f Add daemon mode and improve debug output
- Implement socket-based daemon mode using Unix domain sockets
  - Allows multiple clients to connect to a single MCP Browser instance
  - Supports automatic daemon detection and connection
  - Added --daemon-start, --daemon-stop, --daemon-status commands

- Improve debug output handling
  - All debug output now goes to stderr instead of stdout
  - Added debug_print() and debug_json() utilities
  - Debug messages show before and after server communication

- Fix builtin-only mode handling
  - Properly route tools/list and tools/call when no external server
  - Apply sparse mode filtering to builtin server tools

- Improve JSON-RPC command output
  - Raw jsonrpc command now outputs proper JSON for piping
  - Other commands use human-friendly formatting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 15:56:05 +02:00
Claude4Ξlope 33ff1c33f5 Add default config system with ~/.claude/mcp-browser/ directory
- Created comprehensive default configuration system
- Config directory at ~/.claude/mcp-browser/ with:
  - config.yaml with example MCP server configurations
  - onboarding.md with detailed usage documentation
  - patterns/ directory for system and custom patterns
  - logs/ and backups/ directories
- Added checksum system to detect unmodified config files
- Enhanced CLI with new options:
  - --list-servers to show available servers
  - --show-config to display configuration
  - --test to test server connections
  - --debug for detailed output
- Improved help text with examples and better documentation
- Updated ConfigLoader to use new config directory structure
- First run automatically creates default configuration

The system now provides a user-friendly experience similar to
claude-composer with proper configuration management.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 14:37:19 +02:00
Claude4Ξlope 27d0f610ba Fix MCP Browser test suite and add Brave Search integration
- Fixed NameError by adding missing Union import in filter.py
- Reorganized all tests into tests/ subdirectory
- Fixed recursive initialization issue in proxy.py
- Added proper test infrastructure with Makefile and setup.py test target
- Created test_config.yaml for test configurations
- Added Brave Search integration test (requires BRAVE_API_KEY)
- Fixed async test fixtures to use @pytest_asyncio.fixture
- Updated tests to handle 3 sparse tools (including onboarding)
- Fixed JSONPath queries to avoid unsupported filter syntax
- Created unit tests that don't require server initialization
- Added test_simple.py for basic functionality tests

All unit tests now pass successfully. Integration tests that require
full server setup are marked as skipped.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 14:11:13 +02:00
Claude4Ξlope 97013f7add Add release notes for v0.1.0
- Document initial release features
- Highlight key capabilities
- Add installation instructions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude4Ξlope <xilope@esus.name>
2025-06-27 12:47:58 +02:00
Claude4Ξlope 39f83ba9a9 Update project metadata for Xilope0 namespace
- Change license to GPLv3+ (OSI approved)
- Update repository URL to github.com/Xilope0/mcp-browser
- Set correct author as Claude4Ξlope <xilope@esus.name>
- Add installation instructions and badges to README
- Add contributing section highlighting AI-only development
- Update all metadata consistently across files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude4Ξlope <xilope@esus.name>
2025-06-27 12:45:34 +02:00
Claude4Ξlope fde6fdbe0c Add package distribution files and cleanup
- Add MIT LICENSE file
- Add MANIFEST.in for proper package distribution
- Update .gitignore to exclude generated files (.tags, *.html)
- Remove accidentally committed pydoc HTML file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 12:36:25 +02:00
Claude4Ξlope 5274079013 Update test script for claude-code connection
- Use temporary YAML config file to specify claude MCP server
- Update to work with current MCPBrowser API
- Add better error handling and cleanup
- Test sparse mode and tool discovery

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 12:35:39 +02:00
Claude4Ξlope 1ef99927b3 Add pip infrastructure and AI development tools
- Enhanced setup.py with AI-friendly documentation generation
- Added 'python setup.py aidocs' command for:
  - Automatic API documentation via pydoc
  - ctags generation for code navigation
  - Project structure documentation
  - API summary generation
- Added CLAUDE.md explaining AI-only development
- Created __main__.py for command-line interface
- Added test_claude_connection.py to verify claude-code integration
- Added py.typed for type checking support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 12:33:43 +02:00
Claude4Ξlope 9a7172096f Initial prototype of MCP Browser
A generic, minimalistic MCP browser with optimized context usage:
- Generic JSON-RPC interface with call() and discover() methods
- Sparse mode for context optimization
- 4 built-in MCP servers (screen, memory, patterns, onboarding)
- Multi-server management
- Identity-aware onboarding as third visible tool

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 12:30:20 +02:00