Nash MCP Server
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Nash MCP uses .env files to specify data file paths for configuration
Nash MCP provides command execution capabilities that can run git commands with proper error handling and output capture
Nash MCP enables execution of Python code snippets with full access to installed packages and provides information about available Python packages
Nash MCP Server
Nash MCP (a Model Context Protocol (MCP) server) enables seamless execution of commands, Python code, web content fetching, and reusable task management.
Requirements
- Python 3.11+
- Poetry package manager (recommended)
Installation
Features
- Command Execution: Run shell commands with error handling
- Python Execution: Execute Python code with error handling
- Secure Credentials: Store and access API keys without exposing sensitive data to the LLM
- Web Content Access: Fetch and parse webpage content for analysis
- Task Repository: Save and organize reusable workflows and scripts
Tools
Execute Module
- execute_command: Run shell commands with proper error handling and output capture
- list_session_files: List all Python files in the current session (ALWAYS USE THIS FIRST before creating new files)
- get_file_content: Retrieve file contents for reviewing and editing existing code
- edit_python_file: Make targeted edits to existing Python files using exact string pattern matching (PREFERRED METHOD)
- execute_python: Execute Python code snippets with full access to installed packages (use only for new files)
- list_installed_packages: Get information about available Python packages
Web Interaction
- fetch_webpage: Retrieve and convert webpage content to readable text format
Secrets Management
- nash_secrets: Access stored API keys and credentials securely. Accessible via environment variables in scripts.
Task Management
- save_nash_task: Create reusable tasks with embedded scripts
- list_nash_tasks: View all available saved tasks
- run_nash_task: Retrieve and display a previously saved task
- execute_task_script: Run a specific script from a saved task
- view_task_details: See complete details of a task, including script code
- delete_nash_task: Remove tasks that are no longer needed
Running
This is the command to use for MCP config files
As an example, if you were to use this MCP with Claude Desktop, you would change your ~/Library/Application Support/Claude/claude_desktop_config.json
to:
Environment Variables
Nash MCP requires environment variables to specify all data file paths. Create a .env
file in the root directory with the following variables:
There are no default values - all paths must be explicitly configured.
Session Management
The Nash MCP server creates a unique session directory for each server instance. This session directory stores:
- Python scripts executed during the session
- Backup files of edited scripts
- Error logs and exception information
This persistent storage enables powerful workflows:
- Scripts are saved with descriptive names for easy reference
- Previous scripts can be viewed and modified instead of rewritten
- Errors are captured in companion files for debugging
Mandatory Workflow
⚠️ MANDATORY PRE-CODING CHECKLIST - COMPLETE BEFORE WRITING ANY CODE: ⚠️
File Editing Best Practices
When working with Nash MCP, balance efficiency and context preservation:
- Always check for existing files before creating new ones using
list_session_files()
- Prioritize editing with
edit_python_file()
for minor to moderate changes - Consider creating new files when:
- It would be more token-efficient than explaining complex edits
- You would need to replace almost the entire file
- The task involves completely new functionality
- Creating a new file would result in a cleaner, smaller response
The golden rule is to minimize token usage while maintaining context and code history.
This approach preserves script history, maintains context, and makes incremental development more efficient. The editing workflow follows this pattern:
- First, check available resources →
list_installed_packages()
andnash_secrets()
- List all existing files →
list_session_files()
- Check content of relevant files →
get_file_content("file_name.py")
- Make changes to existing file →
edit_python_file("file_name.py", old_content, new_content)
- Run the modified file →
execute_python("", "file_name.py")
(empty code string to run without modifying) - Only create new files when nothing similar exists →
execute_python(new_code, "new_file.py")
Common Mistakes to Avoid
- Creating a new file when a small edit would be more token-efficient
- Making complex edits when creating a new file would be more token-efficient
- Trying to use packages that aren't installed
- Writing code that requires API keys you don't have
- Rewriting functionality that already exists
- Not considering token efficiency in your approach
Token Efficiency Guidelines
When deciding whether to edit or create a new file, consider which approach will use fewer tokens:
- Edit when: Changes are small to moderate, localized to specific sections, and easy to describe
- Create new when: Changes would replace most of the file, edits would be complex to explain, or a completely new approach is needed
Always aim to produce the smallest, most efficient output that accomplishes the task while maintaining clarity and context.
Security Considerations
- Commands and scripts run with the same permissions as the MCP server
- API keys and credentials are stored locally and loaded as environment variables
- Always review scripts before execution, especially when working with sensitive data
Development
Logs
Detailed timestamped logs of all operations and tool executions are emitted by the server. These logs are stored in the directory specified by the NASH_LOGS_PATH
environment variable.
Testing
With coverage
License
MIT
This server cannot be installed
A Model Context Protocol server that enables seamless execution of commands, Python code, web content fetching, and reusable task management with secure credentials handling.