-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathllms.txt
More file actions
106 lines (74 loc) · 2.63 KB
/
Copy pathllms.txt
File metadata and controls
106 lines (74 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Logging Instructions for permit-fastmcp
To ensure consistent logging across the project, use the logger setup provided in:
permit_fastmcp/logger_config.py
## How to use
1. Import and call the setup function at the top of your main script or module:
from permit_fastmcp.logger_config import setup_logging
setup_logging()
2. Get a logger in your module using:
import logging
logger = logging.getLogger("permit_fastmcp.<your_module>")
Replace `<your_module>` with the relevant module or submodule name.
This ensures all logs are formatted and handled consistently throughout the project.
## Configuration
### Environment Variables
The middleware configuration can be customized using environment variables with the `PERMIT_MCP_` prefix:
```bash
# Permit.io configuration
export PERMIT_MCP_PERMIT_PDP_URL="http://localhost:7766"
export PERMIT_MCP_PERMIT_API_KEY="your-api-key"
# Method configuration
export PERMIT_MCP_KNOWN_METHODS='["tools/list","tools/call"]'
export PERMIT_MCP_BYPASSED_METHODS='["initialize","ping"]'
# Prefix configuration
export PERMIT_MCP_ACTION_PREFIX="mcp_"
export PERMIT_MCP_RESOURCE_PREFIX="mcp_"
# Logging configuration
export PERMIT_MCP_ENABLE_AUDIT_LOGGING="true"
```
### Using .env file
Create a `.env` file in your project root:
```env
PERMIT_MCP_PERMIT_PDP_URL=http://localhost:7766
PERMIT_MCP_PERMIT_API_KEY=your-api-key
PERMIT_MCP_ENABLE_AUDIT_LOGGING=true
```
## Development Environment Setup
### Virtual Environment Management with UV
This project uses UV for dependency management. When adding new modules or dependencies:
1. **Activate the virtual environment:**
```bash
uv venv
source .venv/bin/activate # On macOS/Linux
# or
.venv\Scripts\activate # On Windows
```
2. **Add new dependencies:**
```bash
uv add <package-name>
```
3. **Install all dependencies:**
```bash
uv sync
```
4. **Update dependencies:**
```bash
uv update
```
5. **Run the project:**
```bash
uv run python main.py
```
### Adding New Modules
When adding new Python modules or packages:
1. Add the dependency to `pyproject.toml` or use `uv add`
2. Run `uv sync` to install the new dependency
3. Update any import statements in your code
4. Test that the new module works correctly
### Best Practices
- Always work within the virtual environment
- Use `uv add` instead of `pip install` for consistency
- Keep `pyproject.toml` and `uv.lock` in version control
- Run `uv sync` after pulling changes to ensure dependencies are up to date
- Use environment variables for configuration in production
- Keep sensitive values like API keys in environment variables, not in code