Files
Pietro Zullo be9942a4d4 feat/python/server (#559)
* feat: server first implementation

* docs: docs for server and images

* chore: locked langchain dependencies in pyproject.toml (#321)

* python/release/1.3.13

* catch uvicorn logs && log session id

* fix debug logic

* docs: logging update

* fix: icon of elicitation

* fix installation paths for local clones

* docs: minor restructuring

* docs: reorganization, killed non existing pages

* docs: beta tag on server

* chore: example servers

* feat: inspector autopopulated and client only

* feat: enhance MCP logging system with customizable formats and improved middleware

* feat: implement weather alert and forecast tools in FastMCP example server

* mcp path configurable

* fix inspector

* export as FastMCP too

* chore: update fastmcp migration example

* lock inspector version

* type runner

* unhide docs and remove dangers

* migration diff

* docs and context example

* export context

* logging improvement

* pretty JSON RPC

* autoConnect url param in inspecotr

* move logging

* type check

* Server Router

* show response logs

* fallback tool name to function name in router registration

* compatibility export

* Introduced ty and prek as type checker and precommit engine respectively - moved ruff config in pyproject toml

* add ty check

* ty runs only on staged files

* ty configuration fix

* move startup info in logging

* remove bug from action

* update claude rules

* fix resource serialization

* comments on inspector errors

* abstracted runner transports

* remove redunant call for network

* fix ip getter

* add inspector mcp path

* response limit logging

* disable ty check in action

* moved transport type to types

* support sse

* show transport type in logs

* change default transport

* refactored tests to use mcp server

* removed fastmcp

* file restructuring

* test table

* sampling, elicitation, tool disabling enabling

* deprecte sse server side

* simplified report

* fix action

* remove sse deprecated test

* move tests files to allow for server integration tests

* docs

* reorg integration test files

* api-reference-doxs

* fix broken links

* telemetry

* remove feature useage from scarf
2025-12-01 14:12:16 +01:00

223 lines
7.7 KiB
HTML

<!doctype html>
<html>
<head>
<title>MCP Docs</title>
<meta charset="utf-8">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
line-height: 1.6;
color: #333;
padding: 2em;
max-width: 800px;
margin: 0 auto;
}
pre {
background-color: #f4f4f4;
padding: 1em;
border-radius: 5px;
white-space: pre-wrap;
word-wrap: break-word;
font-size: 0.9em;
}
h1, h2, h3 {
border-bottom: 2px solid #eee;
padding-bottom: 0.5em;
}
details {
margin-bottom: 1em;
border: 1px solid #ddd;
border-radius: 5px;
}
summary {
padding: 1em;
font-weight: bold;
cursor: pointer;
background-color: #f9f9f9;
}
.content {
padding: 1em;
}
.card {
border: 1px solid #eee;
border-radius: 5px;
margin-bottom: 1em;
}
.card-header {
background-color: #f4f4f4;
padding: 0.5em 1em;
font-weight: bold;
border-bottom: 1px solid #eee;
}
.card-body {
padding: 1em;
}
.card-body p {
margin-top: 0;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 1em;
}
th, td {
text-align: left;
padding: 8px;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h1>MCP Server Specification</h1>
<div id="docs-container">Loading...</div>
<script>
function renderCapabilities(data) {
const container = document.createElement('div');
const table = document.createElement('table');
const thead = document.createElement('thead');
thead.innerHTML = `
<tr>
<th>Capability</th>
<th>Details</th>
</tr>
`;
table.appendChild(thead);
const tbody = document.createElement('tbody');
for (const [name, details] of Object.entries(data)) {
const row = document.createElement('tr');
const detailsText = details ? JSON.stringify(details, null, 2) : '<em>Not enabled</em>';
row.innerHTML = `
<td><code>${name}</code></td>
<td><pre>${detailsText}</pre></td>
`;
tbody.appendChild(row);
}
table.appendChild(tbody);
container.appendChild(table);
return container;
}
function renderSchema(schema, title) {
if (!schema || !schema.properties) return document.createElement('div');
const container = document.createElement('div');
const heading = document.createElement('h3');
heading.textContent = title;
container.appendChild(heading);
const table = document.createElement('table');
const thead = document.createElement('thead');
thead.innerHTML = `
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
`;
table.appendChild(thead);
const tbody = document.createElement('tbody');
for (const [name, details] of Object.entries(schema.properties)) {
const isRequired = schema.required && schema.required.includes(name);
const row = document.createElement('tr');
row.innerHTML = `
<td><code>${name}</code></td>
<td>${details.type}</td>
<td>${details.description || ''}</td>
<td>${isRequired ? '<strong>Yes</strong>' : 'No'}</td>
`;
tbody.appendChild(row);
}
table.appendChild(tbody);
container.appendChild(table);
return container;
}
function renderSection(container, title, data) {
if (!data || (Array.isArray(data) && data.length === 0)) {
return;
}
const details = document.createElement('details');
if (title === 'Info' || title === 'Tools' || title === 'Capabilities') {
details.open = true;
}
const summary = document.createElement('summary');
const count = Array.isArray(data) ? `(${data.length})` : '';
summary.textContent = `${title} ${count}`;
details.appendChild(summary);
const content = document.createElement('div');
content.className = 'content';
if (title === 'Capabilities') {
content.appendChild(renderCapabilities(data));
} else if (Array.isArray(data)) {
data.forEach(item => {
const card = document.createElement('div');
card.className = 'card';
const cardHeader = document.createElement('div');
cardHeader.className = 'card-header';
cardHeader.textContent = item.name || item.title || 'Item';
card.appendChild(cardHeader);
const cardBody = document.createElement('div');
cardBody.className = 'card-body';
if(item.description) {
const desc = document.createElement('p');
desc.textContent = item.description;
cardBody.appendChild(desc);
}
if (item.inputSchema) {
cardBody.appendChild(renderSchema(item.inputSchema, 'Input Schema'));
}
if (item.outputSchema) {
cardBody.appendChild(renderSchema(item.outputSchema, 'Output Schema'));
}
if (!item.inputSchema && !item.outputSchema) {
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(item, null, 2);
cardBody.appendChild(pre);
}
card.appendChild(cardBody);
content.appendChild(card);
});
} else {
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(data, null, 2);
content.appendChild(pre);
}
details.appendChild(content);
container.appendChild(details);
}
fetch('/openmcp.json')
.then(response => response.json())
.then(data => {
const container = document.getElementById('docs-container');
container.innerHTML = '';
renderSection(container, 'Info', data.info);
renderSection(container, 'Capabilities', data.capabilities);
renderSection(container, 'Tools', data.tools);
renderSection(container, 'Resources', data.resources);
renderSection(container, 'Prompts', data.prompts);
})
.catch(error => {
const container = document.getElementById('docs-container');
container.textContent = 'Error loading spec: ' + error;
});
</script>
</body>
</html>