To get started, run the following command:
bash scripts/configure_mcp.sh
This script will guide you through the process of setting up your environment variables and configuring the MCP connections for both Claude and Gemini.
A comprehensive template for developing Palantir Foundry applications with integrated AI code assistants (Claude Code and Google Gemini CLI).
- Node.js (v18 or higher)
- npm or yarn
- Access to Palantir Foundry with:
- Platform administrator has enabled Palantir MCP
- Generated user token
- Your enrollment URL (e.g.,
stack123.palantirfoundry.com
) - Compass project RID for default resource creation
# Clone this template
git clone <your-repo-url> my-palantir-project
cd my-palantir-project
# Set up environment variables
export FOUNDRY_TOKEN="your-palantir-user-token"
Configure npm to authenticate with Palantir's artifact registry:
npm config set //$(echo "https://your-enrollment.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.repository.discovered.foundry-mcp/contents/release/npm/" | sed 's/https:\/\///')/:_auth $FOUNDRY_TOKEN
Replace your-enrollment
with your actual enrollment URL.
Edit .mcp.json
and replace the placeholders:
{
"mcpServers": {
"Palantir": {
"command": "npx",
"args": [
"-y",
"@palantir/mcp@latest",
"--foundry-api-url",
"https://your-enrollment.palantirfoundry.com",
"--default-foundry-folder",
"ri.compass.folder.your-project-rid"
],
"env": {
"FOUNDRY_TOKEN": "your-token-here",
"NPM_CONFIG_REGISTRY": "https://your-enrollment.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.repository.discovered.foundry-mcp/contents/release/npm/"
},
"disabled": false
}
}
}
Create or update ~/.gemini/settings.json
:
mkdir -p ~/.gemini
cat > ~/.gemini/settings.json << 'EOF'
{
"mcpServers": {
"Palantir": {
"command": "npx",
"args": [
"-y",
"@palantir/mcp@latest",
"--foundry-api-url",
"https://your-enrollment.palantirfoundry.com",
"--default-foundry-folder",
"ri.compass.folder.your-project-rid"
],
"env": {
"FOUNDRY_TOKEN": "your-token-here",
"NPM_CONFIG_REGISTRY": "https://your-enrollment.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.repository.discovered.foundry-mcp/contents/release/npm/"
}
}
}
}
EOF
Remember to replace:
your-enrollment
with your Palantir enrollment URLyour-token-here
with your generated user tokenri.compass.folder.your-project-rid
with your Compass project RID
# Start Claude in the project
claude
# List MCP servers
claude mcp list
# Test Palantir connection
> Can you list the datasets in my Foundry folder?
# Check MCP configuration
gemini /mcp
# Test in agent mode
gemini --agent
> Show me the datasets in my default Foundry folder
.
├── .claude/ # Claude Code configuration
│ ├── commands/ # Custom Claude commands
│ ├── settings.json # Base permissions
│ └── settings.local.json # Local permissions
├── .mcp.json # MCP server configuration
├── ai_docs/ # AI assistant documentation
│ ├── palantir-patterns.md # Common Foundry patterns
│ └── foundry-best-practices.md # Best practices guide
├── specs/ # Project specifications
│ ├── code-standards.md # Code standards
│ ├── project-management.md # Project management
│ └── project_plan.md # Master project plan
├── foundry/ # Foundry-specific code
│ ├── transforms/ # Data transformation code
│ ├── functions/ # Foundry Functions
│ └── pipelines/ # Pipeline definitions
├── scripts/ # Utility scripts
└── CLAUDE.md # Claude-specific instructions
Once connected, AI assistants have access to:
- Dataset Operations: Read, write, query, and transform datasets
- Code Repository Management: Create and manage Foundry code repositories
- Pipeline Execution: Trigger builds and monitor pipeline status
- Ontology Access: Query and manipulate ontology objects
- Function Execution: Run Foundry Functions
- File Management: Upload and manage files in Foundry
# With Claude Code
> Show me the schema of the customer_transactions dataset
> Create a transform that aggregates daily sales by region
> Write a Python transform to clean the raw_inventory data
# With Gemini CLI
> List all datasets modified in the last week
> Generate a PySpark transform to join customer and order datasets
# With Claude Code
> Check the status of the daily_aggregation pipeline
> Create a new pipeline that runs the data quality checks
# With Gemini CLI
> Show me failed builds from the last 24 hours
> Set up a pipeline to run every 6 hours
# With Claude Code
> Query all Customer objects where revenue > 1000000
> Create a new ontology type for Product with appropriate properties
# With Gemini CLI
> Show the relationships between Customer and Order objects
> Update the Customer object type to include a new property
# Load project context
claude
> /prime
# Work on a JIRA ticket
> /work_on_ticket_engineer PROJ-123
# Create a new transform
> Create a new Python transform in foundry/transforms/ that processes daily_sales data
# The AI will:
# - Create the transform file
# - Set up proper imports
# - Implement the transformation logic
# - Add error handling
# - Create unit tests
# Create a pipeline
> Set up a pipeline that orchestrates the customer data processing workflow
# The AI will:
# - Define pipeline stages
# - Set up dependencies
# - Configure scheduling
# - Add monitoring and alerts
- Never commit tokens: Use environment variables for sensitive data
- Token rotation: Regularly rotate your Foundry user tokens
- Access control: Follow principle of least privilege
- Code review: Always review AI-generated code before deployment
- Use version control: Commit changes frequently with meaningful messages
- Test thoroughly: Ensure transforms work with sample data before full runs
- Monitor performance: Check dataset size and processing times
- Document changes: Keep README and specs updated
- Be specific: Provide clear requirements and constraints
- Verify outputs: Always review generated code and queries
- Iterative development: Build complex transforms incrementally
- Use examples: Provide sample data or expected outputs when possible
Edit CLAUDE.md
to include:
- Specific dataset schemas and relationships
- Common transformation patterns used in your project
- Ontology object definitions
- Team conventions and standards
Add documentation in ai_docs/
:
palantir-patterns.md
- Common Foundry development patternsdataset-schemas.md
- Dataset schemas and relationshipstransform-library.md
- Reusable transformation codeontology-guide.md
- Ontology structure and usage
-
Verify token is set correctly:
echo $FOUNDRY_TOKEN
-
Check npm configuration:
npm config get registry
-
Test MCP directly:
npx -y @palantir/mcp@latest --foundry-api-url https://your-enrollment.palantirfoundry.com --help
- "Unauthorized" errors: Token may be expired or incorrect
- "Not found" errors: Check enrollment URL and project RID
- Connection timeouts: Verify network access to Palantir
- MCP not available: Ensure platform admin has enabled MCP
- Palantir MCP Documentation
- Palantir Foundry Documentation
- Claude Code Documentation
- Gemini CLI Documentation
When contributing to this template:
- Never commit credentials or tokens
- Test changes with both AI assistants
- Update documentation for new features
- Follow Palantir's best practices
- Ensure code passes Foundry's quality checks
Important: This template requires proper Palantir Foundry access and MCP enablement. Contact your Palantir administrator if you encounter access issues.