lineai-mcp-server 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lineai_mcp_server-1.3.1/.cursor/rules/about-codebase.mdc +9 -0
- lineai_mcp_server-1.3.1/.cursor/rules/best-practices.mdc +10 -0
- lineai_mcp_server-1.3.1/.cursor/rules/debugging.mdc +9 -0
- lineai_mcp_server-1.3.1/.cursor/rules/environment-variables.mdc +11 -0
- lineai_mcp_server-1.3.1/.cursor/rules/error-handling.mdc +18 -0
- lineai_mcp_server-1.3.1/.cursor/rules/mcp-server-pattern.mdc +24 -0
- lineai_mcp_server-1.3.1/.cursor/rules/style-guidelines.mdc +10 -0
- lineai_mcp_server-1.3.1/.cursor/rules/technologies.mdc +10 -0
- lineai_mcp_server-1.3.1/.cursor/rules/testing-approach.mdc +9 -0
- lineai_mcp_server-1.3.1/.flake8 +3 -0
- lineai_mcp_server-1.3.1/.github/ISSUE_TEMPLATE/Bug-Report.yml +102 -0
- lineai_mcp_server-1.3.1/.github/ISSUE_TEMPLATE/Feature-Request.yml +57 -0
- lineai_mcp_server-1.3.1/.github/copilot-instructions.md +99 -0
- lineai_mcp_server-1.3.1/.github/release.yml +23 -0
- lineai_mcp_server-1.3.1/.github/workflows/bump-version.yml +195 -0
- lineai_mcp_server-1.3.1/.github/workflows/ci.yml +38 -0
- lineai_mcp_server-1.3.1/.github/workflows/publish-to-pypi.yml +116 -0
- lineai_mcp_server-1.3.1/.gitignore +20 -0
- lineai_mcp_server-1.3.1/.python-version +1 -0
- lineai_mcp_server-1.3.1/.vscode/launch.json +32 -0
- lineai_mcp_server-1.3.1/.vscode/settings.json +13 -0
- lineai_mcp_server-1.3.1/CODE_OF_CONDUCT.md +36 -0
- lineai_mcp_server-1.3.1/CONTRIBUTING.md +47 -0
- lineai_mcp_server-1.3.1/LICENSE +151 -0
- lineai_mcp_server-1.3.1/PKG-INFO +465 -0
- lineai_mcp_server-1.3.1/README.md +433 -0
- lineai_mcp_server-1.3.1/SECURITY.md +22 -0
- lineai_mcp_server-1.3.1/add_license_headers.py +69 -0
- lineai_mcp_server-1.3.1/context/Python-MCP-SDK.md +2570 -0
- lineai_mcp_server-1.3.1/context/graph-mcp-tooling-ideas.md +224 -0
- lineai_mcp_server-1.3.1/context/llms-full.txt +31812 -0
- lineai_mcp_server-1.3.1/glama.json +6 -0
- lineai_mcp_server-1.3.1/publish-mcp-registry.ps1 +41 -0
- lineai_mcp_server-1.3.1/pyproject.toml +31 -0
- lineai_mcp_server-1.3.1/renovate.json +6 -0
- lineai_mcp_server-1.3.1/scripts/run_graph_e2e.sh +6 -0
- lineai_mcp_server-1.3.1/server.json +58 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/__init__.py +25 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/graph_client.py +182 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/handlers/__init__.py +203 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/handlers/common.py +54 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/handlers/database_impact.py +96 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/handlers/graph_tools.py +200 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/handlers/method_impact.py +427 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/server.py +88 -0
- lineai_mcp_server-1.3.1/src/lineai_mcp_server/utils.py +948 -0
- lineai_mcp_server-1.3.1/src/start_server.py +42 -0
- lineai_mcp_server-1.3.1/start-mcp-inspector.ps1 +8 -0
- lineai_mcp_server-1.3.1/test/.env.test.example +8 -0
- lineai_mcp_server-1.3.1/test/__init__.py +12 -0
- lineai_mcp_server-1.3.1/test/integration_test_all.py +187 -0
- lineai_mcp_server-1.3.1/test/integration_test_graph.py +174 -0
- lineai_mcp_server-1.3.1/test/test_env.py +108 -0
- lineai_mcp_server-1.3.1/test/test_fixtures.py +56 -0
- lineai_mcp_server-1.3.1/test/unit_test_environment.py +24 -0
- lineai_mcp_server-1.3.1/test/unit_test_graph_tools.py +87 -0
- lineai_mcp_server-1.3.1/test/unit_test_handlers.py +124 -0
- lineai_mcp_server-1.3.1/test/unit_test_utils.py +591 -0
- lineai_mcp_server-1.3.1/uv.lock +717 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: General information about the Lineai MCP Server codebase and its purpose
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
- This repository contains a Model Context Protocol (MCP) server that integrates with Lineai's knowledge graph APIs
|
|
7
|
+
- It enables AI programming assistants to access dependency data from Lineai to analyze code and database impacts
|
|
8
|
+
- Tools: `lineai-method-impact`, `lineai-database-impact`, and `lineai-graph-*` (capabilities, search, impact, path-explain, validate-change-scope, owners)
|
|
9
|
+
- The core package is in `src/lineai_mcp_server/` with `server.py`, `handlers/` (package), and `utils.py`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Best practices for working with the Lineai MCP Server codebase
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
- Use semantic search before grep for broader context
|
|
7
|
+
- Maintain proper error handling and logging
|
|
8
|
+
- Keep code changes atomic and focused
|
|
9
|
+
- Prefer graph tools (`lineai-graph-*`) for discovery when available; fall back to method/database impact tools
|
|
10
|
+
- Return results as clear markdown for AI assistants
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Debugging guidance for the Lineai MCP Server
|
|
3
|
+
globs: "**/*.py"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
- Enable Debug Mode by setting `LINEAI_DEBUG_MODE=true`
|
|
7
|
+
- Use debugpy capabilities for remote debugging
|
|
8
|
+
- Check logs in the logs directory for detailed information
|
|
9
|
+
- Use proper logging levels for different types of information
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Key environment variables for the Lineai MCP Server
|
|
3
|
+
globs: "**/*.py"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
- `LINEAI_SERVER_HOST`: Lineai server URL
|
|
7
|
+
- `LINEAI_USERNAME`: Username for authentication
|
|
8
|
+
- `LINEAI_PASSWORD`: Password for authentication
|
|
9
|
+
- `LINEAI_WORKSPACE_NAME`: Workspace name
|
|
10
|
+
- `LINEAI_DEBUG_MODE`: Enable debug logging
|
|
11
|
+
- `LINEAI_TEST_MODE`: Used by test framework
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Error handling patterns for the Lineai MCP Server
|
|
3
|
+
globs: "**/*.py"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Use the following pattern for error handling in tool implementations
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
try:
|
|
10
|
+
# Operations that might fail
|
|
11
|
+
except Exception as e:
|
|
12
|
+
sys.stderr.write(f"Error: {str(e)}\n")
|
|
13
|
+
return [types.TextContent(type="text", text=f"# Error\n\n{str(e)}")]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- Always catch and report exceptions
|
|
17
|
+
- Write errors to stderr
|
|
18
|
+
- Return formatted error messages to the client
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Core coding patterns for MCP Server implementation
|
|
3
|
+
globs: "**/*.py"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Use the following pattern for MCP server implementation
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
server = Server("lineai-mcp-server")
|
|
11
|
+
|
|
12
|
+
@server.list_tools()
|
|
13
|
+
async def handle_list_tools() -> list[types.Tool]:
|
|
14
|
+
# Define and return tools
|
|
15
|
+
|
|
16
|
+
@server.call_tool()
|
|
17
|
+
async def handle_call_tool(name: str, arguments: dict | None) -> list[types.TextContent]:
|
|
18
|
+
# Handle tool execution
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- New tools should be added to `handlers/__init__.py` `handle_list_tools()` with descriptive names (prefix: `lineai-`)
|
|
22
|
+
- Tool handlers should be routed in `handle_call_tool()`
|
|
23
|
+
- Create handler functions with proper error handling
|
|
24
|
+
- Return results as markdown-formatted text
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Style guidelines for the Lineai MCP Server project
|
|
3
|
+
globs: "**/*.py"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
- Include MPL 2.0 copyright headers in all Python files
|
|
7
|
+
- Use Google-style docstrings for modules/classes/functions
|
|
8
|
+
- Always use Python type hints
|
|
9
|
+
- Keep I/O operations asynchronous
|
|
10
|
+
- Return markdown-formatted text in tool responses
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Key technologies used in the Lineai MCP Server project
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
- Python 3.13+ with extensive use of async/await
|
|
7
|
+
- Model Context Protocol SDK (`mcp[cli]`)
|
|
8
|
+
- HTTPX for API requests
|
|
9
|
+
- Environment variables via dotenv for configuration
|
|
10
|
+
- Lineai graph HTTP API under `/ai-retrieval/graph/` for `lineai-graph-*` tools
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Testing approach for the Lineai MCP Server
|
|
3
|
+
globs: "**/test/*.py"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
- Use unit tests for functions without external dependencies
|
|
7
|
+
- Use integration tests for tests against a real Lineai server
|
|
8
|
+
- Set the `LINEAI_TEST_MODE` environment variable for test runs
|
|
9
|
+
- Test both success cases and error handling patterns
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: File a bug report
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: ["bug"]
|
|
5
|
+
type: Bug
|
|
6
|
+
assignees:
|
|
7
|
+
- garrmark
|
|
8
|
+
body:
|
|
9
|
+
- type: markdown
|
|
10
|
+
attributes:
|
|
11
|
+
value: |
|
|
12
|
+
Thanks for taking the time to fill out this bug report!
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: bug-description
|
|
16
|
+
attributes:
|
|
17
|
+
label: Bug Description
|
|
18
|
+
description: A clear and concise description of what the bug is.
|
|
19
|
+
placeholder: Tell us what happened...
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: reproduction-steps
|
|
25
|
+
attributes:
|
|
26
|
+
label: Steps To Reproduce
|
|
27
|
+
description: |
|
|
28
|
+
Steps to reproduce the behavior:
|
|
29
|
+
1. API endpoint accessed (e.g., '/v1/generate')
|
|
30
|
+
2. Request payload used (please include relevant JSON)
|
|
31
|
+
3. Client configuration (e.g., authentication method, headers)
|
|
32
|
+
4. Model configuration parameters (if applicable)
|
|
33
|
+
5. Observed error or unexpected behavior
|
|
34
|
+
placeholder: Provide detailed steps so we can reproduce the issue...
|
|
35
|
+
validations:
|
|
36
|
+
required: true
|
|
37
|
+
|
|
38
|
+
- type: textarea
|
|
39
|
+
id: expected-behavior
|
|
40
|
+
attributes:
|
|
41
|
+
label: Expected Behavior
|
|
42
|
+
description: A clear and concise description of what you expected to happen.
|
|
43
|
+
validations:
|
|
44
|
+
required: true
|
|
45
|
+
|
|
46
|
+
- type: textarea
|
|
47
|
+
id: screenshots
|
|
48
|
+
attributes:
|
|
49
|
+
label: Screenshots
|
|
50
|
+
description: If applicable, add screenshots to help explain your problem.
|
|
51
|
+
|
|
52
|
+
- type: dropdown
|
|
53
|
+
id: os
|
|
54
|
+
attributes:
|
|
55
|
+
label: Operating System
|
|
56
|
+
multiple: true
|
|
57
|
+
options:
|
|
58
|
+
- Windows
|
|
59
|
+
- macOS
|
|
60
|
+
- Linux
|
|
61
|
+
- Other (specify in additional context)
|
|
62
|
+
validations:
|
|
63
|
+
required: true
|
|
64
|
+
|
|
65
|
+
- type: input
|
|
66
|
+
id: python-version
|
|
67
|
+
attributes:
|
|
68
|
+
label: Python Version
|
|
69
|
+
placeholder: e.g., 3.9.10
|
|
70
|
+
validations:
|
|
71
|
+
required: true
|
|
72
|
+
|
|
73
|
+
- type: input
|
|
74
|
+
id: package-version
|
|
75
|
+
attributes:
|
|
76
|
+
label: Package Version
|
|
77
|
+
placeholder: e.g., 1.0.0
|
|
78
|
+
validations:
|
|
79
|
+
required: true
|
|
80
|
+
|
|
81
|
+
- type: input
|
|
82
|
+
id: client-implementation
|
|
83
|
+
attributes:
|
|
84
|
+
label: Client Implementation
|
|
85
|
+
description: How are you accessing the service?
|
|
86
|
+
placeholder: e.g., Python SDK, curl, etc.
|
|
87
|
+
validations:
|
|
88
|
+
required: true
|
|
89
|
+
|
|
90
|
+
- type: input
|
|
91
|
+
id: models
|
|
92
|
+
attributes:
|
|
93
|
+
label: Model(s) Used
|
|
94
|
+
placeholder: e.g., specific model versions being used
|
|
95
|
+
validations:
|
|
96
|
+
required: true
|
|
97
|
+
|
|
98
|
+
- type: textarea
|
|
99
|
+
id: additional-context
|
|
100
|
+
attributes:
|
|
101
|
+
label: Additional Context
|
|
102
|
+
description: Add any other context about the problem here.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest an idea for this project
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
type: Feature
|
|
6
|
+
assignees:
|
|
7
|
+
- garrmark
|
|
8
|
+
body:
|
|
9
|
+
- type: markdown
|
|
10
|
+
attributes:
|
|
11
|
+
value: |
|
|
12
|
+
Thanks for taking the time to suggest a new feature!
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: problem-description
|
|
16
|
+
attributes:
|
|
17
|
+
label: Is your feature request related to a problem?
|
|
18
|
+
description: A clear and concise description of what the problem is.
|
|
19
|
+
placeholder: I'm always frustrated when...
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: solution
|
|
25
|
+
attributes:
|
|
26
|
+
label: Describe the solution you'd like
|
|
27
|
+
description: A clear and concise description of what you want to happen.
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: alternatives
|
|
33
|
+
attributes:
|
|
34
|
+
label: Describe alternatives you've considered
|
|
35
|
+
description: A clear and concise description of any alternative solutions or features you've considered.
|
|
36
|
+
validations:
|
|
37
|
+
required: false
|
|
38
|
+
|
|
39
|
+
- type: textarea
|
|
40
|
+
id: context
|
|
41
|
+
attributes:
|
|
42
|
+
label: Additional context
|
|
43
|
+
description: Add any other context or screenshots about the feature request here.
|
|
44
|
+
validations:
|
|
45
|
+
required: false
|
|
46
|
+
|
|
47
|
+
- type: dropdown
|
|
48
|
+
id: priority
|
|
49
|
+
attributes:
|
|
50
|
+
label: Priority
|
|
51
|
+
description: How important is this feature to you?
|
|
52
|
+
options:
|
|
53
|
+
- Nice to have
|
|
54
|
+
- Important
|
|
55
|
+
- Critical
|
|
56
|
+
validations:
|
|
57
|
+
required: true
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Lineai MCP Server - AI Assistant Instructions
|
|
2
|
+
|
|
3
|
+
## About This Codebase
|
|
4
|
+
|
|
5
|
+
This repository contains a Model Context Protocol (MCP) server that integrates with Lineai's knowledge graph APIs. It enables AI programming assistants (like GitHub Copilot and Cursor) to access dependency data from Lineai to analyze code and database impacts.
|
|
6
|
+
|
|
7
|
+
## Key Technologies
|
|
8
|
+
|
|
9
|
+
- **Python 3.13+** with extensive use of async/await
|
|
10
|
+
- **Model Context Protocol SDK** (`mcp[cli]`)
|
|
11
|
+
- **Neo4j** for graph database operations
|
|
12
|
+
- **HTTPX** for API requests
|
|
13
|
+
- **Environment variables** via dotenv for configuration
|
|
14
|
+
|
|
15
|
+
## Project Structure
|
|
16
|
+
|
|
17
|
+
- **src/lineai_mcp_server/**: Core package
|
|
18
|
+
- **`__init__.py`**: Package initialization and entry point
|
|
19
|
+
- **`server.py`**: MCP server implementation
|
|
20
|
+
- **`handlers.py`**: Tool handlers implementation
|
|
21
|
+
- **`utils.py`**: API interaction utilities
|
|
22
|
+
|
|
23
|
+
## Core Coding Patterns
|
|
24
|
+
|
|
25
|
+
### MCP Server Pattern
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
server = Server("lineai-mcp-server")
|
|
29
|
+
|
|
30
|
+
@server.list_tools()
|
|
31
|
+
async def handle_list_tools() -> list[types.Tool]:
|
|
32
|
+
# Define and return tools
|
|
33
|
+
|
|
34
|
+
@server.call_tool()
|
|
35
|
+
async def handle_call_tool(name: str, arguments: dict | None) -> list[types.TextContent]:
|
|
36
|
+
# Handle tool execution
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Error Handling
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
try:
|
|
43
|
+
# Operations that might fail
|
|
44
|
+
except Exception as e:
|
|
45
|
+
sys.stderr.write(f"Error: {str(e)}\n")
|
|
46
|
+
return [types.TextContent(type="text", text=f"# Error\n\n{str(e)}")]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Style Guidelines
|
|
50
|
+
|
|
51
|
+
1. **Copyright Headers**: Include MPL 2.0 headers in all Python files
|
|
52
|
+
2. **Docstrings**: Google-style docstrings for modules/classes/functions
|
|
53
|
+
3. **Type Hints**: Always use Python type hints
|
|
54
|
+
4. **Asynchronous**: Keep I/O operations asynchronous
|
|
55
|
+
5. **Format Outputs**: Return markdown-formatted text in tool responses
|
|
56
|
+
|
|
57
|
+
## Tool Implementation Pattern
|
|
58
|
+
|
|
59
|
+
When implementing new MCP tools:
|
|
60
|
+
|
|
61
|
+
1. Add to `handle_list_tools()` with descriptive name (prefix: `lineai-`)
|
|
62
|
+
2. Add handler in `handle_call_tool()`
|
|
63
|
+
3. Implement handler function with error handling
|
|
64
|
+
4. Return results as markdown-formatted text
|
|
65
|
+
|
|
66
|
+
## Testing Approach
|
|
67
|
+
|
|
68
|
+
- **Unit Tests**: For functions without external dependencies
|
|
69
|
+
- **Integration Tests**: For tests against a real Lineai server
|
|
70
|
+
- Use the `LINEAI_TEST_MODE` environment variable
|
|
71
|
+
|
|
72
|
+
## Debugging
|
|
73
|
+
|
|
74
|
+
- Debug Mode: Set `LINEAI_DEBUG_MODE=true`
|
|
75
|
+
- Remote Debugging: Use debugpy capabilities
|
|
76
|
+
|
|
77
|
+
## Key Environment Variables
|
|
78
|
+
|
|
79
|
+
- `LINEAI_SERVER_HOST`: Lineai server URL
|
|
80
|
+
- `LINEAI_USERNAME`: Username for authentication
|
|
81
|
+
- `LINEAI_PASSWORD`: Password for authentication
|
|
82
|
+
- `LINEAI_WORKSPACE_NAME`: Workspace name
|
|
83
|
+
- `LINEAI_DEBUG_MODE`: Enable debug logging
|
|
84
|
+
- `LINEAI_TEST_MODE`: Used by test framework
|
|
85
|
+
|
|
86
|
+
## AI Assistant Integration
|
|
87
|
+
|
|
88
|
+
### GitHub Copilot
|
|
89
|
+
- Uses these instructions via `.github/copilot-instructions.md`
|
|
90
|
+
- Integrates through GitHub's Copilot infrastructure
|
|
91
|
+
|
|
92
|
+
### Cursor
|
|
93
|
+
- Uses these instructions via `.cursor/instructions.md`
|
|
94
|
+
- Integrates through Cursor's AI infrastructure
|
|
95
|
+
- Supports additional features like:
|
|
96
|
+
- Direct file editing
|
|
97
|
+
- Terminal command execution
|
|
98
|
+
- Code search and analysis
|
|
99
|
+
- Database impact analysis
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# .github/release.yml
|
|
2
|
+
|
|
3
|
+
changelog:
|
|
4
|
+
categories:
|
|
5
|
+
- title: New Features
|
|
6
|
+
labels:
|
|
7
|
+
- enhancement
|
|
8
|
+
- feature
|
|
9
|
+
- title: Bug Fixes
|
|
10
|
+
labels:
|
|
11
|
+
- bug
|
|
12
|
+
- fix
|
|
13
|
+
- title: Documentation
|
|
14
|
+
labels:
|
|
15
|
+
- documentation
|
|
16
|
+
- docs
|
|
17
|
+
- title: Dependencies
|
|
18
|
+
labels:
|
|
19
|
+
- dependencies
|
|
20
|
+
- dependency
|
|
21
|
+
- title: Other Changes
|
|
22
|
+
labels:
|
|
23
|
+
- '*'
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
name: Bump Version
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version_type:
|
|
7
|
+
description: 'Type of version bump (patch, minor, major)'
|
|
8
|
+
required: true
|
|
9
|
+
default: 'patch'
|
|
10
|
+
type: choice
|
|
11
|
+
options:
|
|
12
|
+
- patch
|
|
13
|
+
- minor
|
|
14
|
+
- major
|
|
15
|
+
custom_version:
|
|
16
|
+
description: 'Custom version (optional, overrides version_type if provided)'
|
|
17
|
+
required: false
|
|
18
|
+
type: string
|
|
19
|
+
release_notes:
|
|
20
|
+
description: 'Release notes for this version'
|
|
21
|
+
required: false
|
|
22
|
+
type: string
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
bump-version:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
if: github.ref == 'refs/heads/main'
|
|
28
|
+
permissions:
|
|
29
|
+
contents: write
|
|
30
|
+
outputs:
|
|
31
|
+
new_version: ${{ steps.bump_version.outputs.new_version }}
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
34
|
+
with:
|
|
35
|
+
fetch-depth: 0
|
|
36
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
37
|
+
|
|
38
|
+
- name: Set up Python
|
|
39
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
40
|
+
with:
|
|
41
|
+
python-version: '3.14'
|
|
42
|
+
|
|
43
|
+
- name: Install dependencies
|
|
44
|
+
run: |
|
|
45
|
+
python -m pip install --upgrade pip
|
|
46
|
+
pip install toml
|
|
47
|
+
|
|
48
|
+
- name: Configure Git
|
|
49
|
+
run: |
|
|
50
|
+
git config user.name "GitHub Actions"
|
|
51
|
+
git config user.email "actions@github.com"
|
|
52
|
+
|
|
53
|
+
- name: Bump version
|
|
54
|
+
id: bump_version
|
|
55
|
+
run: |
|
|
56
|
+
python -c '
|
|
57
|
+
import toml
|
|
58
|
+
import sys
|
|
59
|
+
import re
|
|
60
|
+
import os
|
|
61
|
+
import json
|
|
62
|
+
|
|
63
|
+
# Read the current version
|
|
64
|
+
with open("pyproject.toml", "r") as f:
|
|
65
|
+
config = toml.load(f)
|
|
66
|
+
|
|
67
|
+
current_version = config["project"]["version"]
|
|
68
|
+
print(f"Current version: {current_version}")
|
|
69
|
+
|
|
70
|
+
# Parse the current version
|
|
71
|
+
major, minor, patch = map(int, current_version.split("."))
|
|
72
|
+
|
|
73
|
+
# Determine the new version
|
|
74
|
+
custom_version = "${{ github.event.inputs.custom_version }}"
|
|
75
|
+
if custom_version:
|
|
76
|
+
# Validate custom version format
|
|
77
|
+
if re.match(r"^\d+\.\d+\.\d+$", custom_version):
|
|
78
|
+
new_version = custom_version
|
|
79
|
+
else:
|
|
80
|
+
print("Error: Custom version must be in format X.Y.Z")
|
|
81
|
+
sys.exit(1)
|
|
82
|
+
else:
|
|
83
|
+
version_type = "${{ github.event.inputs.version_type }}"
|
|
84
|
+
if version_type == "patch":
|
|
85
|
+
patch += 1
|
|
86
|
+
elif version_type == "minor":
|
|
87
|
+
minor += 1
|
|
88
|
+
patch = 0
|
|
89
|
+
elif version_type == "major":
|
|
90
|
+
major += 1
|
|
91
|
+
minor = 0
|
|
92
|
+
patch = 0
|
|
93
|
+
else:
|
|
94
|
+
print(f"Error: Unknown version type: {version_type}")
|
|
95
|
+
sys.exit(1)
|
|
96
|
+
|
|
97
|
+
new_version = f"{major}.{minor}.{patch}"
|
|
98
|
+
|
|
99
|
+
# Update the version in pyproject.toml
|
|
100
|
+
config["project"]["version"] = new_version
|
|
101
|
+
with open("pyproject.toml", "w") as f:
|
|
102
|
+
toml.dump(config, f)
|
|
103
|
+
|
|
104
|
+
# Update the version in server.json (both top-level and packages[].version)
|
|
105
|
+
try:
|
|
106
|
+
with open("server.json", "r") as f:
|
|
107
|
+
server_config = json.load(f)
|
|
108
|
+
server_config["version"] = new_version
|
|
109
|
+
if isinstance(server_config.get("packages"), list):
|
|
110
|
+
for pkg in server_config["packages"]:
|
|
111
|
+
if isinstance(pkg, dict) and "version" in pkg:
|
|
112
|
+
pkg["version"] = new_version
|
|
113
|
+
with open("server.json", "w") as f:
|
|
114
|
+
json.dump(server_config, f, indent=2)
|
|
115
|
+
f.write("\n")
|
|
116
|
+
except FileNotFoundError:
|
|
117
|
+
print("Warning: server.json not found; skipping update")
|
|
118
|
+
|
|
119
|
+
print(f"New version: {new_version}")
|
|
120
|
+
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
|
121
|
+
f.write(f"new_version={new_version}\n")
|
|
122
|
+
'
|
|
123
|
+
|
|
124
|
+
- name: Commit and push changes
|
|
125
|
+
run: |
|
|
126
|
+
git add pyproject.toml server.json
|
|
127
|
+
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}"
|
|
128
|
+
git push
|
|
129
|
+
|
|
130
|
+
- name: Create tag
|
|
131
|
+
run: |
|
|
132
|
+
git tag v${{ steps.bump_version.outputs.new_version }}
|
|
133
|
+
git push --tags
|
|
134
|
+
|
|
135
|
+
create-release:
|
|
136
|
+
needs: bump-version
|
|
137
|
+
runs-on: ubuntu-latest
|
|
138
|
+
if: github.ref == 'refs/heads/main'
|
|
139
|
+
permissions:
|
|
140
|
+
contents: write
|
|
141
|
+
steps:
|
|
142
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
143
|
+
with:
|
|
144
|
+
fetch-depth: 0
|
|
145
|
+
|
|
146
|
+
- name: Create GitHub Release
|
|
147
|
+
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3
|
|
148
|
+
with:
|
|
149
|
+
tag_name: v${{ needs.bump-version.outputs.new_version }}
|
|
150
|
+
name: Release v${{ needs.bump-version.outputs.new_version }}
|
|
151
|
+
body: ${{ github.event.inputs.release_notes || '' }}
|
|
152
|
+
generate_release_notes: ${{ github.event.inputs.release_notes == '' }}
|
|
153
|
+
draft: false
|
|
154
|
+
prerelease: false
|
|
155
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
156
|
+
|
|
157
|
+
- name: Notify Teams about new version
|
|
158
|
+
env:
|
|
159
|
+
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
|
|
160
|
+
VERSION: ${{ needs.bump-version.outputs.new_version }}
|
|
161
|
+
ACTOR: ${{ github.actor }}
|
|
162
|
+
NOTES: ${{ github.event.inputs.release_notes || 'No release notes provided.' }}
|
|
163
|
+
RELEASE_URL: ${{ github.server_url }}/${{ github.repository }}/releases/tag/v${{ needs.bump-version.outputs.new_version }}
|
|
164
|
+
run: |
|
|
165
|
+
jq -n \
|
|
166
|
+
--arg version "$VERSION" \
|
|
167
|
+
--arg actor "$ACTOR" \
|
|
168
|
+
--arg notes "$NOTES" \
|
|
169
|
+
--arg release_url "$RELEASE_URL" \
|
|
170
|
+
'{
|
|
171
|
+
type: "message",
|
|
172
|
+
attachments: [{
|
|
173
|
+
contentType: "application/vnd.microsoft.card.adaptive",
|
|
174
|
+
contentUrl: null,
|
|
175
|
+
content: {
|
|
176
|
+
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
177
|
+
type: "AdaptiveCard",
|
|
178
|
+
version: "1.4",
|
|
179
|
+
body: [
|
|
180
|
+
{ type: "TextBlock", weight: "Bolder", size: "Medium", text: "New Version Released" },
|
|
181
|
+
{ type: "FactSet", facts: [
|
|
182
|
+
{ title: "Package", value: ("lineai-mcp-server v" + $version) },
|
|
183
|
+
{ title: "Released by", value: $actor }
|
|
184
|
+
]},
|
|
185
|
+
{ type: "TextBlock", text: $notes, wrap: true }
|
|
186
|
+
],
|
|
187
|
+
actions: [{
|
|
188
|
+
type: "Action.OpenUrl",
|
|
189
|
+
title: "View Release on GitHub",
|
|
190
|
+
url: $release_url
|
|
191
|
+
}]
|
|
192
|
+
}
|
|
193
|
+
}]
|
|
194
|
+
}' | curl -fsS -X POST -H 'Content-Type: application/json' \
|
|
195
|
+
-d @- "$TEAMS_WEBHOOK_URL"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: [3.13]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
env:
|
|
24
|
+
PIP_PROGRESS_BAR: off
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip -q
|
|
27
|
+
python -m pip install uv -q
|
|
28
|
+
uv pip install --system -e ".[dev]" --quiet
|
|
29
|
+
python -m pip install flake8 -q
|
|
30
|
+
- name: Lint with flake8
|
|
31
|
+
run: |
|
|
32
|
+
# stop the build if there are Python syntax errors or undefined names
|
|
33
|
+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
34
|
+
# exit-zero treats all errors as warnings (quiet: only violations, no per-file stats)
|
|
35
|
+
flake8 . --count --exit-zero --max-complexity=10 --quiet
|
|
36
|
+
- name: Test with unittest
|
|
37
|
+
run: |
|
|
38
|
+
python -m unittest discover -s test -p "unit*.py"
|