Skip to content

Commit 319bdcd

Browse files
first commit
0 parents  commit 319bdcd

File tree

88 files changed

+9355
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+9355
-0
lines changed

.env.example

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
APP_NAME=LaravelMCP
2+
APP_ENV=testing
3+
APP_KEY=base64:your-test-key-here
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
9+
LOG_LEVEL=debug
10+
11+
DB_CONNECTION=sqlite
12+
DB_DATABASE=database/database.sqlite
13+
14+
BROADCAST_DRIVER=log
15+
CACHE_DRIVER=file
16+
FILESYSTEM_DISK=local
17+
QUEUE_CONNECTION=sync
18+
SESSION_DRIVER=file
19+
SESSION_LIFETIME=120
20+
21+
MCP_SERVER_HOST=127.0.0.1
22+
MCP_SERVER_PORT=3000
23+
MCP_SERVER_TRANSPORT=http
24+
MCP_API_BASE_URL=http://localhost:3000
25+
MCP_API_KEY=test-api-key

.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
php: [8.1, 8.2, 8.3]
16+
laravel: [10.*]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
extensions: mbstring, xml, ctype, iconv, intl, xdebug
26+
coverage: xdebug
27+
28+
- name: Install Dependencies
29+
run: composer install --prefer-dist --no-progress
30+
31+
- name: Check Code Style
32+
run: |
33+
vendor/bin/php-cs-fixer fix --dry-run --diff
34+
vendor/bin/phpcs
35+
36+
- name: Static Analysis
37+
run: vendor/bin/phpstan analyse
38+
39+
- name: Execute tests via PHPUnit with coverage
40+
run: vendor/bin/phpunit --coverage-clover coverage.xml
41+
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v4
44+
with:
45+
token: ${{ secrets.CODECOV_TOKEN }}
46+
files: ./coverage.xml
47+
fail_ci_if_error: false # Set to true once coverage is stable
48+
verbose: true

.gitignore

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Dependencies
2+
/vendor
3+
composer.lock
4+
clover.xml
5+
# IDE and Editor Files
6+
.idea/
7+
.vscode/
8+
*.sublime-project
9+
*.sublime-workspace
10+
*.code-workspace
11+
.project
12+
.settings/
13+
.classpath
14+
.buildpath
15+
*.swp
16+
*.swo
17+
*~
18+
19+
# Testing and Coverage
20+
/coverage
21+
.phpunit.result.cache
22+
.phpunit.cache
23+
phpunit.xml.bak
24+
.php_cs.cache
25+
.php-cs-fixer.cache
26+
27+
# Environment Files
28+
.env
29+
.env.backup
30+
.env.*.local
31+
32+
# Operating System Files
33+
.DS_Store
34+
Thumbs.db
35+
*.log
36+
37+
# Build and Distribution
38+
/build
39+
/dist
40+
*.phar
41+
42+
# Cache and Temporary Files
43+
*.cache
44+
*.tmp
45+
*.temp
46+
47+
# Local Development
48+
/storage/*.key
49+
/.vagrant
50+
/node_modules
51+
npm-debug.log
52+
yarn-error.log
53+
*.hot-update.js
54+
*.hot-update.json
55+
56+
# Documentation
57+
/docs/_build/
58+
/docs/_static/
59+
/docs/_templates/
60+
61+
# Misc
62+
*.bak
63+
*.orig
64+
.php_cs
65+
.php_cs.dist

.php-cs-fixer.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
->name('*.php')
9+
->ignoreDotFiles(true)
10+
->ignoreVCS(true);
11+
12+
return (new PhpCsFixer\Config())
13+
->setRules([
14+
'@PSR12' => true,
15+
'array_syntax' => ['syntax' => 'short'],
16+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
17+
'no_unused_imports' => true,
18+
'not_operator_with_successor_space' => true,
19+
'trailing_comma_in_multiline' => true,
20+
'phpdoc_scalar' => true,
21+
'unary_operator_spaces' => true,
22+
'binary_operator_spaces' => true,
23+
'blank_line_before_statement' => [
24+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
25+
],
26+
'phpdoc_single_line_var_spacing' => true,
27+
'phpdoc_var_without_name' => true,
28+
'class_attributes_separation' => [
29+
'elements' => [
30+
'method' => 'one',
31+
],
32+
],
33+
'method_argument_space' => [
34+
'on_multiline' => 'ensure_fully_multiline',
35+
'keep_multiple_spaces_after_comma' => true,
36+
],
37+
'single_trait_insert_per_statement' => true,
38+
])
39+
->setFinder($finder);

CONTRIBUTING.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Contributing to LaravelMCP
2+
3+
We love your input! We want to make contributing to LaravelMCP as easy and transparent as possible, whether it's:
4+
5+
- Reporting a bug
6+
- Discussing the current state of the code
7+
- Submitting a fix
8+
- Proposing new features
9+
- Becoming a maintainer
10+
11+
## We Develop with Github
12+
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
13+
14+
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html)
15+
Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:
16+
17+
1. Fork the repo and create your branch from `main`.
18+
2. If you've added code that should be tested, add tests.
19+
3. If you've changed APIs, update the documentation.
20+
4. Ensure the test suite passes.
21+
5. Make sure your code lints.
22+
6. Issue that pull request!
23+
24+
## Any contributions you make will be under the MIT Software License
25+
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
26+
27+
## Report bugs using Github's [issue tracker](https://github.com/laravelmcp/mcp/issues)
28+
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/laravelmcp/mcp/issues/new); it's that easy!
29+
30+
## Write bug reports with detail, background, and sample code
31+
32+
**Great Bug Reports** tend to have:
33+
34+
- A quick summary and/or background
35+
- Steps to reproduce
36+
- Be specific!
37+
- Give sample code if you can.
38+
- What you expected would happen
39+
- What actually happens
40+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
41+
42+
## Use a Consistent Coding Style
43+
44+
* Use PHP 8.1+ features
45+
* Follow PSR-12 coding standards
46+
* 4 spaces for indentation rather than tabs
47+
* You can try running `composer cs-fix` for style unification
48+
49+
## License
50+
By contributing, you agree that your contributions will be licensed under its MIT License.

FILE_INDEX.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Laravel MCP File Index
2+
3+
## Root Directory
4+
- `README.md` - Main documentation and usage guide
5+
- `composer.json` - Package dependencies and metadata
6+
- `composer.lock` - Locked package versions
7+
- `phpunit.xml` - PHPUnit test configuration
8+
- `phpstan.neon` - PHPStan static analysis configuration
9+
- `phpcs.xml` - PHP CodeSniffer configuration
10+
- `.php-cs-fixer.php` - PHP CS Fixer configuration
11+
- `.env.example` - Example environment configuration
12+
- `CONTRIBUTING.md` - Contribution guidelines
13+
- `LICENSE.md` - MIT license details
14+
- `check.bat` - Windows batch script for running checks
15+
16+
## Source Code (`src/`)
17+
### Core Files
18+
- `MCPServiceProvider.php` - Laravel service provider for MCP
19+
- `MCPClient.php` - Main client implementation
20+
- `Root.php` - Root management implementation
21+
- `Implementation.php` - Base implementation class
22+
23+
### Directories
24+
- `Contracts/` - Interface definitions
25+
- `Capabilities/` - Feature capability implementations
26+
- `Logging/` - Logging system implementation
27+
- `Pagination/` - Pagination support classes
28+
- `Requests/` - Request handling classes
29+
- `Notifications/` - Progress notification system
30+
- `Sampling/` - Sampling functionality
31+
- `Transport/` - Transport layer implementations (HTTP, WebSocket, Stdio)
32+
- `Commands/` - Artisan command implementations
33+
- `Server/` - Server-side implementations
34+
- `Facades/` - Laravel facade implementations
35+
36+
## Examples (`examples/`)
37+
- `README.md` - Examples documentation
38+
- `http_server.php` - HTTP transport server example
39+
- `http_client.php` - HTTP transport client example
40+
- `websocket_server.php` - WebSocket transport server example
41+
- `websocket_client.php` - WebSocket transport client example
42+
- `cli_tool.php` - Command-line interface example
43+
44+
## Tests (`tests/`)
45+
### Core Test Files
46+
- `TestCase.php` - Base test case class
47+
48+
### Test Directories
49+
- `Unit/` - Unit tests
50+
- `Feature/` - Feature tests
51+
- `Transport/` - Transport layer tests
52+
- `Commands/` - Command tests
53+
- `Facades/` - Facade tests
54+
- `Server/` - Server implementation tests
55+
56+
## Configuration (`config/`)
57+
- Configuration files for the package
58+
59+
## GitHub Workflows (`.github/`)
60+
- GitHub Actions workflow configurations
61+
62+
## Build and Cache Directories
63+
- `build/` - Build artifacts
64+
- `vendor/` - Composer dependencies
65+
- `.phpunit.cache/` - PHPUnit cache
66+
- `.git/` - Git repository data
67+
68+
## Development Configuration Files
69+
- `.gitignore` - Git ignore rules
70+
- `.php-cs-fixer.cache` - PHP CS Fixer cache
71+
- `phpunit.xml.bak` - PHPUnit configuration backup
72+
- `.phpunit.result.cache` - PHPUnit results cache
73+
74+
## Directory Structure
75+
```
76+
laravelmcp/
77+
├── src/ # Source code
78+
│ ├── Contracts/ # Interfaces
79+
│ ├── Capabilities/ # Feature implementations
80+
│ ├── Transport/ # Transport implementations
81+
│ └── ... # Other components
82+
├── tests/ # Test suite
83+
│ ├── Unit/ # Unit tests
84+
│ ├── Feature/ # Feature tests
85+
│ └── ... # Other test categories
86+
├── examples/ # Example implementations
87+
├── config/ # Configuration files
88+
└── .github/ # GitHub configurations
89+
```
90+
91+
## Key Components
92+
1. **Core Implementation**
93+
- `MCPClient.php` - Main client class
94+
- `MCPServiceProvider.php` - Service provider
95+
- `Root.php` - Root management
96+
97+
2. **Transport Layer**
98+
- HTTP implementation
99+
- WebSocket implementation
100+
- Stdio implementation
101+
102+
3. **Feature Modules**
103+
- Capabilities system
104+
- Logging system
105+
- Pagination support
106+
- Notification system
107+
- Resource management
108+
109+
4. **Development Tools**
110+
- PHPUnit for testing
111+
- PHPStan for static analysis
112+
- PHP CS Fixer for code style
113+
- Composer for dependency management

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 LaravelMCP
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)