easy-skill-server 0.1.0__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.
- easy_skill_server-0.1.0/LICENSE +21 -0
- easy_skill_server-0.1.0/PKG-INFO +325 -0
- easy_skill_server-0.1.0/README.md +292 -0
- easy_skill_server-0.1.0/pyproject.toml +69 -0
- easy_skill_server-0.1.0/setup.cfg +4 -0
- easy_skill_server-0.1.0/src/easy_skill_server.egg-info/PKG-INFO +325 -0
- easy_skill_server-0.1.0/src/easy_skill_server.egg-info/SOURCES.txt +17 -0
- easy_skill_server-0.1.0/src/easy_skill_server.egg-info/dependency_links.txt +1 -0
- easy_skill_server-0.1.0/src/easy_skill_server.egg-info/requires.txt +12 -0
- easy_skill_server-0.1.0/src/easy_skill_server.egg-info/top_level.txt +1 -0
- easy_skill_server-0.1.0/src/skillserver/__init__.py +30 -0
- easy_skill_server-0.1.0/src/skillserver/discovery.py +261 -0
- easy_skill_server-0.1.0/src/skillserver/models.py +71 -0
- easy_skill_server-0.1.0/src/skillserver/server.py +211 -0
- easy_skill_server-0.1.0/src/skillserver/tools.py +187 -0
- easy_skill_server-0.1.0/src/skillserver/utils.py +108 -0
- easy_skill_server-0.1.0/tests/test_discovery.py +122 -0
- easy_skill_server-0.1.0/tests/test_models.py +102 -0
- easy_skill_server-0.1.0/tests/test_utils.py +77 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Serpro - Serviço Federal de Processamento de Dados
|
|
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,0 +1,325 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: easy-skill-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Biblioteca para servir Agent Skills via Model Context Protocol (MCP)
|
|
5
|
+
Author-email: Serpro <vital@serpro.gov.br>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://git.serpro/vital/easy-skill-server
|
|
8
|
+
Project-URL: Documentation, https://git.serpro/vital/easy-skill-server/docs
|
|
9
|
+
Project-URL: Repository, https://git.serpro/vital/easy-skill-server
|
|
10
|
+
Keywords: mcp,agent,skills,ai,anthropic
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: fastmcp>=0.4.0
|
|
22
|
+
Requires-Dist: uvicorn>=0.30.0
|
|
23
|
+
Requires-Dist: pyyaml>=6.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.3.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.8.0; extra == "dev"
|
|
30
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# SkillServer MCP
|
|
35
|
+
|
|
36
|
+
**Biblioteca Python para servir Agent Skills via Model Context Protocol (MCP)**
|
|
37
|
+
|
|
38
|
+
SkillServer MCP é uma biblioteca que permite a qualquer pessoa criar e servir [Agent Skills](https://agentskills.io) facilmente através do [Model Context Protocol](https://modelcontextprotocol.io) da Anthropic.
|
|
39
|
+
|
|
40
|
+
## 🎯 O que é?
|
|
41
|
+
|
|
42
|
+
Uma biblioteca Python que:
|
|
43
|
+
- ✅ Descobre automaticamente skills de um diretório
|
|
44
|
+
- ✅ Expõe skills via MCP (HTTP/SSE)
|
|
45
|
+
- ✅ Fornece API simples com `create_server()`
|
|
46
|
+
- ✅ Inclui imagem Docker pronta para uso
|
|
47
|
+
- ✅ Segue princípios SOLID e boas práticas
|
|
48
|
+
|
|
49
|
+
## 🚀 Quick Start
|
|
50
|
+
|
|
51
|
+
### Instalação
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install easy-skill-server
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Uso via Python
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from skillserver import create_server
|
|
61
|
+
|
|
62
|
+
# Cria e inicia servidor de skills
|
|
63
|
+
create_server(skills_dir="./skills")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Pronto! Seu servidor MCP está rodando em `http://localhost:8000`
|
|
67
|
+
|
|
68
|
+
### Uso via Docker
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Executar com Docker
|
|
72
|
+
docker run -p 8000:8000 \
|
|
73
|
+
-v ./skills:/skills:ro \
|
|
74
|
+
-e SKILLS_DIR=/skills \
|
|
75
|
+
easy-skill-server:latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Ou use `docker-compose.yml`:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
version: '3.8'
|
|
82
|
+
|
|
83
|
+
services:
|
|
84
|
+
skillserver:
|
|
85
|
+
image: easy-skill-server:latest
|
|
86
|
+
ports:
|
|
87
|
+
- "8000:8000"
|
|
88
|
+
volumes:
|
|
89
|
+
- ./skills:/skills:ro
|
|
90
|
+
environment:
|
|
91
|
+
SKILLS_DIR: /skills
|
|
92
|
+
LOG_LEVEL: INFO
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
docker-compose up -d
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 📁 Estrutura de Skills
|
|
100
|
+
|
|
101
|
+
Segue o padrão [serpro-skills](https://agentskills.io) (Progressive Disclosure):
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
skills/
|
|
105
|
+
└── nome-da-skill/
|
|
106
|
+
├── SKILL.md # Obrigatório: Metadados + instruções
|
|
107
|
+
├── references/ # Opcional: Documentação de referência
|
|
108
|
+
├── scripts/ # Opcional: Scripts auxiliares
|
|
109
|
+
└── assets/ # Opcional: Templates, arquivos
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Exemplo de SKILL.md:
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
---
|
|
116
|
+
name: minha-skill
|
|
117
|
+
description: Descrição curta de quando usar esta skill
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
# Minha Skill
|
|
121
|
+
|
|
122
|
+
## Contexto e Objetivo
|
|
123
|
+
O que esta skill faz e qual problema resolve.
|
|
124
|
+
|
|
125
|
+
## Instruções de Uso
|
|
126
|
+
1. Passo 1
|
|
127
|
+
2. Passo 2
|
|
128
|
+
|
|
129
|
+
## Referências
|
|
130
|
+
- Veja [doc.md](references/doc.md) para detalhes
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Compatibilidade
|
|
134
|
+
|
|
135
|
+
Também suporta arquivos `.md` soltos (fallback) se nenhum diretório com `SKILL.md` for encontrado.
|
|
136
|
+
|
|
137
|
+
## 🔧 API Completa
|
|
138
|
+
|
|
139
|
+
### `create_server()`
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from skillserver import create_server
|
|
143
|
+
|
|
144
|
+
server = create_server(
|
|
145
|
+
skills_dir="./skills", # Diretório das skills
|
|
146
|
+
host="0.0.0.0", # Host (padrão: 0.0.0.0)
|
|
147
|
+
port=8000, # Porta (padrão: 8000)
|
|
148
|
+
name="MySkillServer", # Nome do servidor
|
|
149
|
+
version="1.0.0", # Versão
|
|
150
|
+
log_level="INFO", # DEBUG, INFO, WARNING, ERROR
|
|
151
|
+
run=True # Iniciar automaticamente
|
|
152
|
+
)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### `SkillServer` Class
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from skillserver import SkillServer
|
|
159
|
+
|
|
160
|
+
# Criar servidor sem iniciar automaticamente
|
|
161
|
+
server = SkillServer(
|
|
162
|
+
skills_dir="./skills",
|
|
163
|
+
name="MyServer",
|
|
164
|
+
version="1.0.0",
|
|
165
|
+
log_level="DEBUG"
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
# Obter app ASGI para integração customizada
|
|
169
|
+
app = server.get_asgi_app()
|
|
170
|
+
|
|
171
|
+
# Iniciar servidor manualmente
|
|
172
|
+
server.run(host="0.0.0.0", port=8000)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 🐳 Docker
|
|
176
|
+
|
|
177
|
+
### Build Local
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
docker build -t easy-skill-server:latest .
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Configuração via Variáveis de Ambiente
|
|
184
|
+
|
|
185
|
+
| Variável | Descrição | Padrão |
|
|
186
|
+
|----------|-----------|--------|
|
|
187
|
+
| `SKILLS_DIR` | Diretório das skills | `/skills` |
|
|
188
|
+
| `SERVER_HOST` | Host para bind | `0.0.0.0` |
|
|
189
|
+
| `SERVER_PORT` | Porta do servidor | `8000` |
|
|
190
|
+
| `SERVER_NAME` | Nome do servidor | `SkillServer` |
|
|
191
|
+
| `SERVER_VERSION` | Versão do servidor | `0.1.0` |
|
|
192
|
+
| `LOG_LEVEL` | Nível de log | `INFO` |
|
|
193
|
+
|
|
194
|
+
### Healthcheck
|
|
195
|
+
|
|
196
|
+
A imagem inclui healthcheck automático:
|
|
197
|
+
```bash
|
|
198
|
+
docker ps # Verifica health status
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## 🏗️ Arquitetura
|
|
202
|
+
|
|
203
|
+
O projeto segue princípios SOLID:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
src/skillserver/
|
|
207
|
+
├── __init__.py # API pública
|
|
208
|
+
├── server.py # SkillServer (Facade)
|
|
209
|
+
├── discovery.py # SkillDiscovery (Repository)
|
|
210
|
+
├── tools.py # SkillTools (Strategy)
|
|
211
|
+
├── models.py # Skill, SkillResource (Data)
|
|
212
|
+
└── utils.py # Funções utilitárias
|
|
213
|
+
|
|
214
|
+
entrypoint.py # Entrypoint Docker
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Princípios SOLID Aplicados
|
|
218
|
+
|
|
219
|
+
- **S**ingle Responsibility: Cada classe tem uma responsabilidade
|
|
220
|
+
- **O**pen/Closed: Extensível via herança
|
|
221
|
+
- **L**iskov Substitution: Interfaces claras
|
|
222
|
+
- **I**nterface Segregation: APIs focadas
|
|
223
|
+
- **D**ependency Inversion: Injeção de dependências
|
|
224
|
+
|
|
225
|
+
## 📚 Exemplos
|
|
226
|
+
|
|
227
|
+
Veja exemplos completos em [`examples/`](examples/):
|
|
228
|
+
- [`hello-world.md`](examples/basic/hello-world.md) - Skill básica
|
|
229
|
+
- [`documentation-helper.md`](examples/basic/documentation-helper.md) - Skill avançada
|
|
230
|
+
|
|
231
|
+
## 🧪 Desenvolvimento
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Clone o repositório
|
|
235
|
+
git clone https://git.serpro/vital/easy-skill-server.git
|
|
236
|
+
cd easy-skill-server
|
|
237
|
+
|
|
238
|
+
# Crie ambiente virtual
|
|
239
|
+
python -m venv venv
|
|
240
|
+
source venv/bin/activate # Linux/Mac
|
|
241
|
+
# ou
|
|
242
|
+
venv\Scripts\activate # Windows
|
|
243
|
+
|
|
244
|
+
# Instale em modo desenvolvimento
|
|
245
|
+
pip install -e ".[dev]"
|
|
246
|
+
# ou use o Makefile
|
|
247
|
+
make dev-install
|
|
248
|
+
|
|
249
|
+
# Execute testes
|
|
250
|
+
pytest
|
|
251
|
+
# ou
|
|
252
|
+
make test
|
|
253
|
+
|
|
254
|
+
# Testes com cobertura
|
|
255
|
+
make test-cov
|
|
256
|
+
|
|
257
|
+
# Formatação de código
|
|
258
|
+
black src/ tests/
|
|
259
|
+
ruff check src/ tests/
|
|
260
|
+
# ou
|
|
261
|
+
make format
|
|
262
|
+
|
|
263
|
+
# Type checking
|
|
264
|
+
mypy src/
|
|
265
|
+
# ou
|
|
266
|
+
make lint
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Comandos Make disponíveis
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
make help # Mostra todos os comandos disponíveis
|
|
273
|
+
make install # Instala o pacote localmente
|
|
274
|
+
make dev-install # Instala com dependências de dev
|
|
275
|
+
make test # Executa testes
|
|
276
|
+
make test-cov # Testes com cobertura
|
|
277
|
+
make lint # Executa linters
|
|
278
|
+
make format # Formata código
|
|
279
|
+
make clean # Limpa arquivos de build
|
|
280
|
+
make build # Gera pacotes de distribuição
|
|
281
|
+
make docker-build # Constrói imagem Docker
|
|
282
|
+
make docker-run # Executa container
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## 📦 Publicação
|
|
286
|
+
|
|
287
|
+
Para publicar no repositório Nexus do Serpro, consulte o guia completo em [PUBLISH.md](PUBLISH.md).
|
|
288
|
+
|
|
289
|
+
### Quick Start para Publicação:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
# 1. Configure as credenciais (uma vez)
|
|
293
|
+
cp .pypirc.example ~/.pypirc
|
|
294
|
+
# Edite ~/.pypirc com suas credenciais
|
|
295
|
+
|
|
296
|
+
# 2. Atualize a versão (se necessário)
|
|
297
|
+
make version-patch # 0.1.0 -> 0.1.1
|
|
298
|
+
# ou
|
|
299
|
+
make version-minor # 0.1.0 -> 0.2.0
|
|
300
|
+
|
|
301
|
+
# 3. Publique
|
|
302
|
+
make release
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Para mais detalhes, incluindo configuração de CI/CD, troubleshooting e instalação a partir do Nexus, veja [PUBLISH.md](PUBLISH.md).
|
|
306
|
+
|
|
307
|
+
## 📖 Documentação Adicional
|
|
308
|
+
|
|
309
|
+
- [Model Context Protocol (MCP)](https://modelcontextprotocol.io)
|
|
310
|
+
- [Agent Skills Standard](https://agentskills.io)
|
|
311
|
+
- [FastMCP Framework](https://github.com/jlowin/fastmcp)
|
|
312
|
+
|
|
313
|
+
## 📄 Licença
|
|
314
|
+
|
|
315
|
+
MIT License - veja [LICENSE](LICENSE) para detalhes.
|
|
316
|
+
|
|
317
|
+
## 🤝 Contribuindo
|
|
318
|
+
|
|
319
|
+
Contribuições são bem-vindas! Por favor:
|
|
320
|
+
|
|
321
|
+
1. Fork o projeto
|
|
322
|
+
2. Crie uma branch para sua feature (`git checkout -b feature/amazing`)
|
|
323
|
+
3. Commit suas mudanças (`git commit -m 'Add amazing feature'`)
|
|
324
|
+
4. Push para a branch (`git push origin feature/amazing`)
|
|
325
|
+
5. Abra um Pull Request
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# SkillServer MCP
|
|
2
|
+
|
|
3
|
+
**Biblioteca Python para servir Agent Skills via Model Context Protocol (MCP)**
|
|
4
|
+
|
|
5
|
+
SkillServer MCP é uma biblioteca que permite a qualquer pessoa criar e servir [Agent Skills](https://agentskills.io) facilmente através do [Model Context Protocol](https://modelcontextprotocol.io) da Anthropic.
|
|
6
|
+
|
|
7
|
+
## 🎯 O que é?
|
|
8
|
+
|
|
9
|
+
Uma biblioteca Python que:
|
|
10
|
+
- ✅ Descobre automaticamente skills de um diretório
|
|
11
|
+
- ✅ Expõe skills via MCP (HTTP/SSE)
|
|
12
|
+
- ✅ Fornece API simples com `create_server()`
|
|
13
|
+
- ✅ Inclui imagem Docker pronta para uso
|
|
14
|
+
- ✅ Segue princípios SOLID e boas práticas
|
|
15
|
+
|
|
16
|
+
## 🚀 Quick Start
|
|
17
|
+
|
|
18
|
+
### Instalação
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install easy-skill-server
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Uso via Python
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from skillserver import create_server
|
|
28
|
+
|
|
29
|
+
# Cria e inicia servidor de skills
|
|
30
|
+
create_server(skills_dir="./skills")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Pronto! Seu servidor MCP está rodando em `http://localhost:8000`
|
|
34
|
+
|
|
35
|
+
### Uso via Docker
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Executar com Docker
|
|
39
|
+
docker run -p 8000:8000 \
|
|
40
|
+
-v ./skills:/skills:ro \
|
|
41
|
+
-e SKILLS_DIR=/skills \
|
|
42
|
+
easy-skill-server:latest
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Ou use `docker-compose.yml`:
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
version: '3.8'
|
|
49
|
+
|
|
50
|
+
services:
|
|
51
|
+
skillserver:
|
|
52
|
+
image: easy-skill-server:latest
|
|
53
|
+
ports:
|
|
54
|
+
- "8000:8000"
|
|
55
|
+
volumes:
|
|
56
|
+
- ./skills:/skills:ro
|
|
57
|
+
environment:
|
|
58
|
+
SKILLS_DIR: /skills
|
|
59
|
+
LOG_LEVEL: INFO
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
docker-compose up -d
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 📁 Estrutura de Skills
|
|
67
|
+
|
|
68
|
+
Segue o padrão [serpro-skills](https://agentskills.io) (Progressive Disclosure):
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
skills/
|
|
72
|
+
└── nome-da-skill/
|
|
73
|
+
├── SKILL.md # Obrigatório: Metadados + instruções
|
|
74
|
+
├── references/ # Opcional: Documentação de referência
|
|
75
|
+
├── scripts/ # Opcional: Scripts auxiliares
|
|
76
|
+
└── assets/ # Opcional: Templates, arquivos
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Exemplo de SKILL.md:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
---
|
|
83
|
+
name: minha-skill
|
|
84
|
+
description: Descrição curta de quando usar esta skill
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
# Minha Skill
|
|
88
|
+
|
|
89
|
+
## Contexto e Objetivo
|
|
90
|
+
O que esta skill faz e qual problema resolve.
|
|
91
|
+
|
|
92
|
+
## Instruções de Uso
|
|
93
|
+
1. Passo 1
|
|
94
|
+
2. Passo 2
|
|
95
|
+
|
|
96
|
+
## Referências
|
|
97
|
+
- Veja [doc.md](references/doc.md) para detalhes
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Compatibilidade
|
|
101
|
+
|
|
102
|
+
Também suporta arquivos `.md` soltos (fallback) se nenhum diretório com `SKILL.md` for encontrado.
|
|
103
|
+
|
|
104
|
+
## 🔧 API Completa
|
|
105
|
+
|
|
106
|
+
### `create_server()`
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from skillserver import create_server
|
|
110
|
+
|
|
111
|
+
server = create_server(
|
|
112
|
+
skills_dir="./skills", # Diretório das skills
|
|
113
|
+
host="0.0.0.0", # Host (padrão: 0.0.0.0)
|
|
114
|
+
port=8000, # Porta (padrão: 8000)
|
|
115
|
+
name="MySkillServer", # Nome do servidor
|
|
116
|
+
version="1.0.0", # Versão
|
|
117
|
+
log_level="INFO", # DEBUG, INFO, WARNING, ERROR
|
|
118
|
+
run=True # Iniciar automaticamente
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### `SkillServer` Class
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from skillserver import SkillServer
|
|
126
|
+
|
|
127
|
+
# Criar servidor sem iniciar automaticamente
|
|
128
|
+
server = SkillServer(
|
|
129
|
+
skills_dir="./skills",
|
|
130
|
+
name="MyServer",
|
|
131
|
+
version="1.0.0",
|
|
132
|
+
log_level="DEBUG"
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Obter app ASGI para integração customizada
|
|
136
|
+
app = server.get_asgi_app()
|
|
137
|
+
|
|
138
|
+
# Iniciar servidor manualmente
|
|
139
|
+
server.run(host="0.0.0.0", port=8000)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 🐳 Docker
|
|
143
|
+
|
|
144
|
+
### Build Local
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
docker build -t easy-skill-server:latest .
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Configuração via Variáveis de Ambiente
|
|
151
|
+
|
|
152
|
+
| Variável | Descrição | Padrão |
|
|
153
|
+
|----------|-----------|--------|
|
|
154
|
+
| `SKILLS_DIR` | Diretório das skills | `/skills` |
|
|
155
|
+
| `SERVER_HOST` | Host para bind | `0.0.0.0` |
|
|
156
|
+
| `SERVER_PORT` | Porta do servidor | `8000` |
|
|
157
|
+
| `SERVER_NAME` | Nome do servidor | `SkillServer` |
|
|
158
|
+
| `SERVER_VERSION` | Versão do servidor | `0.1.0` |
|
|
159
|
+
| `LOG_LEVEL` | Nível de log | `INFO` |
|
|
160
|
+
|
|
161
|
+
### Healthcheck
|
|
162
|
+
|
|
163
|
+
A imagem inclui healthcheck automático:
|
|
164
|
+
```bash
|
|
165
|
+
docker ps # Verifica health status
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## 🏗️ Arquitetura
|
|
169
|
+
|
|
170
|
+
O projeto segue princípios SOLID:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
src/skillserver/
|
|
174
|
+
├── __init__.py # API pública
|
|
175
|
+
├── server.py # SkillServer (Facade)
|
|
176
|
+
├── discovery.py # SkillDiscovery (Repository)
|
|
177
|
+
├── tools.py # SkillTools (Strategy)
|
|
178
|
+
├── models.py # Skill, SkillResource (Data)
|
|
179
|
+
└── utils.py # Funções utilitárias
|
|
180
|
+
|
|
181
|
+
entrypoint.py # Entrypoint Docker
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Princípios SOLID Aplicados
|
|
185
|
+
|
|
186
|
+
- **S**ingle Responsibility: Cada classe tem uma responsabilidade
|
|
187
|
+
- **O**pen/Closed: Extensível via herança
|
|
188
|
+
- **L**iskov Substitution: Interfaces claras
|
|
189
|
+
- **I**nterface Segregation: APIs focadas
|
|
190
|
+
- **D**ependency Inversion: Injeção de dependências
|
|
191
|
+
|
|
192
|
+
## 📚 Exemplos
|
|
193
|
+
|
|
194
|
+
Veja exemplos completos em [`examples/`](examples/):
|
|
195
|
+
- [`hello-world.md`](examples/basic/hello-world.md) - Skill básica
|
|
196
|
+
- [`documentation-helper.md`](examples/basic/documentation-helper.md) - Skill avançada
|
|
197
|
+
|
|
198
|
+
## 🧪 Desenvolvimento
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Clone o repositório
|
|
202
|
+
git clone https://git.serpro/vital/easy-skill-server.git
|
|
203
|
+
cd easy-skill-server
|
|
204
|
+
|
|
205
|
+
# Crie ambiente virtual
|
|
206
|
+
python -m venv venv
|
|
207
|
+
source venv/bin/activate # Linux/Mac
|
|
208
|
+
# ou
|
|
209
|
+
venv\Scripts\activate # Windows
|
|
210
|
+
|
|
211
|
+
# Instale em modo desenvolvimento
|
|
212
|
+
pip install -e ".[dev]"
|
|
213
|
+
# ou use o Makefile
|
|
214
|
+
make dev-install
|
|
215
|
+
|
|
216
|
+
# Execute testes
|
|
217
|
+
pytest
|
|
218
|
+
# ou
|
|
219
|
+
make test
|
|
220
|
+
|
|
221
|
+
# Testes com cobertura
|
|
222
|
+
make test-cov
|
|
223
|
+
|
|
224
|
+
# Formatação de código
|
|
225
|
+
black src/ tests/
|
|
226
|
+
ruff check src/ tests/
|
|
227
|
+
# ou
|
|
228
|
+
make format
|
|
229
|
+
|
|
230
|
+
# Type checking
|
|
231
|
+
mypy src/
|
|
232
|
+
# ou
|
|
233
|
+
make lint
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Comandos Make disponíveis
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
make help # Mostra todos os comandos disponíveis
|
|
240
|
+
make install # Instala o pacote localmente
|
|
241
|
+
make dev-install # Instala com dependências de dev
|
|
242
|
+
make test # Executa testes
|
|
243
|
+
make test-cov # Testes com cobertura
|
|
244
|
+
make lint # Executa linters
|
|
245
|
+
make format # Formata código
|
|
246
|
+
make clean # Limpa arquivos de build
|
|
247
|
+
make build # Gera pacotes de distribuição
|
|
248
|
+
make docker-build # Constrói imagem Docker
|
|
249
|
+
make docker-run # Executa container
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 📦 Publicação
|
|
253
|
+
|
|
254
|
+
Para publicar no repositório Nexus do Serpro, consulte o guia completo em [PUBLISH.md](PUBLISH.md).
|
|
255
|
+
|
|
256
|
+
### Quick Start para Publicação:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# 1. Configure as credenciais (uma vez)
|
|
260
|
+
cp .pypirc.example ~/.pypirc
|
|
261
|
+
# Edite ~/.pypirc com suas credenciais
|
|
262
|
+
|
|
263
|
+
# 2. Atualize a versão (se necessário)
|
|
264
|
+
make version-patch # 0.1.0 -> 0.1.1
|
|
265
|
+
# ou
|
|
266
|
+
make version-minor # 0.1.0 -> 0.2.0
|
|
267
|
+
|
|
268
|
+
# 3. Publique
|
|
269
|
+
make release
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Para mais detalhes, incluindo configuração de CI/CD, troubleshooting e instalação a partir do Nexus, veja [PUBLISH.md](PUBLISH.md).
|
|
273
|
+
|
|
274
|
+
## 📖 Documentação Adicional
|
|
275
|
+
|
|
276
|
+
- [Model Context Protocol (MCP)](https://modelcontextprotocol.io)
|
|
277
|
+
- [Agent Skills Standard](https://agentskills.io)
|
|
278
|
+
- [FastMCP Framework](https://github.com/jlowin/fastmcp)
|
|
279
|
+
|
|
280
|
+
## 📄 Licença
|
|
281
|
+
|
|
282
|
+
MIT License - veja [LICENSE](LICENSE) para detalhes.
|
|
283
|
+
|
|
284
|
+
## 🤝 Contribuindo
|
|
285
|
+
|
|
286
|
+
Contribuições são bem-vindas! Por favor:
|
|
287
|
+
|
|
288
|
+
1. Fork o projeto
|
|
289
|
+
2. Crie uma branch para sua feature (`git checkout -b feature/amazing`)
|
|
290
|
+
3. Commit suas mudanças (`git commit -m 'Add amazing feature'`)
|
|
291
|
+
4. Push para a branch (`git push origin feature/amazing`)
|
|
292
|
+
5. Abra um Pull Request
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "easy-skill-server"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Biblioteca para servir Agent Skills via Model Context Protocol (MCP)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Serpro", email = "vital@serpro.gov.br" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mcp", "agent", "skills", "ai", "anthropic"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
dependencies = [
|
|
27
|
+
"fastmcp>=0.4.0",
|
|
28
|
+
"uvicorn>=0.30.0",
|
|
29
|
+
"pyyaml>=6.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest>=8.0.0",
|
|
35
|
+
"pytest-cov>=4.1.0",
|
|
36
|
+
"black>=24.0.0",
|
|
37
|
+
"ruff>=0.3.0",
|
|
38
|
+
"mypy>=1.8.0",
|
|
39
|
+
"build>=1.0.0",
|
|
40
|
+
"twine>=5.0.0",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://git.serpro/vital/easy-skill-server"
|
|
45
|
+
Documentation = "https://git.serpro/vital/easy-skill-server/docs"
|
|
46
|
+
Repository = "https://git.serpro/vital/easy-skill-server"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = ["tests"]
|
|
53
|
+
python_files = ["test_*.py"]
|
|
54
|
+
python_classes = ["Test*"]
|
|
55
|
+
python_functions = ["test_*"]
|
|
56
|
+
|
|
57
|
+
[tool.black]
|
|
58
|
+
line-length = 88
|
|
59
|
+
target-version = ['py310']
|
|
60
|
+
|
|
61
|
+
[tool.ruff]
|
|
62
|
+
line-length = 88
|
|
63
|
+
target-version = "py310"
|
|
64
|
+
|
|
65
|
+
[tool.mypy]
|
|
66
|
+
python_version = "3.10"
|
|
67
|
+
warn_return_any = true
|
|
68
|
+
warn_unused_configs = true
|
|
69
|
+
disallow_untyped_defs = true
|