Skip to content

Commit b2b25c4

Browse files
feat: Add alt transports (#5)
* feat: Add HTTP transport support to TIM-MCP server - Add HTTP transport mode alongside existing STDIO mode - STDIO remains default mode for backward compatibility - Add Click-based CLI with --http, --host, --port options - Create transport configuration module with validation - Add comprehensive test coverage (152 tests passing) - Update documentation with deployment examples - Align ruff configuration with pre-commit settings * fix: Replace regex with glob patterns in file filtering - Replace regex-based file pattern matching with intuitive glob patterns - Remove include_readme flag - README.md now follows same filtering rules - Simplify get_content tool implementation and documentation - Update all tests to use glob patterns instead of regex - Fix file filtering bug where invalid patterns included all files * fix: reduce search results to 5 * fix: update search to filter non archived and core-team modules * docs: add claude code instructions for test * fix: resolve file filtering issue in get_content tool - Remove automatic glob-to-regex conversion in _sanitize_list_parameter() - Fix cache warning by removing invalid ttl parameter - Update docstrings to reflect glob pattern usage - Add regression test for the specific bug scenario
1 parent 90310d1 commit b2b25c4

17 files changed

+1870
-388
lines changed

.secrets.baseline

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-09-24T11:38:27Z",
6+
"generated_at": "2025-09-25T11:22:38Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -82,87 +82,87 @@
8282
"hashed_secret": "887c04fb792699ceb6b29d9d4cb017d2854f8314",
8383
"is_secret": false,
8484
"is_verified": false,
85-
"line_number": 44,
85+
"line_number": 43,
8686
"type": "Base64 High Entropy String",
8787
"verified_result": null
8888
},
8989
{
9090
"hashed_secret": "f2fc748e82e02ed29053ddbb52f241a7e10e9a4f",
9191
"is_secret": false,
9292
"is_verified": false,
93-
"line_number": 45,
93+
"line_number": 44,
9494
"type": "Base64 High Entropy String",
9595
"verified_result": null
9696
},
9797
{
9898
"hashed_secret": "52a3342b7890ccda14efd7f947fa9ee6fda62529",
9999
"is_secret": false,
100100
"is_verified": false,
101-
"line_number": 62,
101+
"line_number": 61,
102102
"type": "Base64 High Entropy String",
103103
"verified_result": null
104104
},
105105
{
106106
"hashed_secret": "67e1c41f7a21c2c3e818b0192a161092ab074b69",
107107
"is_secret": false,
108108
"is_verified": false,
109-
"line_number": 63,
109+
"line_number": 62,
110110
"type": "Base64 High Entropy String",
111111
"verified_result": null
112112
},
113113
{
114114
"hashed_secret": "5eb844612e49e7ae88d1297b833d1057f4dddcb8",
115115
"is_secret": false,
116116
"is_verified": false,
117-
"line_number": 80,
117+
"line_number": 79,
118118
"type": "Base64 High Entropy String",
119119
"verified_result": null
120120
},
121121
{
122122
"hashed_secret": "462c772756a6e7e0f4c042b643072166fe491e80",
123123
"is_secret": false,
124124
"is_verified": false,
125-
"line_number": 232,
125+
"line_number": 256,
126126
"type": "Base64 High Entropy String",
127127
"verified_result": null
128128
},
129129
{
130130
"hashed_secret": "6aee17ecbbef021e3e8e9529facc4fa044180b64",
131131
"is_secret": false,
132132
"is_verified": false,
133-
"line_number": 284,
133+
"line_number": 309,
134134
"type": "Base64 High Entropy String",
135135
"verified_result": null
136136
},
137137
{
138138
"hashed_secret": "f10ba892b2ef72888d523de9812f53860cb752b5",
139139
"is_secret": false,
140140
"is_verified": false,
141-
"line_number": 300,
141+
"line_number": 325,
142142
"type": "Base64 High Entropy String",
143143
"verified_result": null
144144
},
145145
{
146146
"hashed_secret": "8744edae886af9ba92b6394b0b8820c228fecbcf",
147147
"is_secret": false,
148148
"is_verified": false,
149-
"line_number": 687,
149+
"line_number": 726,
150150
"type": "Base64 High Entropy String",
151151
"verified_result": null
152152
},
153153
{
154154
"hashed_secret": "ccd9fa3711ccbf21e2951d7443fcb0c53b651eb9",
155155
"is_secret": false,
156156
"is_verified": false,
157-
"line_number": 695,
157+
"line_number": 734,
158158
"type": "Base64 High Entropy String",
159159
"verified_result": null
160160
},
161161
{
162162
"hashed_secret": "0de58b3d996020b8925e18e91bd571cf25cb7fd8",
163163
"is_secret": false,
164164
"is_verified": false,
165-
"line_number": 703,
165+
"line_number": 742,
166166
"type": "Base64 High Entropy String",
167167
"verified_result": null
168168
}

README.md

Lines changed: 100 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,70 @@ uv sync
8585
# Run tests
8686
uv run pytest
8787

88-
# Run the server locally
88+
# Run the server locally (STDIO mode - default)
8989
uv run tim-mcp
9090
```
9191

92+
## Transport Modes
93+
94+
TIM-MCP supports two transport modes for different deployment scenarios:
95+
96+
### STDIO Mode (Default)
97+
98+
STDIO is the default transport mode, perfect for MCP clients like Claude Desktop that spawn server processes on-demand.
99+
100+
```bash
101+
# STDIO mode (default)
102+
tim-mcp
103+
104+
# Explicit STDIO mode (same as default)
105+
tim-mcp --log-level DEBUG
106+
```
107+
108+
### HTTP Mode
109+
110+
HTTP mode runs the server as a web service, ideal for network deployments and multiple concurrent clients.
111+
112+
```bash
113+
# HTTP mode with defaults (127.0.0.1:8000)
114+
tim-mcp --http
115+
116+
# HTTP mode with custom port
117+
tim-mcp --http --port 8080
118+
119+
# HTTP mode with custom host and port
120+
tim-mcp --http --host 0.0.0.0 --port 9000
121+
122+
# HTTP mode with debug logging
123+
tim-mcp --http --log-level DEBUG
124+
```
125+
126+
**HTTP Server URLs:**
127+
- Server runs at: `http://host:port/`
128+
- MCP endpoint: `http://host:port/mcp`
129+
130+
**Production HTTPS:**
131+
For production deployments requiring HTTPS, use nginx as a reverse proxy:
132+
133+
```nginx
134+
server {
135+
listen 443 ssl;
136+
server_name your-domain.com;
137+
138+
# SSL configuration
139+
ssl_certificate /path/to/your/cert.pem;
140+
ssl_certificate_key /path/to/your/key.pem;
141+
142+
location / {
143+
proxy_pass http://127.0.0.1:8000;
144+
proxy_set_header Host $host;
145+
proxy_set_header X-Real-IP $remote_addr;
146+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
147+
proxy_set_header X-Forwarded-Proto $scheme;
148+
}
149+
}
150+
```
151+
92152
### Environment Variables
93153

94154
- `GITHUB_TOKEN` (optional): GitHub personal access token
@@ -171,6 +231,8 @@ This method downloads and runs TIM-MCP directly from the GitHub repository witho
171231

172232
This method is ideal for development and testing, using your local clone of the repository.
173233

234+
#### For Claude Desktop
235+
174236
**Basic Configuration:**
175237
```json
176238
{
@@ -213,6 +275,30 @@ This method is ideal for development and testing, using your local clone of the
213275
4. Update the `cwd` path in the configuration above to match your local repository path
214276
5. Add the configuration to your Claude Desktop settings
215277

278+
#### For Claude Code
279+
280+
For local development with Claude Code:
281+
282+
```bash
283+
# Navigate to your tim-mcp directory first
284+
cd /path/to/your/tim-mcp
285+
286+
# Add the local MCP server with GitHub token
287+
claude mcp add tim-mcp --env GITHUB_TOKEN=your_github_token_here \
288+
-- uv run tim-mcp
289+
290+
# Or without GitHub token (may hit rate limits)
291+
claude mcp add tim-mcp -- uv run tim-mcp
292+
293+
# List configured MCP servers
294+
claude mcp list
295+
296+
# Remove if needed
297+
claude mcp remove tim-mcp
298+
```
299+
300+
**Important:** Run these commands from within your local tim-mcp repository directory, as Claude Code will use the current working directory when executing the MCP server.
301+
216302

217303
## Verification
218304

@@ -241,7 +327,7 @@ Once configured, TIM-MCP provides these tools to Claude for comprehensive Terraf
241327

242328
**Usage Examples:**
243329
- Quick reference: `limit=3` for "I need a VPC module"
244-
- Exploring options: `limit=10-15` (default) for comparing alternatives
330+
- Exploring options: `limit=5-15` (default=5) for comparing alternatives
245331
- Comprehensive research: `limit=20+` for thorough analysis
246332

247333
### 2. `get_module_details`
@@ -287,20 +373,22 @@ Once configured, TIM-MCP provides these tools to Claude for comprehensive Terraf
287373
**Inputs:**
288374
- `module_id` (string, required): Full module identifier (e.g., "terraform-ibm-modules/vpc/ibm")
289375
- `path` (string, optional): Specific path - "" (root), "examples/basic", "modules/vpc", etc.
290-
- `include_files` (list[string], optional): Regex patterns for files to include
291-
- `exclude_files` (list[string], optional): Regex patterns for files to exclude
292-
- `include_readme` (boolean, optional): Include README.md for context (default: true)
376+
- `include_files` (list[string], optional): Glob patterns for files to include
377+
- `exclude_files` (list[string], optional): Glob patterns for files to exclude
293378
- `version` (string, optional): Git tag/branch to fetch from (default: "latest")
294379

295380
**Output:** Markdown formatted content with file contents, organized by:
296-
- File paths and content
381+
- File paths and content with appropriate syntax highlighting
297382
- File sizes for reference
298-
- Context from README files when requested
299-
300-
**Common Patterns:**
301-
- Input variables only: `include_files=["variables\\.tf$"]`
302-
- Basic example: `path="examples/basic", include_files=["main\\.tf$", "variables\\.tf$"]`
303-
- Complete module: `include_files=[".*\\.tf$"]`
383+
- README files are included if they match the patterns (like any other file)
384+
385+
**Common Glob Patterns:**
386+
- Input variables only: `include_files=["variables.tf"]`
387+
- Basic example: `path="examples/basic", include_files=["*.tf"]`
388+
- Complete module: `include_files=["*.tf"]`
389+
- Documentation: `include_files=["*.md"]`
390+
- README only: `include_files=["README.md"]`
391+
- Everything: `include_files=["*"]` (or omit entirely)
304392

305393
## Tool Workflow
306394

0 commit comments

Comments
 (0)